From 1cfa79aabc5d0fd8d124901054475e90ab7d9cde Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 26 Jul 2013 20:15:53 +0200 Subject: Implement deterministic DSA as specified by rfc-6979. * cipher/dsa.c (dsa_sign): Move opaque mpi extraction to sign. (sign): Add args FLAGS and HASHALGO. Implement deterministic DSA. Add code path for R==0 to comply with the standard. (dsa_verify): Left fill opaque mpi based hash values. * cipher/dsa-common.c (int2octets, bits2octets): New. (_gcry_dsa_gen_rfc6979_k): New. * tests/dsa-rfc6979.c: New. * tests/Makefile.am (TESTS): Add dsa-rfc6979. -- This patch also fixes a recent patch (37d0a1e) which allows to pass the hash in a (hash) element. Support for deterministic ECDSA will come soon. Signed-off-by: Werner Koch --- cipher/pubkey-internal.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'cipher/pubkey-internal.h') diff --git a/cipher/pubkey-internal.h b/cipher/pubkey-internal.h index ae7e77b0..9147cb2d 100644 --- a/cipher/pubkey-internal.h +++ b/cipher/pubkey-internal.h @@ -22,6 +22,12 @@ /*-- dsa-common.h --*/ gcry_mpi_t _gcry_dsa_gen_k (gcry_mpi_t q, int security_level); +gpg_err_code_t _gcry_dsa_gen_rfc6979_k (gcry_mpi_t *r_k, + gcry_mpi_t dsa_q, gcry_mpi_t dsa_x, + const unsigned char *h1, + unsigned int h1len, + int halgo, + unsigned int extraloops); /*-- ecc.c --*/ -- cgit v1.2.1