summaryrefslogtreecommitdiff
path: root/src/mpi.h
AgeCommit message (Collapse)AuthorFilesLines
2016-01-28ecc: New API function gcry_mpi_ec_decode_point.Werner Koch1-0/+2
* mpi/ec.c (_gcry_mpi_ec_decode_point): New. * cipher/ecc-common.h: Move two prototypes to ... * src/ec-context.h: here. * src/gcrypt.h.in (gcry_mpi_ec_decode_point): New. * src/libgcrypt.def (gcry_mpi_ec_decode_point): New. * src/libgcrypt.vers (gcry_mpi_ec_decode_point): New. * src/visibility.c (gcry_mpi_ec_decode_point): New. * src/visibility.h: Add new function. -- This new function make the use of the gcry_mpi_ec_curve_point function possible in many contexts. Here is a code snippet which could be used in gpg to check a point: static gpg_error_t check_point (PKT_public_key *pk, gcry_mpi_t m_point) { gpg_error_t err; char *curve; gcry_ctx_t gctx = NULL; gcry_mpi_point_t point = NULL; /* Get the curve name from the first OpenPGP key parameter. */ curve = openpgp_oid_to_str (pk->pkey[0]); if (!curve) { err = gpg_error_from_syserror (); goto leave; } point = gcry_mpi_point_new (0); if (!point) { err = gpg_error_from_syserror (); goto leave; } err = gcry_mpi_ec_new (&gctx, NULL, curve); if (err) goto leave; err = gcry_mpi_ec_decode_point (point, m_point, gctx); if (err) goto leave; if (!gcry_mpi_ec_curve_point (point, gctx)) err = gpg_error (GPG_ERR_BAD_DATA); leave: gcry_ctx_release (gctx); gcry_mpi_point_release (point); xfree (curve); return err; } Signed-off-by: Werner Koch <wk@gnupg.org>
2015-02-12mpi: Add mpi_set_cond.NIIBE Yutaka1-0/+3
* mpi/mpiutil.c (_gcry_mpi_set_cond): New. (_gcry_mpi_swap_cond): Fix types. * src/mpi.h (mpi_set_cond): New.
2014-10-08mpi: Add gcry_mpi_ec_sub.Markus Teich1-0/+3
* NEWS (gcry_mpi_ec_sub): New. * doc/gcrypt.texi (gcry_mpi_ec_sub): New. * mpi/ec.c (_gcry_mpi_ec_sub, sub_points_edwards): New. (sub_points_montgomery, sub_points_weierstrass): New stubs. * src/gcrypt-int.h (_gcry_mpi_ec_sub): New. * src/gcrypt.h.in (gcry_mpi_ec_sub): New. * src/libgcrypt.def (gcry_mpi_ec_sub): New. * src/libgcrypt.vers (gcry_mpi_ec_sub): New. * src/mpi.h (_gcry_mpi_ec_sub_points): New. * src/visibility.c (gcry_mpi_ec_sub): New. * src/visibility.h (gcry_mpi_ec_sub): New. -- This function subtracts two points on the curve. Only Twisted Edwards curves are supported with this change. Signed-off-by: Markus Teich <markus dot teich at stusta dot mhn dot de>
2014-07-25mpi: Extend the internal mpi_get_buffer.Werner Koch1-0/+3
* mpi/mpicoder.c (do_get_buffer): Add arg EXTRAALLOC. (_gcry_mpi_get_buffer_extra): New.
2014-07-16mpi: Add mpi_swap_cond.NIIBE Yutaka1-0/+2
* mpi/mpiutil.c (_gcry_mpi_swap_cond): New. * src/mpi.h (mpi_swap_cond): New. -- This is an internal function for now.
2014-01-13ecc: Make a macro shorter.Werner Koch1-3/+8
* src/mpi.h (MPI_EC_TWISTEDEDWARDS): Rename to MPI_EC_EDWARDS. CHnage all users. * cipher/ecc-curves.c (domain_parms): Add parameters for Curve3617 as comment. * mpi/ec.c (dup_point_twistededwards): Rename to dup_point_edwards. (add_points_twistededwards): Rename to add_points_edwards. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-12-05Remove macro hacks for internal vs. external functions. Part 1.Werner Koch1-53/+1
* src/visibility.h: Remove almost all define/undef hacks for symbol visibility. Add macros to detect the use of the public functions. Change all affected functions by prefixing them explicitly with an underscore and change all internal callers to call the underscore prefixed versions. Provide convenience macros from sexp and mpi functions. * src/visibility.c: Change all functions to use only gpg_err_code_t and translate to gpg_error_t only in visibility.c. -- The use of the macro magic made if hard to follow the function calls in the source. It was not easy to see if an internal or external function (as defined by visibility.c) was called. The change is quite large but hopefully makes Libgcrypt easier to maintain. Some function have not yet been fixed; this will be done soon. Because Libgcrypt does no make use of any other libgpg-error using libraries it is useless to always translate between gpg_error_t and gpg_err_code_t (i.e with and w/o error source identifier). This translation has no mostly be moved to the function wrappers in visibility.c. An additional advantage of using gpg_err_code_t is that comparison can be done without using gpg_err_code(). I am sorry for that large patch, but a series of patches would actually be more work to audit. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-11-05ecc: Fully implement Ed25519 compression in ECDSA mode.Werner Koch1-0/+2
* src/ec-context.h (mpi_ec_ctx_s): Add field FLAGS. * mpi/ec.c (ec_p_init): Add arg FLAGS. Change all callers to pass it. * cipher/ecc-curves.c (point_from_keyparam): Add arg EC, parse as opaque mpi and use eddsa decoding depending on the flag. (_gcry_mpi_ec_new): Rearrange to parse Q and D after knowing the curve. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-10-02Fix missing prototype warning in visibility.cWerner Koch1-0/+4
* src/ec-context.h (_gcry_mpi_ec_new): Move prototype to mpi.h.
2013-09-25mpi: Change not yet used _gcry_mpi_set_opaque_copy.Werner Koch1-1/+1
* mpi/mpiutil.c (_gcry_mpi_set_opaque_copy): Change prototype. (_gcry_mpi_get_opaque_copy): Take care of gcry_malloc failure.
2013-09-25ecc: Refactor low-level access functions.Werner Koch1-2/+0
* mpi/ec.c (point_copy): Move to cipher/ecc-curves.c. (ec_get_reset): Rename to _gcry_mpi_ec_get_reset and make global. (_gcry_mpi_ec_get_mpi): Factor most code out to _gcry_ecc_get_mpi. (_gcry_mpi_ec_get_point): Factor most code out to _gcry_ecc_get_point. (_gcry_mpi_ec_set_mpi): Factor most code out to _gcry_ecc_set_mpi. (_gcry_mpi_ec_set_point): Factor most code out to _gcry_ecc_set_point. * cipher/ecc-curves.c (_gcry_ecc_get_mpi): New. (_gcry_ecc_get_point, _gcry_ecc_set_mpi, _gcry_ecc_set_point): New. * cipher/ecc-misc.c (_gcry_ecc_compute_public): New. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-09-19pk: Move s-expr creation for sign and encrypt to the modules.Werner Koch1-0/+3
* cipher/pubkey.c (pubkey_encrypt): Fold into gcry_pk_encrypt. (pubkey_decrypt): Fold into gcry_pk_decrypt. (pubkey_sign): Fold into gcry_pk_sign. (pubkey_verify): Fold into gcry_pk_verify. (octet_string_from_mpi): Make it a wrapper and factor code out to ... * mpi/mpicoder.c (_gcry_mpi_to_octet_string): New function. * src/cipher.h (PUBKEY_FLAG_FIXEDLEN): New. * cipher/pubkey.c (sexp_data_to_mpi): Set flag for some encodings. (gcry_pk_encrypt): Simply by moving the s-expr generation to the modules. (gcry_pk_sign): Ditto. * cipher/dsa.c (dsa_sign): Create s-expr. * cipher/elgamal.c (elg_encrypt, elg_sign): Ditto. * cipher/rsa.c (rsa_encrypt, rsa_sign): Ditto. * cipher/ecc.c (ecc_sign, ecc_encrypt_raw): Ditto. (ecdsa_names): Add "eddsa". * tests/t-ed25519.c (one_test): Expect "eddsa" token. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-09-18ecc: Add Ed25519 key generation and prepare for optimizations.Werner Koch1-0/+13
* src/mpi.h (enum ecc_dialects): New. * src/ec-context.h (mpi_ec_ctx_s): Add field DIALECT. * cipher/ecc-common.h (elliptic_curve_t): Ditto. * cipher/ecc-curves.c (ecc_domain_parms_t): Ditto. (domain_parms): Add dialect values. (_gcry_ecc_fill_in_curve): Set dialect. (_gcry_ecc_get_curve): Ditto. (_gcry_mpi_ec_new): Ditto. (_gcry_ecc_get_param): Use ECC_DIALECT_STANDARD for now. * cipher/ecc-misc.c (_gcry_ecc_curve_copy): Copy dialect. (_gcry_ecc_dialect2str): New. * mpi/ec.c (ec_p_init): Add arg DIALECT. (_gcry_mpi_ec_p_internal_new): Ditto. (_gcry_mpi_ec_p_new): Ditto. * mpi/mpiutil.c (gcry_mpi_set_opaque): Set the secure flag. (_gcry_mpi_set_opaque_copy): New. * cipher/ecc-misc.c (_gcry_ecc_os2ec): Take care of an opaque MPI. * cipher/ecc.c (eddsa_generate_key): New. (generate_key): Rename to nist_generate_key and factor some code out to ... (ecc_generate_ext): here. Divert to eddsa_generate_key if desired. (eddsa_decodepoint): Take care of an opaque MPI. (ecc_check_secret_key): Ditto. (ecc_sign): Ditto. * cipher/pubkey.c (sexp_elements_extract_ecc): Store public and secret key as opaque MPIs. (gcry_pk_genkey): Add the curve_name also to the private key part of the result. * tests/benchmark.c (ecc_bench): Support Ed25519. (main): Add option --debug. * tests/curves.c (sample_key_2): Make sure that P and N are positive. * tests/keygen.c (show): New. (check_ecc_keys): Support Ed25519. -- There are two main purposes of this patch: Add a key generation feature for Ed25519 and add the "dialect" thingy which will eventually be used to add curve specific optimization. Note that the entire way of how we interface between the public key modules and pubkey.c is overly complex and probably also the cause for a lot of performance overhead. Given that we don't have the loadable module system anymore, we should entirely get rid of the MPI-array based internal interface and move parts of the s-expression handling direct into the pubkey modules. This needs to be fixed or we are turning Libgcrypt into another software incarnation of Heathrow Airport. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-09-16ecc: Implement Curve Ed25519 signing and verification.Werner Koch1-2/+5
* cipher/ecc-curves.c (domain_parms): Add curve "Ed25519". * cipher/ecc.c (reverse_buffer): New. (eddsa_encodempi): New. (eddsa_encodepoint): New. (eddsa_decodepoint): New. (sign_eddsa): Implement. (verify_eddsa): Implement. (ecc_sign): Init unused Q. Pass public key to sign_eddsa. (ecc_verify): Init pk.Q if not used. Pass public key verbatim to verify_eddsa. * cipher/pubkey.c (sexp_elements_extract): Add arg OPAQUE. Change all callers to pass 0. (sexp_to_sig): Add arg OPAQUE and pass it to sexp_elements_extract. (sexp_data_to_mpi): Allow for a zero length "value". (gcry_pk_verify): Reorder parameter processing. Pass OPAQUE flag as required. * mpi/ec.c (ec_invm): Print a warning if the inverse does not exist. (_gcry_mpi_ec_get_affine): Implement for our Twisted Edwards curve model. (dup_point_twistededwards): Implement. (add_points_twistededwards): Implement. (_gcry_mpi_ec_mul_point): Support Twisted Edwards. * mpi/mpicoder.c (do_get_buffer): Add arg FILL_LE. (_gcry_mpi_get_buffer): Ditto. Change all callers. (_gcry_mpi_get_secure_buffer): Ditto. * src/sexp.c (_gcry_sexp_nth_opaque_mpi): New. * tests/t-ed25519.c: New. * tests/t-ed25519.inp: New. * tests/t-mpi-point.c (basic_ec_math_simplified): Print some output only in debug mode. (twistededwards_math): New test. (main): Call new test. -- This is a non optimized version which takes far too long. On my X220 Thinkpad the 1024 test cases take 14 seconds (12 with --sign-with-pk). There should be a lot of room for improvements. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-09-16mpi: Add internal convenience function.Werner Koch1-0/+1
* mpi/mpiutil.c (_gcry_mpi_get_opaque_copy): New. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-09-16mpi: Add debug function to print a point.Werner Koch1-0/+3
* mpi/ec.c (_gcry_mpi_point_log): New. * src/mpi.h (log_printpnt): new macro. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-09-11Streamline the use of the internal mpi and hex debug functions.Werner Koch1-2/+0
* mpi/mpicoder.c (gcry_mpi_dump): Remove. (_gcry_log_mpidump): Remove. * src/misc.c (_gcry_log_printhex): Factor all code out to ... (do_printhex): new. Add line wrapping a and compact printing. (_gcry_log_printmpi): New. * src/mpi.h (log_mpidump): Remove macro. * src/g10lib.h (log_mpidump): Add compatibility macro. (log_printmpi): New macro * src/visibility.c (gcry_mpi_dump): Call _gcry_log_printmpi. * cipher/primegen.c (prime_generate_internal): Replace gcry_mpi_dump by log_printmpi. (gcry_prime_group_generator): Ditto. * cipher/pubkey.c: Remove extra colons from log_mpidump call. * cipher/rsa.c (stronger_key_check): Use log_printmpi. -- The values to debug get longer and longer and the different debug functions made it hard to check them out. Now MPIs and hex buffers are printed very similar. Lines may now wrap with an backslash as indicator. MPIs are distinguished from plain buffers in the output by always using a sign. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-09-07mpi: Improve support for non-Weierstrass support.Werner Koch1-3/+7
* mpi/ec.c (ec_p_init): Add args MODEL and P. Change all callers. (_gcry_mpi_ec_p_internal_new): Ditto. (_gcry_mpi_ec_p_new): Ditto. * cipher/ecc-curves.c (_gcry_ecc_fill_in_curve): Return GPG_ERR_UNKNOWN_CURVE instead of invalid value. Init curve model. * cipher/ecc.c (ecc_verify, ecc_encrypt_raw): Ditto. * cipher/pubkey.c (sexp_data_to_mpi): Fix EDDSA flag error checking. -- (fixes commit c26be7a337d0bf98193bc58e043209e46d0769bb)
2013-09-07mpi: Add functions to manipulate the sign.Werner Koch1-1/+4
* src/gcrypt.h.in (gcry_mpi_is_neg): New. (gcry_mpi_neg, gcry_mpi_abs): New. * mpi/mpiutil.c (_gcry_mpi_is_neg): New. (_gcry_mpi_neg, _gcry_mpi_abs): New. * src/visibility.c, src/visibility.h: Add wrappers. * src/libgcrypt.def, src/libgcrypt.vers: Export them. * src/mpi.h (mpi_is_neg): New. Rename old macro to mpi_has_sign. * mpi/mpi-mod.c (_gcry_mpi_mod_barrett): Use mpi_has_sign. * mpi/mpi-mpow.c (calc_barrett): Ditto. * cipher/primegen.c (_gcry_derive_x931_prime): Ditto * cipher/rsa.c (secret): Ditto.
2013-09-04Prepare support for non-Weierstrass EC equations.Werner Koch1-0/+12
* src/mpi.h (gcry_mpi_ec_models): New. * src/ec-context.h (mpi_ec_ctx_s): Add MODEL. * cipher/ecc-common.h (elliptic_curve_t): Ditto. * cipher/ecc-curves.c (ecc_domain_parms_t): Ditto. (domain_parms): Mark als as Weierstrass. (_gcry_ecc_fill_in_curve): Check model. (_gcry_ecc_get_curve): Set model to Weierstrass. * cipher/ecc-misc.c (_gcry_ecc_model2str): New. * cipher/ecc.c (generate_key, ecc_generate_ext): Print model in the debug output. * mpi/ec.c (_gcry_mpi_ec_dup_point): Switch depending on model. Factor code out to ... (dup_point_weierstrass): new. (dup_point_montgomery, dup_point_twistededwards): New stub functions. (_gcry_mpi_ec_add_points): Switch depending on model. Factor code out to ... (add_points_weierstrass): new. (add_points_montgomery, add_points_twistededwards): New stub functions. * tests/Makefile.am (TESTS): Reorder tests. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-03-19Extend the new EC interface and fix two bugs.Werner Koch1-0/+2
* src/ec-context.h (mpi_ec_ctx_s): Add field NEED_SYNC. * mpi/ec.c (ec_p_sync): New. (ec_p_init): Only set NEED_SYNC. (_gcry_mpi_ec_set_mpi): Set NEED_SYNC for 'p' and 'a'. (_gcry_mpi_ec_dup_point, _gcry_mpi_ec_add_points) (_gcry_mpi_ec_mul_point): Call ec_p_sync. (_gcry_mpi_ec_get_point): Recompute 'q' is needed. (_gcry_mpi_ec_get_mpi): Ditto. Also allow for names 'q', 'q.x', 'q.y', and 'g'. * cipher/ecc.c (_gcry_mpi_ec_ec2os): New. * cipher/ecc.c (_gcry_mpi_ec_new): Fix init from parameters 'Q'->'q', 'G'->'q'. -- Note that the parameter names are all lowercase. This patch fixes an inconsistency. The other bug was that changing the parameters D or A may have resulted in wrong computations because helper variables were not updated. Now we delay the computation of those helper variables until we need them.
2013-03-15mpi: Add functions to manipulate an EC context.Werner Koch1-0/+13
* src/gcrypt.h.in (gcry_mpi_ec_p_new): Remove. (gcry_mpi_ec_new): New. (gcry_mpi_ec_get_mpi): New. (gcry_mpi_ec_get_point): New. (gcry_mpi_ec_set_mpi): New. (gcry_mpi_ec_set_point): New. * src/visibility.c (gcry_mpi_ec_p_new): Remove. * mpi/ec.c (_gcry_mpi_ec_p_new): Make it an internal function and change to return an error code. (_gcry_mpi_ec_get_mpi): New. (_gcry_mpi_ec_get_point): New. (_gcry_mpi_ec_set_mpi): New. (_gcry_mpi_ec_set_point): New. * src/mpi.h: Add new prototypes. * src/ec-context.h: New. * mpi/ec.c: Include that header. (mpi_ec_ctx_s): Move to ec-context.h, add new fields, and put some fields into an inner struct. (point_copy): New. * cipher/ecc.c (fill_in_curve): Allow passing NULL for R_NBITS. (mpi_from_keyparam, point_from_keyparam): New. (_gcry_mpi_ec_new): New. * tests/t-mpi-point.c (test-curve): New. (ec_p_new): New. Use it instead of the removed gcry_mpi_ec_p_new. (get_and_cmp_mpi, get_and_cmp_point): New. (context_param): New test. (basic_ec_math_simplified): New test. (main): Call new tests. * src/context.c (_gcry_ctx_get_pointer): Check for a NULL CTX. -- gcry_mpi_ec_p_new() was a specialized version of the more general new gcry_mpi_ec_new(). It was added to master only a few days ago, thus there should be no problem to remove it. A replacement can easily be written (cf. t-mpi-point.c). Note that gcry_mpi_ec_set_mpi and gcry_mpi_ec_set_point have not yet been tested.
2013-03-13Add GCRYMPI_FLAG_CONST and make use constants.Werner Koch1-1/+21
* src/gcrypt.h.in (GCRYMPI_FLAG_CONST): New. * src/mpi.h (mpi_is_const, mpi_const): New. (enum gcry_mpi_constants, MPI_NUMBER_OF_CONSTANTS): New. * mpi/mpiutil.c (_gcry_mpi_init): New. (constants): New. (_gcry_mpi_free): Do not release a constant flagged MPI. (gcry_mpi_copy): Clear the const and immutable flags. (gcry_mpi_set_flag, gcry_mpi_clear_flag, gcry_mpi_get_flag): Support GCRYMPI_FLAG_CONST. (_gcry_mpi_const): New. * src/global.c (global_init): Call _gcry_mpi_init. * mpi/ec.c (mpi_ec_ctx_s): Remove fields one, two, three, four, and eight. Change all users to call mpi_const() instead. * src/mpiutils.c (gcry_mpi_set_opaque): Check the immutable flag. -- Allocating the trivial constants newly for every EC context is a waste of memory and cpu cycles. We instead provide a simple mechanism to internally support such constants. Using a new flag in THE API also allows to mark an arbitrary MPI as constant. The drawback of the constants is the their memory will never be deallocated. However, that is what constants are about.
2013-03-13Add GCRYMPI_FLAG_IMMUTABLE to help debugging.Werner Koch1-3/+8
* src/gcrypt.h.in (GCRYMPI_FLAG_IMMUTABLE): New. * src/mpi.h (mpi_is_immutable): New macro. * mpi/mpiutil.c (gcry_mpi_set_flag, gcry_mpi_clear_flag) (gcry_mpi_get_flag): Implement new flag (_gcry_mpi_immutable_failed): New. * mpi/mpiutil.c (_gcry_mpi_clear, _gcry_mpi_free, gcry_mpi_snatch) (gcry_mpi_set, gcry_mpi_randomize): Act upon the immutable flag. * mpi/mpi-bit.c (gcry_mpi_set_bit, gcry_mpi_set_highbit) (gcry_mpi_clear_highbit, gcry_mpi_clear_bit) (_gcry_mpi_rshift_limbs, gcry_mpi_lshift): Ditto. * mpi/mpicoder.c (_gcry_mpi_set_buffer): Ditto. -- Note that this flag is currently only checked by a few MPI functions. The reason why we eventually need such a flag is to help implementing a generic way to retrieve and set ECC parameters without accidentally changing a curve parameter taken from a list of predefined curves.
2013-03-08mpi: Add an API for EC math.Werner Koch1-1/+1
* src/context.c, src/context.h: New. * src/Makefile.am (libgcrypt_la_SOURCES): Add new files. * src/gcrypt.h.in (struct gcry_context, gcry_ctx_t): New types. (gcry_ctx_release): New prototype. (gcry_mpi_ec_p_new, gcry_mpi_ec_get_affine, gcry_mpi_ec_dup) (gcry_mpi_ec_add, gcry_mpi_ec_mul): New prototypes. * mpi/ec.c: Include errno.h and context.h. (_gcry_mpi_ec_init): Rename to .. (ec_p_init): this, make static, remove allocation and add arg CTX. (_gcry_mpi_ec_p_internal_new): New; to replace _gcry_mpi_ec_init. Change all callers to use this func. (_gcry_mpi_ec_free): Factor code out to .. (ec_deinit): New func. (gcry_mpi_ec_p_new): New. * src/visibility.c: Include context.h and mpi.h. (gcry_mpi_ec_p_new, gcry_mpi_ec_get_affine, gcry_mpi_ec_dup) (gcry_mpi_ec_add, gcry_mpi_ec_mul) (gcry_ctx_release): New wrapper functions. * src/visibility.h: Mark new wrapper functions visible. * src/libgcrypt.def, src/libgcrypt.vers: Add new symbols. * tests/t-mpi-point.c (print_mpi, hex2mpi, cmp_mpihex): New. (context_alloc): New. (make_point, basic_ec_math): New. -- This part finishes the basic API to do EC math. It provides a wrapper around all internal functions. tests/t-mpi-point.c may be useful as sample code. Eventually we will add function to retrieve curve parameters etc.
2013-03-07mpi: Add mpi_snatch and change an internal typedef.Werner Koch1-12/+18
* src/mpi.h (struct mpi_point_s): Rename to struct gcry_mpi_point. (mpi_point_struct): New typedef. (mpi_point_t): Change typedef to a pointer. Replace all occurrences to use mpi_point_struct. * mpi/ec.c (_gcry_mpi_ec_point_init): Rename to .. (_gcry_mpi_point_init): this. Change all callers. (_gcry_mpi_ec_point_free): Rename to .. (_gcry_mpi_point_free_parts): this. Change all callers. * mpi/mpiutil.c (gcry_mpi_snatch): New function. * src/gcrypt.h.in (gcry_mpi_snatch, mpi_snatch): Add protoype and macro. * src/visibility.c (gcry_mpi_snatch): Add wrapper. * src/visibility.h (gcry_mpi_snatch): Add macro magic. * src/libgcrypt.def, src/libgcrypt.vers: Add new function. -- This patch is a prerequisite to implement a public point API. The new function gcry_mpi_snatch is actually not needed for this but is useful anyway and will be used to implement the point API.
2011-02-04Nuked almost all trailing whitespace.Werner Koch1-9/+9
Check and install the standard git pre-commit hook.
2010-04-12Applied spelling fixes and more verbose test diagnositcs by Brad Hards.Werner Koch1-1/+1
2009-02-16Portability fixes.Werner Koch1-1/+2
2008-08-19Adding gcry_mpi_lshift.Werner Koch1-0/+1
Preparing a release candidate.
2007-10-31Reorganizatiosn to support the visibility attribute.Werner Koch1-3/+0
This can be improved by using fucntion aliases instead of wrapper functions.
2007-03-28Rewrote the ECDSA implementation.Werner Koch1-0/+32
2007-03-23Did some performance experiments and added code for Barrett reduction.Werner Koch1-1/+21
2007-03-22Experimental support for ECDSA.Werner Koch1-18/+27
This is not ready but the key generation and the self-test works.
2007-02-21A lot of cleanups as well as minor API changes.Werner Koch1-1/+2
Ported some changes from 1.2 to here.
2005-02-132005-02-13 Moritz Schulte <moritz@g10code.com>Moritz Schulte1-1/+4
* gcrypt.h: Declare new functions: gcry_ac_data_encrypt_scheme, gcry_ac_data_decrypt_scheme, gcry_ac_data_sign_scheme, gcry_ac_data_verify_scheme, gcry_ac_data_encode, gcry_ac_data_decode, gcry_ac_data_to_sexp, gcry_ac_data_from_sexp. New types: gcry_ac_emsa_pkcs_v1_5_t, gcry_ac_ssa_pkcs_v1_5_t, gcry_md_algo_t. New enumeration lists: gcry_ac_scheme_t, gcry_ac_em_t. * libgcrypt.vers: Added new ac functions. * g10lib.h: Declare function: _gcry_pk_get_elements. * mpi.h (mpi_get_ui): New macro. Declare function: _gcry_mpi_get_ui.
2003-07-142003-07-15 Moritz Schulte <moritz@g10code.com>Moritz Schulte1-7/+0
* gcrypt.h: Bumped version number up to 1.1.42-cvs. 2003-07-14 Moritz Schulte <moritz@g10code.com> * gcrypt.h (gcry_cipher_spec): New member: aliases. * Makefile.am (noinst_PROGRAMS, testapi_SOURCES, testapai_LDADD, benchmark_SOURCES, benchmark_LDADD): Removed. * benchmark.c, testapi.c: Removed files. * mpi.h: Removed disabled typedef. * g10lib.h: Likewise. * benchmark.c, g10lib.h, gcrypt.h, global.c, module.c, sexp.c: Used gcry_err* wrappers for libgpg-error symbols. 2003-07-12 Moritz Schulte <moritz@g10code.com> * global.c: Likewise. * gcrypt.h: New type: gcry_error_t, gcry_err_code_t and gcry_err_source_t. (gcry_err_make, gcry_error, gcry_err_code, gcry_err_source): New functions. * global.c (gcry_strerror): New function. (gcry_strsource): New function. * gcrypt.h: New symbol: GCRY_CIPHER_TWOFISH128. 2003-07-09 Moritz Schulte <moritz@g10code.com> * gcrypt.h (enum gcry_md_flags): Removed, used define instead, since that is more common than an enumeration list when it comes to flags that can be bitwise ORed.
2003-06-172003-06-17 Moritz Schulte <moritz@g10code.com>Moritz Schulte1-39/+43
* Makefile.am (AM_CFLAGS): Added: @GPG_ERROR_CFLAGS@. 2003-06-16 Moritz Schulte <moritz@g10code.com> * g10lib.h: Replace last occurences of old type names with newer names (i.e. replace MPI with gcry_mpi_t). * mpi.h: Likewise. * sexp.c: Likewise.
2003-06-09v2003-06-09 Moritz Schulte <moritz@g10code.com>Moritz Schulte1-13/+13
* Makefile.am: Support for libgpg-error. 2003-06-08 Moritz Schulte <moritz@g10code.com> * sexp.c (gcry_sexp_create): Expect sane error values from gcry_sexp_canon_len instead of the `historical' values. 2003-06-07 Moritz Schulte <moritz@g10code.com> * ath.c, ath.c, ath-pth.c, ath-pthread.c, benchmark.c, cipher.h, g10lib.h, gcrypt.h, global.c, misc.c, missing-string.c, module.c, mpi.h, secmem.c, secmem.h, sexp.c, stdmem.c, stdmem.h, testapi.c, types.h: Edited all preprocessor instructions to remove whitespace before the '#'. This is not required by C89, but there are some compilers out there that don't like it. Replaced any occurence of the now deprecated type names with the new ones. * gcrypt.h: Re-organized checking for gcc features; New macro: _GCRY_GCC_ATTR_DEPRECATED. Include copy of libgpg-error's gpg-error.h in order to make it easy to build libgcrypt without needing libgpg-error.h. (GCRY_MPI, GcryMPI, GCRY_SEXP, GcrySexp, GCRY_CIPHER_HD, GcryCipherHd, GCRY_MD_HD, GcryMDHd): Declared deprecated. (gcry_mpi_t, gcry_sexp_t, gcry_cipher_hd_t, gcry_md_hd_t): New types. 2003-06-04 Moritz Schulte <moritz@g10code.com> * sexp.c (sexp_sscan): New argument: arg_list, adjusted all callers. (ARG_NEXT): New macro. (sexp_sscan): Use ARG_NEXT for receiving format string arguments. (gcry_sexp_build_array): New function. 2003-06-02 Moritz Schulte <moritz@g10code.com> * gcrypt.h: Added some comments describing the gcry_sexp_* functions. Include <gpg-error.h> instead of <gpg/error.h>. 2003-06-01 Moritz Schulte <moritz@g10code.com> * sexp.c (OLDPARSECODE): Removed macro... (gcry_sexp_canon_len): ... and do not use it. * gcrypt.h (gcry_errno): Removed declaration. * g10lib.h (string_to_pubkey_algo, pubkey_algo_to_string, pubkey_nbits): Removed declarations for non-existing functions. 2003-05-31 Moritz Schulte <moritz@g10code.com> * cipher.h (is_RSA, is_ELGAMAL): Removed macros. * g10lib.h (set_lasterr): Removed macro. (_gcry_set_lasterr): Removed declaration. * gcrypt.h: Changed declarations for: gcry_pk_algo_info, gcry_md_open, gcry_md_copy, gcry_md_algo_info, gcry_md_info, gcry_md_get_algo, gcry_random_add_bytes. (gcry_md_is_secure): Adjust macro for new API. 2003-05-29 Moritz Schulte <moritz@g10code.com> * gcrypt.h: Changed declarations for: gcry_cipher_open, gcry_cipher_info, gcry_cipher_algo_info. (gcry_cipher_get_algo_keylen): Adjuster for new gcry_cipher_algo_info interface. (gcry_cipher_get_algo_blklen): Likewise. * global.c (gcry_errno): Removed function. (gcry_strerror): Do not use gcry_errno. (_gcry_set_lasterr): Removed function. (last_ec): Removed variable. 2003-05-27 Moritz Schulte <moritz@g10code.com> * gcrypt.h (enum gcry_cipher_algos): Make Serpent IDs do not conflict with OpenPGP. Reported by Timo Schulz. * global.c (gcry_control): Fixed name of enum list. 2003-05-25 Moritz Schulte <moritz@g10code.com> * cipher.h (gcry_cipher_spec): Adjust return type of `setkey' for libgpg-error. (gcry_pubkey_spec): Adjust return type of `generate', `check_secret_key', `encrypt', `decrypt', `sign' and `verify' for libgpg-error. * sexp.c (gcry_sexp_canon_len): Adjusted for libgpg-error. (gcry_sexp_create): Likewise. (gcry_sexp_new): Likewise. (sexp_sscan): Likewise. (gcry_sexp_build): Likewise. (gcry_sexp_sscan): Likewise. * module.c (_gcry_module_add): Likewise. * global.c (last_ec): Change type to gpg_error_t. (gcry_control): Adjust for libgpg-error. (gcry_errno): Likewise. (gcry_strerror): Likewise. (_gcry_set_lasterr): Likewise. (gcry_xmalloc): Likewise. (gcry_xrealloc): Likewise. 2003-05-22 Moritz Schulte <moritz@g10code.com> * types.h: Merged code from GnuPG regarding U64_C. * missing-string.c (strsep): Removed function. * g10lib.h: Removed declarations: strsep, strlwr. * secmem.c (secmem_lock): New variable. (SECMEM_LOCK, SECMEM_UNLOCK): New macros. (_gcry_secmem_set_flags): Use SECMEM_LOCK and SECMEM_UNLOCK. (_gcry_secmem_get_flags): Likewise. (_gcry_secmem_init): Likewie. (_gcry_secmem_malloc): Likewise. (_gcry_secmem_free): Likewise. (_gcry_secmem_malloc): Renamed to ... (_gcry_secmem_malloc_internal): ... this. (_gcry_secmem_malloc): New function, use SECMEM_LOCK, SECMEM_UNLOCK, call _gcry_secmem_malloc_internal. (_gcry_secmem_free): Renamed to ... (_gcry_secmem_free_internal): ... this. (_gcry_secmem_free): New function, use SECMEM_LOCK, SECMEM_UNLOCK, call _gcry_secmem_free_internal. (_gcry_secmem_realloc): Use SECMEM_LOCK, SECMEM_UNLOCK, call _gcry_secmem_malloc_internal and _gcry_secmem_free_internal. (_gcry_private_is_secure): Use SECMEM_LOCK, SECMEM_UNLOCK. (_gcry_secmem_dump_stats): Likewise. (_gcry_secmem_malloc_internal): Removed unused variable: compressed. Include "ath.h". 2003-05-21 Moritz Schulte <moritz@g10code.com> * gcrypt.h (GCRY_CIPHER_SERPENT128, GCRY_CIPHER_SERPENT192, GCRY_CIPHER_SERPENT256): New symbols.
2002-05-14Change the license to the LGPL.Werner Koch1-12/+10
2001-05-31The first libgcrypt only release.Werner Koch1-64/+97
2001-05-28Merged back some changes fron gnupg. Fixed doc building.Werner Koch1-1/+0
2000-12-19Compiles againWerner Koch1-0/+2
2000-10-11Add features packet and fixes MIPS3.Werner Koch1-6/+19
2000-01-24See ChangeLog: Mon Jan 24 13:04:28 CET 2000 Werner KochWerner Koch1-1/+0
1999-12-31See ChangeLog: Fri Dec 31 14:06:56 CET 1999 Werner KochWerner Koch1-3/+0
1999-12-31See ChangeLog: Fri Dec 31 12:48:31 CET 1999 Werner KochWerner Koch1-1/+0
1999-12-08See ChangeLog: Wed Dec 8 21:58:32 CET 1999 Werner KochWerner Koch1-0/+162