g10: Simplify semantics of get_pubkey_byname.
authorNeal H. Walfield <neal@g10code.com>
Mon, 14 Sep 2015 18:38:07 +0000 (20:38 +0200)
committerNeal H. Walfield <neal@g10code.com>
Wed, 16 Sep 2015 13:15:22 +0000 (15:15 +0200)
* g10/getkey.c (get_pubkey_byname): If R_KEYBLOCK is not NULL, return
the keyblock in R_KEYBLOCK independent of whether PK is set or not.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
Currently, no caller invokes get_pubkey_byname with PK==NULL and
R_KEYBLOCK != NULL.  Thus, this change does not change any behavior.

g10/getkey.c

index 4cad1a4..efa548d 100644 (file)
@@ -962,14 +962,12 @@ get_pubkey_byfprint (PKT_public_key *pk, kbnode_t *r_keyblock,
       memcpy (ctx.items[0].u.fpr, fprint, fprint_len);
       rc = lookup (&ctx, &kb, &found_key, 0);
       if (!rc && pk)
-        {
-          pk_from_block (&ctx, pk, kb, found_key);
-          if (r_keyblock)
-            {
-              *r_keyblock = kb;
-              kb = NULL;
-            }
-        }
+       pk_from_block (&ctx, pk, kb, found_key);
+      if (!rc && r_keyblock)
+       {
+         *r_keyblock = kb;
+         kb = NULL;
+       }
       release_kbnode (kb);
       getkey_end (&ctx);
     }