From b4672e4d48fb1e1e4d17551c4c828763d1dfbb57 Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Mon, 14 Sep 2015 15:43:52 +0200 Subject: [PATCH] g10: Eliminate the redundant function get_pubkey_byname. * g10/getkey.c (get_pubkey_byname): Remove function. (lookup): Replace use of get_pubkey_byname by get_pubkey_byfprint. -- Signed-off-by: Neal H. Walfield . --- g10/getkey.c | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/g10/getkey.c b/g10/getkey.c index 626c7a7ff..4cad1a48b 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -926,35 +926,6 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, } -/* Search for a key with the given standard fingerprint. In contrast - * to get_pubkey_byfprint we assume a right padded fingerprint of the - * standard length. PK may be NULL to only put the result into the - * internal caches. */ -gpg_error_t -get_pubkey_byfpr (PKT_public_key *pk, const byte *fpr) -{ - gpg_error_t err; - struct getkey_ctx_s ctx; - kbnode_t kb = NULL; - kbnode_t found_key = NULL; - - memset (&ctx, 0, sizeof ctx); - ctx.exact = 1; - ctx.not_allocated = 1; - ctx.kr_handle = keydb_new (); - ctx.nitems = 1; - ctx.items[0].mode = KEYDB_SEARCH_MODE_FPR; - memcpy (ctx.items[0].u.fpr, fpr, MAX_FINGERPRINT_LEN); - err = lookup (&ctx, &kb, &found_key, 0); - if (!err && pk) - pk_from_block (&ctx, pk, kb, found_key); - release_kbnode (kb); - getkey_end (&ctx); - - return err; -} - - /* Search for a key with the given fingerprint. The caller need to * prove an allocated public key object at PK. If R_KEYBLOCK is not * NULL the entire keyblock is stored there and the caller needs to @@ -2897,7 +2868,8 @@ get_user_id_byfpr (const byte *fpr, size_t *rn) } } } - while (++pass < 2 && !get_pubkey_byfpr (NULL, fpr)); + while (++pass < 2 + && !get_pubkey_byfprint (NULL, NULL, fpr, MAX_FINGERPRINT_LEN)); p = xstrdup (user_id_not_found_utf8 ()); *rn = strlen (p); return p;