ecc: Add an API for X25519 function as gcry_ecc_mul_point.
authorNIIBE Yutaka <gniibe@fsij.org>
Thu, 20 Jun 2019 00:58:01 +0000 (09:58 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Thu, 20 Jun 2019 00:58:01 +0000 (09:58 +0900)
commitec8c2cdf977aa8d9ca5af0a9bd25aeb9190570b3
tree6d023343f8aa7e8a9154252d3e6d266ff0a7b7d7
parent971d372f512ff6805d5b8b54e9ac1446f3f66643
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>
14 files changed:
cipher/Makefile.am
cipher/ecc-common.h
cipher/ecc-curves.c
cipher/ecc-ecdh.c [new file with mode: 0644]
cipher/ecc-eddsa.c
cipher/ecc-misc.c
configure.ac
src/gcrypt-int.h
src/gcrypt.h.in
src/libgcrypt.def
src/libgcrypt.vers
src/visibility.c
src/visibility.h
tests/t-cv25519.c