g10: Simplify semantics of get_pubkey_byname.

* 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.
This commit is contained in:
Neal H. Walfield 2015-09-14 20:38:07 +02:00
parent b4672e4d48
commit 911fcca36d
1 changed files with 6 additions and 8 deletions

View 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);
}