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/basic.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/basic.c')
-rw-r--r-- | tests/basic.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/tests/basic.c b/tests/basic.c index 991309a4..1d6e637c 100644 --- a/tests/basic.c +++ b/tests/basic.c @@ -3439,6 +3439,30 @@ check_pubkey_sign_ecdsa (int n, gcry_sexp_t skey, gcry_sexp_t pkey) /* */ "000102030405060708090A0B0C0D0E0F#))", 0 }, + { 256, + "(data (flags gost)\n" + " (value #00112233445566778899AABBCCDDEEFF" + /* */ "000102030405060708090A0B0C0D0E0F#))", + 0, + "(data (flags gost)\n" + " (value #80112233445566778899AABBCCDDEEFF" + /* */ "000102030405060708090A0B0C0D0E0F#))", + 0 + }, + { 512, + "(data (flags gost)\n" + " (value #00112233445566778899AABBCCDDEEFF" + /* */ "000102030405060708090A0B0C0D0E0F" + /* */ "000102030405060708090A0B0C0D0E0F" + /* */ "000102030405060708090A0B0C0D0E0F#))", + 0, + "(data (flags gost)\n" + " (value #80112233445566778899AABBCCDDEEFF" + /* */ "000102030405060708090A0B0C0D0E0F" + /* */ "000102030405060708090A0B0C0D0E0F" + /* */ "000102030405060708090A0B0C0D0E0F#))", + 0 + }, { 0, NULL } }; @@ -4021,6 +4045,57 @@ check_pubkey (void) "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" } + }, + { /* GOST R 34.10-2001/2012 test 256 bit. */ + GCRY_PK_ECDSA, FLAG_SIGN, + { + "(private-key\n" + " (ecc\n" + " (curve GOST2001-test)\n" + " (q #047F2B49E270DB6D90D8595BEC458B50C58585BA1D4E9B78" + " 8F6689DBD8E56FD80B26F1B489D6701DD185C8413A977B3C" + " BBAF64D1C593D26627DFFB101A87FF77DA#)\n" + " (d #7A929ADE789BB9BE10ED359DD39A72C11B60961F49397EEE" + " 1D19CE9891EC3B28#)))\n", + + "(public-key\n" + " (ecc\n" + " (curve GOST2001-test)\n" + " (q #047F2B49E270DB6D90D8595BEC458B50C58585BA1D4E9B78" + " 8F6689DBD8E56FD80B26F1B489D6701DD185C8413A977B3C" + " BBAF64D1C593D26627DFFB101A87FF77DA#)))\n", + + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" } + }, + { /* GOST R 34.10-2012 test 512 bit. */ + GCRY_PK_ECDSA, FLAG_SIGN, + { + "(private-key\n" + " (ecc\n" + " (curve GOST2012-test)\n" + " (q #04115DC5BC96760C7B48598D8AB9E740D4C4A85A65BE33C1" + " 815B5C320C854621DD5A515856D13314AF69BC5B924C8B" + " 4DDFF75C45415C1D9DD9DD33612CD530EFE137C7C90CD4" + " 0B0F5621DC3AC1B751CFA0E2634FA0503B3D52639F5D7F" + " B72AFD61EA199441D943FFE7F0C70A2759A3CDB84C114E" + " 1F9339FDF27F35ECA93677BEEC#)\n" + " (d #0BA6048AADAE241BA40936D47756D7C93091A0E851466970" + " 0EE7508E508B102072E8123B2200A0563322DAD2827E2714" + " A2636B7BFD18AADFC62967821FA18DD4#)))\n", + + "(public-key\n" + " (ecc\n" + " (curve GOST2001-test)\n" + " (q #04115DC5BC96760C7B48598D8AB9E740D4C4A85A65BE33C1" + " 815B5C320C854621DD5A515856D13314AF69BC5B924C8B" + " 4DDFF75C45415C1D9DD9DD33612CD530EFE137C7C90CD4" + " 0B0F5621DC3AC1B751CFA0E2634FA0503B3D52639F5D7F" + " B72AFD61EA199441D943FFE7F0C70A2759A3CDB84C114E" + " 1F9339FDF27F35ECA93677BEEC#)))\n" + + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" } } }; int i; |