[svn] gcry - r1377 - trunk/tests
svn author wk
cvs at cvs.gnupg.org
Wed Jan 21 19:05:24 CET 2009
Author: wk
Date: 2009-01-21 19:05:24 +0100 (Wed, 21 Jan 2009)
New Revision: 1377
Modified:
trunk/tests/ChangeLog
trunk/tests/fipsdrv.c
Log:
Fix last change.
Modified: trunk/tests/ChangeLog
===================================================================
--- trunk/tests/ChangeLog 2009-01-21 17:46:55 UTC (rev 1376)
+++ trunk/tests/ChangeLog 2009-01-21 18:05:24 UTC (rev 1377)
@@ -1,5 +1,7 @@
2009-01-21 Werner Koch <wk at g10code.com>
+ * fipsdrv.c (run_dsa_verify): Use gcry_mpi_scan again.
+
* fipsdrv.c (run_dsa_verify): Use hash of the data.
* pubkey.c (get_dsa_key_fips186_with_seed_new): New.
Modified: trunk/tests/fipsdrv.c
===================================================================
--- trunk/tests/fipsdrv.c 2009-01-21 17:46:55 UTC (rev 1376)
+++ trunk/tests/fipsdrv.c 2009-01-21 18:05:24 UTC (rev 1377)
@@ -1916,10 +1916,18 @@
gpg_error_t err;
gcry_sexp_t s_data, s_key, s_sig;
char hash[20];
-
+ gcry_mpi_t tmpmpi;
+
gcry_md_hash_buffer (GCRY_MD_SHA1, hash, data, datalen);
- err = gcry_sexp_build (&s_data, NULL,
- "(data (flags raw)(value %b))", 20, hash);
+ /* Note that we can't simply use %b with HASH to build the
+ S-expression, because that might yield a negative value. */
+ err = gcry_mpi_scan (&tmpmpi, GCRYMPI_FMT_USG, hash, 20, NULL);
+ if (!err)
+ {
+ err = gcry_sexp_build (&s_data, NULL,
+ "(data (flags raw)(value %m))", tmpmpi);
+ gcry_mpi_release (tmpmpi);
+ }
if (err)
die ("gcry_sexp_build failed for DSA data input: %s\n",
gpg_strerror (err));
More information about the Gnupg-commits
mailing list