summaryrefslogtreecommitdiff
path: root/src/visibility.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-10-28md: add variable length output interfaceJussi Kivilinna1-0/+2
* cipher/crc.c (_gcry_digest_spec_crc32) (_gcry_digest_spec_crc32_rfc1510, _gcry_digest_spec_crc24_rfc2440): Set 'extract' NULL. * cipher/gostr3411-94.c (_gcry_digest_spec_gost3411_94) (_gcry_digest_spec_gost3411_cp): Ditto. * cipher/keccak.c (_gcry_digest_spec_sha3_224) (_gcry_digest_spec_sha3_256, _gcry_digest_spec_sha3_384) (_gcry_digest_spec_sha3_512): Ditto. * cipher/md2.c (_gcry_digest_spec_md2): Ditto. * cipher/md4.c (_gcry_digest_spec_md4): Ditto. * cipher/md5.c (_gcry_digest_spec_md5): Ditto. * cipher/rmd160.c (_gcry_digest_spec_rmd160): Ditto. * cipher/sha1.c (_gcry_digest_spec_sha1): Ditto. * cipher/sha256.c (_gcry_digest_spec_sha224) (_gcry_digest_spec_sha256): Ditto. * cipher/sha512.c (_gcry_digest_spec_sha384) (_gcry_digest_spec_sha512): Ditto. * cipher/stribog.c (_gcry_digest_spec_stribog_256) (_gcry_digest_spec_stribog_512): Ditto. * cipher/tiger.c (_gcry_digest_spec_tiger) (_gcry_digest_spec_tiger1, _gcry_digest_spec_tiger2): Ditto. * cipher/whirlpool.c (_gcry_digest_spec_whirlpool): Ditto. * cipher/md.c (md_enable): Do not allow combination of HMAC and 'expandable-output function'. (md_final): Check if spec->read is NULL before calling. (md_read): Ditto. (md_extract, _gcry_md_extract): New. * doc/gcrypt.texi: Add SHA3 algorithms and gcry_md_extract. * src/cipher-proto.h (gcry_md_extract_t): New. (gcry_md_spec_t): Add 'extract'. * src/gcrypt-int.g (_gcry_md_extract): New. * src/gcrypt.h.in (gcry_md_extract): New. * src/libgcrypt.def: Add gcry_md_extract. * src/libgcrypt.vers: Add gcry_md_extract. * src/visibility.c (gcry_md_extract): New. * src/visibility.h (gcry_md_extract): New. -- Patch adds new interface for reading output from 'expandable-output function' MD algorithms that can give variable length output (ie. SHAKE algorithms from FIPS-202). New function to read output is gpg_error_t gcry_md_extract(gcry_md_hd_t md, int algo, void *buffer, size_t length); Function implicitly finalizes algorithm so that no new input can be given. Subsequents calls of the function return more output bytes from the algorithm. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
2014-10-08mpi: Add gcry_mpi_ec_sub.Markus Teich1-0/+2
* 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-01-13Add a function to retrieve algorithm used by MAC handlerDmitry Eremin-Solenikov1-0/+2
* cipher/mac.c (_gcry_mac_get_algo): New function, returns used algo. * src/visibility.c (gcry_mac_get_algo): New wrapper. * src/visibility.h: Hanlde gcry_mac_get_algo. * src/gcrypt-int.h (_gcry_mac_get_algo): New. * src/gcrypt.h.in (gcry_mac_get_algo): New. * src/libgcrypt.def (gcry_mac_get_algo): New. * src/libgcrypt.vers (gcry_mac_get_algo): New. * doc/gcrypt.texi: Document gcry_mac_get_algo. * tests/basic.c (check_one_mac): Verify gcry_mac_get_algo. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
2013-12-12Remove macro hacks for internal vs. external functions. Part 2 and last.Werner Koch1-60/+31
* 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>
2013-12-05Remove macro hacks for internal vs. external functions. Part 1.Werner Koch1-548/+397
* 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-16Add new MAC API, initially with HMACJussi Kivilinna1-0/+42
* cipher/Makefile.am: Add 'mac.c', 'mac-internal.h' and 'mac-hmac.c'. * cipher/bufhelp.h (buf_eq_const): New. * cipher/cipher-ccm.c (_gcry_cipher_ccm_tag): Use 'buf_eq_const' for constant-time compare. * cipher/mac-hmac.c: New. * cipher/mac-internal.h: New. * cipher/mac.c: New. * doc/gcrypt.texi: Add documentation for MAC API. * src/gcrypt-int.h [GPG_ERROR_VERSION_NUMBER < 1.13] (GPG_ERR_MAC_ALGO): New. * src/gcrypt.h.in (gcry_mac_handle, gcry_mac_hd_t, gcry_mac_algos) (gcry_mac_flags, gcry_mac_open, gcry_mac_close, gcry_mac_ctl) (gcry_mac_algo_info, gcry_mac_setkey, gcry_mac_setiv, gcry_mac_write) (gcry_mac_read, gcry_mac_verify, gcry_mac_get_algo_maclen) (gcry_mac_get_algo_keylen, gcry_mac_algo_name, gcry_mac_map_name) (gcry_mac_reset, gcry_mac_test_algo): New. * src/libgcrypt.def (gcry_mac_open, gcry_mac_close, gcry_mac_ctl) (gcry_mac_algo_info, gcry_mac_setkey, gcry_mac_setiv, gcry_mac_write) (gcry_mac_read, gcry_mac_verify, gcry_mac_get_algo_maclen) (gcry_mac_get_algo_keylen, gcry_mac_algo_name, gcry_mac_map_name): New. * src/libgcrypt.vers (gcry_mac_open, gcry_mac_close, gcry_mac_ctl) (gcry_mac_algo_info, gcry_mac_setkey, gcry_mac_setiv, gcry_mac_write) (gcry_mac_read, gcry_mac_verify, gcry_mac_get_algo_maclen) (gcry_mac_get_algo_keylen, gcry_mac_algo_name, gcry_mac_map_name): New. * src/visibility.c (gcry_mac_open, gcry_mac_close, gcry_mac_ctl) (gcry_mac_algo_info, gcry_mac_setkey, gcry_mac_setiv, gcry_mac_write) (gcry_mac_read, gcry_mac_verify, gcry_mac_get_algo_maclen) (gcry_mac_get_algo_keylen, gcry_mac_algo_name, gcry_mac_map_name): New. * src/visibility.h (gcry_mac_open, gcry_mac_close, gcry_mac_ctl) (gcry_mac_algo_info, gcry_mac_setkey, gcry_mac_setiv, gcry_mac_write) (gcry_mac_read, gcry_mac_verify, gcry_mac_get_algo_maclen) (gcry_mac_get_algo_keylen, gcry_mac_algo_name, gcry_mac_map_name): New. * tests/basic.c (check_one_mac, check_mac): New. (main): Call 'check_mac'. * tests/bench-slope.c (bench_print_header, bench_print_footer): Allow variable algorithm name width. (_cipher_bench, hash_bench): Update to above change. (bench_hash_do_bench): Add 'gcry_md_reset'. (bench_mac_mode, bench_mac_init, bench_mac_free, bench_mac_do_bench) (mac_ops, mac_modes, mac_bench_one, _mac_bench, mac_bench): New. (main): Add 'mac' benchmark options. * tests/benchmark.c (mac_repetitions, mac_bench): New. (main): Add 'mac' benchmark options. -- Add MAC API, with HMAC algorithms. Internally uses HMAC functionality of the MD module. [v2]: - Add documentation for MAC API. - Change length argument for gcry_mac_read from size_t to size_t* for returning number of written bytes. [v3]: - HMAC algorithm ids start from 101. - Fix coding style for new files. Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
2013-11-05mpi: Add function gcry_mpi_set_opaque_copy.Werner Koch1-2/+3
* src/gcrypt.h.in (gcry_mpi_set_opaque_copy): New. * src/visibility.c (gcry_mpi_set_opaque_copy): New. * src/visibility.h (gcry_mpi_set_opaque_copy): Mark visible. * src/libgcrypt.def, src/libgcrypt.vers: Add new API. * tests/mpitests.c (test_opaque): Add test. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-10-22Add API to support AEAD cipher modesJussi Kivilinna1-0/+9
* cipher/cipher.c (_gcry_cipher_authenticate, _gcry_cipher_checktag) (_gcry_cipher_gettag): New. * doc/gcrypt.texi: Add documentation for new API functions. * src/visibility.c (gcry_cipher_authenticate, gcry_cipher_checktag) (gcry_cipher_gettag): New. * src/gcrypt.h.in, src/visibility.h: add declarations of these functions. * src/libgcrypt.defs, src/libgcrypt.vers: export functions. -- Authenticated Encryption with Associated Data (AEAD) cipher modes provide authentication tag that can be used to authenticate message. At the same time it allows one to specify additional (unencrypted data) that will be authenticated together with the message. This class of cipher modes requires additional API present in this commit. This patch is based on original patch by Dmitry Eremin-Solenikov. Changes in v2: - Change gcry_cipher_tag to gcry_cipher_checktag and gcry_cipher_gettag for giving tag (checktag) for decryption and reading tag (gettag) after encryption. - Change gcry_cipher_authenticate to gcry_cipher_setaad, since additional parameters needed for some AEAD modes (in this case CCM, which needs the length of encrypted data and tag for MAC initialization). - Add some documentation. Changes in v3: - Change gcry_cipher_setaad back to gcry_cipher_authenticate. Additional parameters (encrypt_len, tag_len, aad_len) for CCM will be given through GCRY_CTL_SET_CCM_LENGTHS. Changes in v4: - log_fatal => log_error Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
2013-10-16sexp: Add function gcry_sexp_extract_param.Werner Koch1-1/+12
* src/gcrypt.h.in (_GCRY_GCC_ATTR_SENTINEL): New. (gcry_sexp_extract_param): New. * src/visibility.c (gcry_sexp_extract_param): New. * src/visibility.h (gcry_sexp_extract_param): Add hack to detect internal use. * cipher/pubkey-util.c (_gcry_pk_util_extract_mpis): Move and split into ... * src/sexp.c (_gcry_sexp_vextract_param) (_gcry_sexp_extract_param): this. Change all callers. Add support for buffer descriptors and a path option/ * tests/tsexp.c (die, hex2buffer, hex2mpi, hex2mpiopa): New. (cmp_mpihex, cmp_bufhex): New. (check_extract_param): New. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-10-02Remove last remains of the former module system.Werner Koch1-1/+0
* src/gcrypt-module.h, src/module.c: Remove. * src/visibility.h: Do not include gcrypt-module.h. * src/g10lib.h: Remove all prototypes from module.c (gcry_module): Remove. * cipher/cipher-internal.h (gcry_cipher_handle): Remove unused field. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-09-30Add logging functions to the API.Werner Koch1-0/+6
* src/gcrypt.h.in (_GCRY_GCC_ATTR_PRINTF): New. (gcry_log_debug, gcry_log_debughex, gcry_log_debugmpi): New. (gcry_log_debugpnt, gcry_log_debugsxp): New. * src/visibility.c (gcry_log_debug): New. (gcry_log_debughex, gcry_log_debugmpi, gcry_log_debugpnt): New. (gcry_log_debugsxp): New. * src/libgcrypt.def, src/libgcrypt.vers: Add new functions. * src/misc.c (_gcry_logv): Make public. (_gcry_log_printsxp): New. * src/g10lib.h (log_printsxp): New macro. -- For debugging applications it is often required to dump certain data structures. Libgcrypt uses several internal functions for this. To avoid re-implementing everything in the caller, we now provide access to some of those functions. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-09-10md: Add function gcry_md_hash_buffers.Werner Koch1-0/+3
* src/gcrypt.h.in (gcry_buffer_t): new. (gcry_md_hash_buffers): New. * src/visibility.c, src/visibility.h: Add wrapper for new function. * src/libgcrypt.def, src/libgcrypt.vers: Export new function. * cipher/md.c (gcry_md_hash_buffers): New. * cipher/sha1.c (_gcry_sha1_hash_buffers): New. * tests/basic.c (check_one_md_multi): New. (check_digests): Run that test. * tests/hmac.c (check_hmac_multi): New. (main): Run that test. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-09-07mpi: Add gcry_mpi_ec_curve_point.Werner Koch1-0/+1
* mpi/ec.c (_gcry_mpi_ec_curve_point): New. (ec_powm): Return the absolute value. * src/visibility.c, src/visibility.c: Add wrappers. * src/libgcrypt.def, src/libgcrypt.vers: Export them.
2013-09-07mpi: Add functions to manipulate the sign.Werner Koch1-0/+3
* 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-07-19sexp: Add function gcry_sexp_nth_buffer.Werner Koch1-3/+6
* src/sexp.c (gcry_sexp_nth_buffer): New. * src/visibility.c, src/visibility.h: Add function wrapper. * src/libgcrypt.vers, src/libgcrypt.def: Add to API. * src/gcrypt.h.in: Add prototype. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-06-26Make gpg-error replacement defines more robust.Werner Koch1-2/+2
* configure.ac (AH_BOTTOM): Move GPG_ERR_ replacement defines to ... * src/gcrypt-int.h: new file. * src/visibility.h, src/cipher.h: Replace gcrypt.h by gcrypt-int.h. * tests/: Ditto for all test files. -- Defining newer gpg-error codes in config.h was not a good idea, because config.h is usually included before gpg-error.h and thus gpg-error.h would be double defines to lead to faulty code there like typedef enum { [...] 191 = 191, [...] };
2013-04-15Add macros to return pre-defined MPIs.Werner Koch1-0/+4
* src/gcrypt.h.in (GCRYMPI_CONST_ONE, GCRYMPI_CONST_TWO) (GCRYMPI_CONST_THREE, GCRYMPI_CONST_FOUR, GCRYMPI_CONST_EIGHT): New. (_gcry_mpi_get_const): New private function. * src/visibility.c (_gcry_mpi_get_const): New. * src/visibility.h: Mark it visible. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-04-11Add gcry_pubkey_get_sexp.Werner Koch1-0/+1
* src/gcrypt.h.in (GCRY_PK_GET_PUBKEY): New. (GCRY_PK_GET_SECKEY): New. (gcry_pubkey_get_sexp): New. * src/visibility.c (gcry_pubkey_get_sexp): New. * src/visibility.h (gcry_pubkey_get_sexp): Mark visible. * src/libgcrypt.def, src/libgcrypt.vers: Add new function. * cipher/pubkey-internal.h: New. * cipher/Makefile.am (libcipher_la_SOURCES): Add new file. * cipher/ecc.c: Include pubkey-internal.h (_gcry_pk_ecc_get_sexp): New. * cipher/pubkey.c: Include pubkey-internal.h and context.h. (_gcry_pubkey_get_sexp): New. * src/context.c (_gcry_ctx_find_pointer): New. * src/cipher-proto.h: Add _gcry_pubkey_get_sexp. * tests/t-mpi-point.c (print_sexp): New. (context_param, basic_ec_math_simplified): Add tests for the new function. * configure.ac (NEED_GPG_ERROR_VERSION): Set to 1.11. (AH_BOTTOM) Add error codes from gpg-error 1.12 * src/g10lib.h (fips_not_operational): Use GPG_ERR_NOT_OPERATIONAL. * mpi/ec.c (_gcry_mpi_ec_get_mpi): Fix computation of Q. (_gcry_mpi_ec_get_point): Ditto. -- While checking the new code I figured that the auto-computation of Q must have led to a segv. It seems we had no test case for that. Signed-off-by: Werner Koch <wk@gnupg.org>
2013-03-15mpi: Add functions to manipulate an EC context.Werner Koch1-3/+5
* 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-08mpi: Add an API for EC math.Werner Koch1-0/+12
* 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-08mpi: Add an API for EC point operations.Werner Koch1-1/+19
* mpi/ec.c (gcry_mpi_point_new, gcry_mpi_point_release): New. (gcry_mpi_point_get, gcry_mpi_point_snatch_get): New. (gcry_mpi_point_set, gcry_mpi_point_snatch_set): New. * src/visibility.h, src/visibility.c: Add corresponding macros and wrappers. * src/gcrypt.h.in (struct gcry_mpi_point, gcry_mpi_point_t): New. (gcry_mpi_point_new, gcry_mpi_point_release, gcry_mpi_point_get) (gcry_mpi_point_snatch_get, gcry_mpi_point_set) (gcry_mpi_point_snatch_set): New prototypes. (mpi_point_new, mpi_point_release, mpi_point_get, mpi_point_snatch_get) (mpi_point_set, mpi_point_snatch_set): New macros. * src/libgcrypt.vers (gcry_mpi_point_new, gcry_mpi_point_release) (gcry_mpi_point_get, gcry_mpi_point_snatch_get, gcry_mpi_point_set) (gcry_mpi_point_snatch_set): New symbols. * src/libgcrypt.def: Ditto. * tests/t-mpi-point.c: New. * tests/Makefile.am (TESTS): Add t-mpi-point
2013-03-07mpi: Add mpi_snatch and change an internal typedef.Werner Koch1-0/+3
* 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-09-15Removed the module registration interfaceWerner Koch1-27/+1
The module registration interface is not widely used but complicates the internal operation of Libgcrypt a lot. It also does not allow for efficient implementation of new algorithm or cipher modes. Further the required locking of all access to internal module data or functions would make it hard to come up with a deadlock free pthread_atfork implementation. Thus we remove the entire subsystem. Note that the module system is still used internally but it is now possible to change it without breaking the ABI. In case a feature to add more algorithms demanded in the future, we may add one by dlopening modules at startup time from a dedicated directory.
2011-09-15Removed the AC interface (gcry_ac_*)Werner Koch1-217/+1
This interface has long been deprecated. It was also initially only declared as an experimental interface. It added its own kind of complexity and we found that it does not make applications easier to read. Modern features of Libgcrypt were not supported and its removal reduces the SLOC which is a Good Thing from a security POV.
2011-03-09New function gcry_kdf_deriveWerner Koch1-0/+6
This allows us to factor the S2k code from gpg and gpg-agent out to libgcrypt. Created a bunch of test vectors using a hacked gpg 1.4. The function also implements PBKDF2; tested against the RFC-6070 test vectors.
2011-02-17Flag the _ac_ functions as deprecated.Werner Koch1-0/+91
The AC functions are deprecated for a long time. How we will even print a warning if they are used. The module register interface is now also deprecated and the use of those functions will yield a warning as well.
2011-02-04Nuked almost all trailing whitespace.Werner Koch1-196/+196
Check and install the standard git pre-commit hook.
2011-02-01Add function gcry_pk_get_param.Werner Koch1-0/+3
Also changed quite some trailing white spaces. I never configured that in Emacs but git diff annoys me with red lines and thus it seems better to use nuke-trailing-whitespace autmatically. Sorry for the extra diff lines. A diff filter should help to not show those changes.
2011-02-01Add gcry_pk_get_curve.Werner Koch1-0/+3
2008-08-19Adding gcry_mpi_lshift.Werner Koch1-0/+3
Preparing a release candidate.
2008-08-19A whole bunch of changes to eventually support Werner Koch1-37/+28
FIPS restricted mode. Also some documentation improvements and other minor enhancements. See the ChangeLogs. Stay tuned.
2007-10-31Reorganizatiosn to support the visibility attribute.Werner Koch1-0/+710
This can be improved by using fucntion aliases instead of wrapper functions.