summaryrefslogtreecommitdiff
path: root/cipher/pubkey-util.c
diff options
context:
space:
mode:
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>2013-10-15 23:56:44 +0400
committerWerner Koch <wk@gnupg.org>2013-10-16 16:31:07 +0200
commit83902f1f1dbc8263a0c3f61be59cd2eb95293c97 (patch)
tree44104dabba10787887e717ddf86d98a83a9dda02 /cipher/pubkey-util.c
parent187b2bb541b985255aee262d181434a7cb4ae2e7 (diff)
downloadlibgcrypt-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 'cipher/pubkey-util.c')
-rw-r--r--cipher/pubkey-util.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/cipher/pubkey-util.c b/cipher/pubkey-util.c
index 0b90054f..0db5840b 100644
--- a/cipher/pubkey-util.c
+++ b/cipher/pubkey-util.c
@@ -79,6 +79,11 @@ _gcry_pk_util_parse_flaglist (gcry_sexp_t list,
{
flags |= PUBKEY_FLAG_ECDSA;
}
+ else if (n == 4 && !memcmp (s, "gost", 4))
+ {
+ encoding = PUBKEY_ENC_RAW;
+ flags |= PUBKEY_FLAG_GOST;
+ }
else if (n == 3 && !memcmp (s, "raw", 3)
&& encoding == PUBKEY_ENC_UNKNOWN)
{
@@ -347,6 +352,8 @@ _gcry_pk_util_preparse_sigval (gcry_sexp_t s_sig, const char **algo_names,
{
if (!strcmp (name, "eddsa"))
*r_eccflags = PUBKEY_FLAG_EDDSA;
+ if (!strcmp (name, "gost"))
+ *r_eccflags = PUBKEY_FLAG_GOST;
}
*r_parms = l2;