From c3db7705c049e31e678ff87e230b8160aa0027f1 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 21 Jan 2011 15:58:07 +0100 Subject: Truncate the DSA hash; fixes regression. Removed left over debug code. --- g10/seskey.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'g10/seskey.c') diff --git a/g10/seskey.c b/g10/seskey.c index fa6765dc6..2d7918d39 100644 --- a/g10/seskey.c +++ b/g10/seskey.c @@ -319,11 +319,13 @@ encode_md_value (PKT_public_key *pk, gcry_md_hd_t md, int hash_algo) return NULL; } - /* Note that in case of ECDSA 521 hash is always smaller than - the key size. */ + /* By passing QBYTES as length to mpi_scan, we do the truncation + of the hash. + + Note that in case of ECDSA 521 the hash is always smaller + than the key size. */ if (gcry_mpi_scan (&frame, GCRYMPI_FMT_USG, - gcry_md_read (md, hash_algo), - gcry_md_get_algo_dlen (hash_algo), &qbytes)) + gcry_md_read (md, hash_algo), qbytes, &qbytes)) BUG(); } else -- cgit v1.2.3