summaryrefslogtreecommitdiff
path: root/mpi/mpiutil.c
Commit message (Collapse)AuthorAgeFilesLines
* Clean up for removal of memory guard support.NIIBE Yutaka2022-02-101-7/+0
| | | | | | | | | | | | * mpi/mpiutil.c (_gcry_mpi_m_check): Remove. * src/g10lib.h (_gcry_check_heap): Remove. * src/global.c (_gcry_check_heap): Remove. * src/mpi.h (mpi_m_check): Remove. -- GnuPG-bug-id: 5822 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* mpi: Allow opaque MPI with zero length.NIIBE Yutaka2021-10-291-4/+7
| | | | | | | | * mpi/mpiutil.c (_gcry_mpi_copy): Support zero length. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* mpi/ec: add fast reduction functions for NIST curvesJussi Kivilinna2021-06-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (ASM_DISABLED): New. * mpi/Makefile.am: Add 'ec-nist.c' and 'ec-inline.h'. * mpi/ec-nist.c: New. * mpi/ec-inline.h: New. * mpi/ec-internal.h (_gcry_mpi_ec_nist192_mod) (_gcry_mpi_ec_nist224_mod, _gcry_mpi_ec_nist256_mod) (_gcry_mpi_ec_nist384_mod, _gcry_mpi_ec_nist521_mod): New. * mpi/ec.c (ec_addm, ec_subm, ec_mulm, ec_mul2): Use 'ctx->mod'. (field_table): Add 'mod' function; Add NIST reduction functions. (ec_p_init): Setup ctx->mod; Setup function pointers from field_table only if pointer is not NULL; Resize ctx->a and ctx->b only if set. * mpi/mpi-internal.h (RESIZE_AND_CLEAR_IF_NEEDED): New. * mpi/mpiutil.c (_gcry_mpi_resize): Clear all unused limbs also in realloc case. * src/ec-context.h (mpi_ec_ctx_s): Add 'mod' function. -- Benchmark on AMD Ryzen 7 5800X (x86_64): Before: NIST-P192 | nanosecs/iter cycles/iter auto Mhz mult | 283346 1369473 4833 keygen | 1688442 8185744 4848 sign | 549683 2662984 4845 verify | 615284 2984325 4850 = NIST-P224 | nanosecs/iter cycles/iter auto Mhz mult | 516443 2501173 4843 keygen | 2859746 13866802 4849 sign | 918472 4455043 4850 verify | 1057940 5131372 4850 = NIST-P256 | nanosecs/iter cycles/iter auto Mhz mult | 423536 2054040 4850 keygen | 2383097 11557572 4850 sign | 774346 3754243 4848 verify | 864934 4196315 4852 = NIST-P384 | nanosecs/iter cycles/iter auto Mhz mult | 929985 4511881 4852 keygen | 5230788 25367299 4850 sign | 1671432 8109726 4852 verify | 1902729 9228568 4850 = NIST-P521 | nanosecs/iter cycles/iter auto Mhz mult | 2123546 10300952 4851 keygen | 12019340 58297774 4850 sign | 3886988 18853054 4850 verify | 4507885 21864015 4850 After: NIST-P192 | nanosecs/iter cycles/iter auto Mhz speed-up mult | 186679 905603 4851 +51% keygen | 1161423 5623822 4842 +46% sign | 389531 1887557 4846 +41% verify | 412936 2000461 4844 +49% = NIST-P224 | nanosecs/iter cycles/iter auto Mhz speed-up mult | 260621 1256327 4821 +99% keygen | 1557845 7531677 4835 +84% sign | 521678 2527083 4844 +76% verify | 554084 2677949 4833 +92% = NIST-P256 | nanosecs/iter cycles/iter auto Mhz speed-up mult | 319045 1542061 4833 +33% keygen | 1834822 8898950 4850 +30% sign | 612866 2972630 4850 +26% verify | 664821 3222597 4847 +30% = NIST-P384 | nanosecs/iter cycles/iter auto Mhz speed-up mult | 593894 2875260 4841 +57% keygen | 3526600 17089717 4846 +48% sign | 1178098 5710151 4847 +42% verify | 1260185 6107449 4846 +51% = NIST-P521 | nanosecs/iter cycles/iter auto Mhz speed-up mult | 1160220 5621946 4846 +83% keygen | 6862975 33247351 4844 +75%ยด sign | 2287366 11096711 4851 +70% verify | 2455858 11888045 4841 +84% Benchmark on AMD Ryzen 7 5800X (i386): Before: NIST-P192 | nanosecs/iter cycles/iter auto Mhz mult | 648039 3143236 4850 keygen | 3554452 17244822 4852 sign | 1163173 5641932 4850 verify | 1300076 6305673 4850 = NIST-P224 | nanosecs/iter cycles/iter auto Mhz mult | 798607 3874405 4851 keygen | 4657604 22589864 4850 sign | 1515803 7352049 4850 verify | 1635470 7935373 4852 = NIST-P256 | nanosecs/iter cycles/iter auto Mhz mult | 927033 4496283 4850 keygen | 5313601 25771983 4850 sign | 1735795 8418514 4850 verify | 1945804 9438212 4851 = NIST-P384 | nanosecs/iter cycles/iter auto Mhz mult | 2301781 11164473 4850 keygen | 12856001 62353242 4850 sign | 4161041 20180651 4850 verify | 4705961 22827478 4851 = NIST-P521 | nanosecs/iter cycles/iter auto Mhz mult | 6066635 29422721 4850 keygen | 32995868 160046407 4850 sign | 10503306 50945387 4850 verify | 12225252 59294323 4850 After: NIST-P192 | nanosecs/iter cycles/iter auto Mhz speed-up mult | 413605 2007498 4854 +57% keygen | 2479429 12010926 4844 +44% sign | 825111 3997147 4844 +41% verify | 890206 4318723 4851 +46% = NIST-P224 | nanosecs/iter cycles/iter auto Mhz speed-up mult | 551703 2676454 4851 +45% keygen | 3257022 15781844 4845 +43% sign | 1085678 5258894 4844 +40% verify | 1172195 5678499 4844 +40% = NIST-P256 | nanosecs/iter cycles/iter auto Mhz speed-up mult | 720395 3497486 4855 +29% keygen | 4217758 20461257 4851 +26% sign | 1404350 6814131 4852 +24% verify | 1515136 7353955 4854 +28% = NIST-P384 | nanosecs/iter cycles/iter auto Mhz speed-up mult | 1525742 7400771 4851 +51% keygen | 9046660 43877889 4850 +42% sign | 2974641 14408703 4844 +40% verify | 3265285 15834951 4849 +44% = NIST-P521 | nanosecs/iter cycles/iter auto Mhz speed-up mult | 3289348 15968678 4855 +84% keygen | 19354174 93873531 4850 +70% sign | 6351493 30830140 4854 +65% verify | 6979292 33854215 4851 +75% Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
* mpi: harden set_cond functions against EM leakageJussi Kivilinna2021-04-091-8/+15
| | | | | | | | | | | * mpi/mpih-const-time.c (_gcry_mpih_set_cond): Use two masks for selecting output. * mpi/mpiutil.c (_gcry_mpi_set_cond): Use two masks for selecting output. -- GnuPG-bug-id: T5330 Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
* mpi: harden swap_cond functions against EM leakageJussi Kivilinna2021-04-091-11/+23
| | | | | | | | | | | * mpi/mpih-const-time.c (vzero, vone): New. (_gcry_mpih_swap_cond): Use two masks for selecting output. * mpi/mpiutil.c (vzero, vone): New. (_gcry_mpi_swap_cond): Use to masks for selecting output. -- GnuPG-bug-id: T5330 Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
* mpi: Consider +0 and -0 the same in mpi_cmp.Werner Koch2020-07-061-1/+1
| | | | | | * mpi/mpi-cmp.c (do_mpi_cmp): Check size of U an V. Signed-off-by: Werner Koch <wk@gnupg.org>
* mpi: Fix flags in mpi_copy for opaque MPI.NIIBE Yutaka2020-06-041-2/+3
| | | | | | * mpi/mpiutil.c (_gcry_mpi_copy): Copy flags. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* mpi: Add mpi_set_bit_cond.NIIBE Yutaka2020-04-161-0/+17
| | | | | | | | * mpi/mpiutil.c (_gcry_mpi_set_bit_cond): New. * src/mpi.h (mpi_set_bit_cond): New macro. (_gcry_mpi_set_bit_cond): New. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* api: New function gcry_mpi_get_ui.Werner Koch2017-10-171-12/+31
| | | | | | | | | | | | | | | | | | | * src/gcrypt.h.in (gcry_mpi_get_ui): New. (mpi_get_ui): New macro. * src/libgcrypt.def, src/libgcrypt.vers: Add new function. * src/visibility.c (gcry_mpi_get_ui): New. * src/visibility.h: Mark that function. (gcry_mpi_get_ui): New. * mpi/mpiutil.c (MY_UINT_MAX): New macro. (_gcry_mpi_get_ui): Re-implemented. This function existed but was never imported or used. * tests/mpitests.c (test_maxsize): Add some test for this function. -- Note that in libgcrypt.def the cardinal 91 is used which was never used in the past. Signed-off-by: Werner Koch <wk@gnupg.org>
* mpi: Fix mpi_set_secure.NIIBE Yutaka2017-07-041-1/+1
| | | | | | | | | | | | | | | | | | * mpi/mpiutil.c (mpi_set_secure): Allocate by ->alloced. -- The code was simply wrong. The question is if (1) it allocates (possibly) more or (2) modifi ->alloced. The choice is (1). Because we have routines of mpi_set_cond and mpi_swap_cond which assume no change for the allocated length of limbs, no surprise is better. See _gcry_mpi_ec_mul_point for concrete example for those routines. That's for constant-time computation. Debian-bug-id: 866964 Suggested-by: Mark Wooding <mdw@distorted.org.uk> Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Mark constant MPIs as non-leakedPeter Wu2016-03-241-0/+5
| | | | | | | | | | * mpi/mpiutil.c: Mark "constant" MPIs as explicitly leaked. -- Requires libgpg-error 1.22 (unreleased) for the macros, but since it is a minor debugging aid, do not bump the minimum required version. Signed-off-by: Peter Wu <peter@lekensteyn.nl>
* mpi: fix gcry_mpi_swap_cond.NIIBE Yutaka2015-11-251-2/+6
| | | | * mpi/mpiutil.c (_gcry_mpi_swap_cond): Relax the condition.
* mpi: Fix mpi_set_cond and mpi_swap_cond .NIIBE Yutaka2015-11-251-2/+12
| | | | | | | | | | | | | | | * mpi/mpiutil.c (_gcry_mpi_set_cond, _gcry_mpi_swap_cond): Don't use the operator of !!, but assume SET/SWAP is 0 or 1. -- If the code for !! would include a branch, it spoils the purpose of mpi_set_cond/mpi_swap_cond at all. It's better to make sure the use of this function to be called with 0 or 1 for SET/SWAP. Note that it conforms when SET/SWAP is the result of conditional expression of mpi_test_bit. Reported-by: Taylor R Campbell.
* mpi: Fix gcry_mpi_copy for NULL opaque data.Werner Koch2015-04-131-1/+2
| | | | | | | | | | * mpi/mpiutil.c (_gcry_mpi_copy): Copy opaque only if needed. -- gcry_mpi_set_opaque allows to store NULL as opaque data. Thus we also need to take care when copying such data. Signed-off-by: Werner Koch <wk@gnupg.org>
* mpi: Add mpi_set_cond.NIIBE Yutaka2015-02-121-4/+29
| | | | | | * mpi/mpiutil.c (_gcry_mpi_set_cond): New. (_gcry_mpi_swap_cond): Fix types. * src/mpi.h (mpi_set_cond): New.
* mpi: Add mpi_swap_cond.NIIBE Yutaka2014-07-161-0/+28
| | | | | | | | * mpi/mpiutil.c (_gcry_mpi_swap_cond): New. * src/mpi.h (mpi_swap_cond): New. -- This is an internal function for now.
* Comment typo fixWerner Koch2014-05-091-1/+1
| | | | --
* Remove macro hacks for internal vs. external functions. Part 2 and last.Werner Koch2013-12-121-20/+20
| | | | | | | | | | | | | | | | | | | * src/visibility.h: Remove remaining define/undef hacks for symbol visibility. Add macros to detect the use of the public functions. Change all affected functions by replacing them by the x-macros. * src/g10lib.h: Add internal prototypes. (xtrymalloc, xtrycalloc, xtrymalloc_secure, xtrycalloc_secure) (xtryrealloc, xtrystrdup, xmalloc, xcalloc, xmalloc_secure) (xcalloc_secure, xrealloc, xstrdup, xfree): New macros. -- The use of xmalloc/xtrymalloc/xfree is a more common pattern than the gcry_free etc. functions. Those functions behave like those defined by C and thus for better readability we use these macros and not the underscore prefixed functions. Signed-off-by: Werner Koch <wk@gnupg.org>
* Remove macro hacks for internal vs. external functions. Part 1.Werner Koch2013-12-051-31/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* mpi: Introduce 4 user flags for gcry_mpi_t.Werner Koch2013-12-021-2/+25
| | | | | | | | | | | | | | | * src/gcrypt.h.in (GCRYMPI_FLAG_USER1, GCRYMPI_FLAG_USER2) (GCRYMPI_FLAG_USER3, GCRYMPI_FLAG_USER4): New. * mpi/mpiutil.c (gcry_mpi_set_flag, gcry_mpi_clear_flag) (gcry_mpi_get_flag, _gcry_mpi_free): Implement them. (gcry_mpi_set_opaque): Keep user flags. -- The space for the flags in the MPI struct is free and thus we can help applications to make use of some flags. This is for example useful to indicate that an MPI needs special processing before use. Signed-off-by: Werner Koch <wk@gnupg.org>
* mpi: Fix gcry_mpi_neg.Werner Koch2013-10-011-1/+3
| | | | | | * mpi/mpiutil.c (_gcry_mpi_neg): Copy U to W. Signed-off-by: Werner Koch <wk@gnupg.org>
* mpi: Change not yet used _gcry_mpi_set_opaque_copy.Werner Koch2013-09-251-2/+5
| | | | | * mpi/mpiutil.c (_gcry_mpi_set_opaque_copy): Change prototype. (_gcry_mpi_get_opaque_copy): Take care of gcry_malloc failure.
* ecc: Add Ed25519 key generation and prepare for optimizations.Werner Koch2013-09-181-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* mpi: Add internal convenience function.Werner Koch2013-09-161-0/+16
| | | | | | * mpi/mpiutil.c (_gcry_mpi_get_opaque_copy): New. Signed-off-by: Werner Koch <wk@gnupg.org>
* mpi: Add functions to manipulate the sign.Werner Koch2013-09-071-0/+39
| | | | | | | | | | | | | | * 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.
* mpi: Clear immutable flag on the result of gcry_mpi_set.Werner Koch2013-08-081-0/+1
| | | | | | | | | | | * mpi/mpiutil.c (gcry_mpi_set): Reset immutable and const flags. * tests/mpitests.c (test_const_and_immutable): Add a test for this. -- gcry_mpi_set shall behave like gcry_mpi_copy and thus reset those special flags. Problem reported by Christian Grothoff. Signed-off-by: Werner Koch <wk@gnupg.org>
* Add GCRYMPI_FLAG_CONST and make use constants.Werner Koch2013-03-131-13/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Add GCRYMPI_FLAG_IMMUTABLE to help debugging.Werner Koch2013-03-131-5/+43
| | | | | | | | | | | | | | | | | | | | | * 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.
* mpi: Add mpi_snatch and change an internal typedef.Werner Koch2013-03-071-0/+19
| | | | | | | | | | | | | | | | | | | | | | | * 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.
* Nuked almost all trailing whitespace.post-nuke-of-trailing-wsWerner Koch2011-02-041-10/+9
| | | | Check and install the standard git pre-commit hook.
* Portability fixes.Werner Koch2009-02-161-1/+0
|
* Replace assert calls by a new gcry_assert at most places.Werner Koch2008-08-201-2/+1
|
* Reorganizatiosn to support the visibility attribute.Werner Koch2007-10-311-76/+36
| | | | | | This can be improved by using fucntion aliases instead of wrapper functions.
* ./Werner Koch2007-04-301-0/+9
| | | | | | | | | | | | | | | | | | | | | * README.apichanges: Move to doc/. * Makefile.am (EXTRA_DIST): Removed that file. doc/ * HACKING: New. Two items by Marcus. * README.apichanges: Move from .. to here. * Makefile.am (EXTRA_DIST): Add new files. mpi/ * config.links: Create a file mod-source-info.h. * Makefile.am (DISTCLEANFILES): Add that file. * mpiutil.c (_gcry_mpi_get_hw_config): New. src/ * global.c (gcry_control): New. * gcrypt.h.in (GCRYCTL_DUMP_CONFIG): New. tests/ * version.c: New. * Makefile.am (TESTS): Add version.
* Experimental support for ECDSA.Werner Koch2007-03-221-2/+21
| | | | | This is not ready but the key generation and the self-test works.
* Ported last changes from 1.2.Werner Koch2007-02-231-4/+7
| | | | | | Updated some tests. Support for passphrase generated Elgamal keys.
* A lot of cleanups as well as minor API changes.Werner Koch2007-02-211-4/+7
| | | | | Ported some changes from 1.2 to here.
* Fixed gcry_mpi_set_bit and enhanced mpi_rshift.Werner Koch2006-08-041-4/+17
| | | | | Cleaned up andom-daemon initialization.
* Collected changes - see ChangeLogsWerner Koch2006-07-261-1/+1
|
* 2005-04-27 Moritz Schulte <moritz@g10code.com>Moritz Schulte2005-04-271-4/+4
| | | | | | * mpiutil.c (gcry_mpi_randomize): Store random data in secure memory if the given MPI is secure - not the other way around (argl).
* 2005-02-16 Moritz Schulte <moritz@g10code.com>Moritz Schulte2005-02-161-10/+35
| | | | | | * mpiutil.c (_gcry_mpi_alloc_limb_space): Rewritten, fixed memory corruption.
* * hppa1.1/udiv-qrnnd.S: Alignment fix from Lamont Jones forWerner Koch2004-03-031-1/+6
| | | | | | | | | | | | | | Debian. Taken from gnupg-1.3. * longlong.h: Added PowerPC 64 bit code from GPM-4.1.2 but didn't enable it yet. Some whitespace changes in HPPA to fix assembler problems on HP-UX. From gnupg 1.3 * mpiutil.c (_gcry_mpi_alloc_limb_space): Better allocate something even if NLIMBS is passed as 0. * config.links: Updated system list to match gnupg 1.3.
* * mpi-internal.h [M_DEBUG]: Removed this unused code.Werner Koch2003-12-191-47/+56
| | | | | | | | | | | | | | | (struct karatsuba_ctx): Added TSPACE_NLIMBS and TP_NLIMBS. * mpiutil.c (_gcry_mpi_free_limb_space): Add arg NLIMBS and wipe out the memory. Changed all callers. * mpih-mul.c (_gcry_mpih_mul_karatsuba_case): Keep track of allocated limbs. * mpi-div.c (_gcry_mpi_tdiv_qr): Keep track of allocated limbs. * mpi-mul.c (gcry_mpi_mul): Ditto. * mpi-pow.c (gcry_mpi_powm): Ditto. * mpiutil.c (gcry_mpi_randomize): Use gcry_create_nonce if WEAK random has been requested.
* (gcry_mpi_randomize): Use gcry_create_nonce if WEAKV1-1-91Werner Koch2003-12-191-5/+16
| | | | | random has been requested.
* added a #warningWerner Koch2003-12-041-0/+1
|
* 2003-06-16 Moritz Schulte <moritz@g10code.com>Moritz Schulte2003-06-171-25/+25
| | | | | | | | | | | | | | | | | | * mpi-add.c: Replace last occurences of old type names with newer names (i.e. replace MPI with gcry_mpi_t). * mpi-bit.c: Likewise. * mpi-cmp.c: Likewise. * mpi-div.c: Likewise. * mpi-gcd.c: Likewise. * mpi-internal.h: Likewise. * mpi-inv.c: Likewise. * mpi-mpow.c: Likewise. * mpi-mul.c: Likewise. * mpi-pow.c: Likewise. * mpi-scan.c: Likewise. * mpicoder.c: Likewise. * mpiutil.c: Likewise.
* 2003-06-09 Moritz Schulte <moritz@g10code.com>Moritz Schulte2003-06-091-15/+15
| | | | | | | | | | | | | | | | | | | | | | * mpicoder.c (gcry_mpi_scan): Adjust for libgpg-error. (gcry_mpi_print): Likewise. (gcry_mpi_aprint): Likewise. 2003-06-07 Moritz Schulte <moritz@g10code.com> * longlong.h, mpi-add.c, mpi-bit.c, mpi-cmp.c, mpi-div.c, mpi-gcd.c, mpi-inline.c, mpi-inline.h, mpi-internal.h, mpi-inv.c, mpi-mpow.c, mpi-mul.c, mpi-pow.c, mpi-scan.c, mpicoder.c, mpih-div.c, mpih-mul.c, mpiutil.c, generic/mpi-asm-defs.h, generic/mpih-add1.c, generic/mpih-lshift.c, generic/mpih-mul1.c, generic/mpih-mul2.c, generic/mpih-mul3.c, generic/mpih-rshift.c, generic/mpih-sub1.c, generic/udiv-w-sdiv.c, i386/syntax.h, m68k/syntax.h, mips3/mpi-asm-defs.h, powerpc32/syntax.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.
* 2003-05-21 Moritz Schulte <moritz@g10code.com>Moritz Schulte2003-05-221-2/+3
| | | | | | * mpiutil.c (_gcry_mpi_alloc_limb_space): Only try to allocate memory in case the amount of bytes to allocate is non-zero.
* 2003-04-27 Moritz Schulte <moritz@g10code.com>Moritz Schulte2003-04-271-14/+17
| | | | | | | | | * mpiutil.c (_gcry_mpi_resize): Allocate secure memory, in case bit zero of `flags' is set. * mpi-add.c (gcry_mpi_sub): Simplify function; always use a temporary variable now.
* * mpiutil.c (gcry_mpi_swap): New.V1-1-8Werner Koch2002-06-251-0/+6
| | | | | | | | | * mpi-div.c (gcry_mpi_div): New. (gcry_mpi_mod): New. * mpi-inv.c (gcry_mpi_invm): New. * mpicoder.c (do_get_buffer): Make sure that we allocate at least one byte.