summaryrefslogtreecommitdiffstats
path: root/g10/pkglue.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2009-02-24 12:47:25 +0100
committerWerner Koch <wk@gnupg.org>2009-02-24 12:47:25 +0100
commit16e76f3a697b7bc4f71f96f5cf2a451bcc47bac0 (patch)
tree8b3fdc836f5e06f6a1aa2f935efece31b7f7f251 /g10/pkglue.c
parentFix bug 1001. (diff)
downloadgnupg2-16e76f3a697b7bc4f71f96f5cf2a451bcc47bac0.tar.xz
gnupg2-16e76f3a697b7bc4f71f96f5cf2a451bcc47bac0.zip
Replace a call to BUG by an error return.
Diffstat (limited to 'g10/pkglue.c')
-rw-r--r--g10/pkglue.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/g10/pkglue.c b/g10/pkglue.c
index e4d749a23..90f8f248b 100644
--- a/g10/pkglue.c
+++ b/g10/pkglue.c
@@ -134,13 +134,14 @@ pk_verify (int algo, gcry_mpi_t hash, gcry_mpi_t * data, gcry_mpi_t * pkey)
return GPG_ERR_PUBKEY_ALGO;
if (rc)
- BUG ();
+ BUG (); /* gcry_sexp_build should never fail. */
/* put hash into a S-Exp s_hash */
if (gcry_sexp_build (&s_hash, NULL, "%m", hash))
- BUG ();
+ BUG (); /* gcry_sexp_build should never fail. */
- /* put data into a S-Exp s_sig */
+ /* Put data into a S-Exp s_sig. */
+ s_sig = NULL;
if (algo == GCRY_PK_DSA)
{
if (!data[0] || !data[1])
@@ -167,11 +168,9 @@ pk_verify (int algo, gcry_mpi_t hash, gcry_mpi_t * data, gcry_mpi_t * pkey)
else
BUG ();
- if (rc)
- BUG ();
-
+ if (!rc)
+ rc = gcry_pk_verify (s_sig, s_hash, s_pkey);
- rc = gcry_pk_verify (s_sig, s_hash, s_pkey);
gcry_sexp_release (s_sig);
gcry_sexp_release (s_hash);
gcry_sexp_release (s_pkey);