diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2019-06-20 09:58:01 +0900 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2019-06-20 09:58:01 +0900 |
commit | ec8c2cdf977aa8d9ca5af0a9bd25aeb9190570b3 (patch) | |
tree | 6d023343f8aa7e8a9154252d3e6d266ff0a7b7d7 /src/gcrypt.h.in | |
parent | 971d372f512ff6805d5b8b54e9ac1446f3f66643 (diff) | |
download | libgcrypt-ec8c2cdf977aa8d9ca5af0a9bd25aeb9190570b3.tar.gz |
ecc: Add an API for X25519 function as gcry_ecc_mul_point.
* configure.ac: Add ecc-ecdh.lo.
* cipher/Makefile.am: Add ecc-ecdh.c.
* cipher/ecc-common.h (reverse_buffer): Expose.
* cipher/ecc-eddsa.c (reverse_buffer): Expose.
* cipher/ecc-curves.c (domain_parms): Fix as the errata of RFC.
* cipher/ecc-ecdh.c: New.
* cipher/ecc-misc.c (_gcry_ecc_mont_decodepoint): Fix for other curves
than Curve25519.
* src/gcrypt-int.h (_gcry_ecc_mul_point): New.
* src/gcrypt.h.in (enum gcry_ecc_curves): New.
(gcry_ecc_mul_point): new.
* src/libgcrypt.def (gcry_ecc_mul_point): New.
* src/libgcrypt.vers (gcry_ecc_mul_point): New.
* src/visibility.h (gcry_ecc_mul_point): New.
* src/visibility.c (gcry_ecc_mul_point): New.
* tests/t-cv25519.c (test_cv_hl): Rename from test_cv.
(test_cv_x25519): New.
(test_cv): Call both of test_cv_hl and test_cv_x25519.
--
Add new API gcry_ecc_mul_point for direct use of X25519 function.
"Direct use" means, its inputs and output are binary octet in native
format, while no lengths check inside. It's a responsibility of
caller.
We can use gcry_pk_encrypt for implementing X25519, but the API of
gcry_pk_encrypt uses SEXP format, which is a bit cumbersome.
GnuPG-bug-id: 4293
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'src/gcrypt.h.in')
-rw-r--r-- | src/gcrypt.h.in | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gcrypt.h.in b/src/gcrypt.h.in index 8346ce15..ed964a27 100644 --- a/src/gcrypt.h.in +++ b/src/gcrypt.h.in @@ -1197,6 +1197,25 @@ gcry_sexp_t gcry_pk_get_param (int algo, const char *name); /* Return an S-expression representing the context CTX. */ gcry_error_t gcry_pubkey_get_sexp (gcry_sexp_t *r_sexp, int mode, gcry_ctx_t ctx); + +/************************************ + * * + * Modern ECC Functions * + * * + ************************************/ + +/* The curves we support. */ +enum gcry_ecc_curves + { + GCRY_ECC_CURVE25519 = 1, + GCRY_ECC_CURVE448 = 2 + }; + +/* Convenience function to compute scalar multiplication of the + Montgomery form of curve. */ +gpg_error_t gcry_ecc_mul_point (int algo, unsigned char **r_result, + const unsigned char *scalar, + const unsigned char *point); |