Tolerate NULL key in pgpVerifySignature()
authorPanu Matilainen <pmatilai@redhat.com>
Tue, 8 Nov 2011 12:08:40 +0000 (14:08 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Tue, 8 Nov 2011 12:08:40 +0000 (14:08 +0200)
rpmio/rpmpgp.c

index d4cbd27..43e6c5d 100644 (file)
@@ -1018,9 +1018,7 @@ rpmRC pgpVerifySignature(pgpDigParams key, pgpDigParams sig, DIGEST_CTX hashctx)
      * If we have a key, verify the signature for real. Otherwise we've
      * done all we can, return NOKEY to indicate "looks okay but dunno."
      */
-    if (key->alg == NULL) {
-       res = RPMRC_NOKEY;
-    } else {
+    if (key && key->alg) {
        pgpDigAlg sa = sig->alg;
        pgpDigAlg ka = key->alg;
        if (sa && sa->verify) {
@@ -1028,6 +1026,8 @@ rpmRC pgpVerifySignature(pgpDigParams key, pgpDigParams sig, DIGEST_CTX hashctx)
                res = RPMRC_OK;
            }
        }
+    } else {
+       res = RPMRC_NOKEY;
     }
 
 exit: