diff options
author | Werner Koch <wk@gnupg.org> | 2009-01-21 18:05:24 +0000 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2009-01-21 18:05:24 +0000 |
commit | 01a0418237c46504ffc3894051aff6e5034c76f8 (patch) | |
tree | b95aa6a99c3910ce597cffd873a536b9542c7d7b /tests/fipsdrv.c | |
parent | a88d016d89b3c9cb9bb0d973be43127b0afdf1af (diff) | |
download | libgcrypt-01a0418237c46504ffc3894051aff6e5034c76f8.tar.gz |
Fix last change.
Diffstat (limited to 'tests/fipsdrv.c')
-rw-r--r-- | tests/fipsdrv.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/fipsdrv.c b/tests/fipsdrv.c index 963788b4..06fa3485 100644 --- a/tests/fipsdrv.c +++ b/tests/fipsdrv.c @@ -1916,10 +1916,18 @@ run_dsa_verify (const void *data, size_t datalen, 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)); |