diff options
author | Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> | 2013-10-15 23:56:44 +0400 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2013-10-16 16:31:07 +0200 |
commit | 83902f1f1dbc8263a0c3f61be59cd2eb95293c97 (patch) | |
tree | 44104dabba10787887e717ddf86d98a83a9dda02 /tests/benchmark.c | |
parent | 187b2bb541b985255aee262d181434a7cb4ae2e7 (diff) | |
download | libgcrypt-83902f1f1dbc8263a0c3f61be59cd2eb95293c97.tar.gz |
ecc: Add support for GOST R 34.10-2001/-2012 signatures
* src/cipher.h: define PUBKEY_FLAG_GOST
* cipher/ecc-curves.c: Add GOST2001-test and GOST2012-test curves
defined in standards. Typical applications would use either those
curves, or curves defined in RFC 4357 (will be added later).
* cipher/ecc.c (sign_gost, verify_gost): New.
(ecc_sign, ecc_verify): use sign_gost/verify_gost if PUBKEY_FLAG_GOST
is set.
(ecc_names): add "gost" for gost signatures.
* cipher/pubkey-util.c (_gcry_pk_util_parse_flaglist,
_gcry_pk_util_preparse_sigval): set PUBKEY_FLAG_GOST if gost flag
is present in s-exp.
* tests/benchmark.c (ecc_bench): also benchmark GOST signatures.
* tests/basic.c (check_pubkey): add two public keys from
GOST R 34.10-2012 standard.
(check_pubkey_sign_ecdsa): add two data sets to check gost signatures.
* tests/curves.c: correct N_CURVES as we now have 2 more curves.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Removed some comments from the new curve definitions in ecc-curves.c
to avoid line wrapping. Eventually we will develop a precompiler to
avoid parsing those hex strings. -wk
Diffstat (limited to 'tests/benchmark.c')
-rw-r--r-- | tests/benchmark.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/benchmark.c b/tests/benchmark.c index 5d1434ac..ecda0d3c 100644 --- a/tests/benchmark.c +++ b/tests/benchmark.c @@ -883,7 +883,8 @@ ecc_bench (int iterations, int print_header) { #if USE_ECC gpg_error_t err; - const char *p_sizes[] = { "192", "224", "256", "384", "521", "Ed25519" }; + const char *p_sizes[] = { "192", "224", "256", "384", "521", "Ed25519", + "gost256", "gost512" }; int testno; if (print_header) @@ -899,14 +900,22 @@ ecc_bench (int iterations, int print_header) int count; int p_size; int is_ed25519; + int is_gost; is_ed25519 = !strcmp (p_sizes[testno], "Ed25519"); + is_gost = !strncmp (p_sizes[testno], "gost", 4); if (is_ed25519) { p_size = 256; printf ("EdDSA Ed25519 "); fflush (stdout); } + else if (is_gost) + { + p_size = atoi (p_sizes[testno] + 4); + printf ("GOST %3d bit ", p_size); + fflush (stdout); + } else { p_size = atoi (p_sizes[testno]); @@ -917,6 +926,10 @@ ecc_bench (int iterations, int print_header) if (is_ed25519) err = gcry_sexp_build (&key_spec, NULL, "(genkey (ecdsa (curve \"Ed25519\")))"); + else if (is_gost) + err = gcry_sexp_build (&key_spec, NULL, + "(genkey (ecdsa (curve %s)))", + p_size == 256 ? "GOST2001-test" : "GOST2012-test"); else err = gcry_sexp_build (&key_spec, NULL, "(genkey (ECDSA (nbits %d)))", p_size); @@ -950,6 +963,8 @@ ecc_bench (int iterations, int print_header) err = gcry_sexp_build (&data, NULL, "(data (flags eddsa)(hash-algo sha512)" " (value %m))", x); + else if (is_gost) + err = gcry_sexp_build (&data, NULL, "(data (flags gost) (value %m))", x); else err = gcry_sexp_build (&data, NULL, "(data (flags raw) (value %m))", x); gcry_mpi_release (x); |