From 03a65a53231cc3132a50a1871e81a512c44da169 Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Wed, 23 Nov 2016 12:29:22 +0100 Subject: g10: Avoid gratuitously loading a keyblock when it is already available * g10/trust.c (get_validity): Add new, optional parameter KB. Only load the keyblock if KB is NULL. Update callers. (get_validity): Likewise. * g10/trustdb.c (tdb_get_validity_core): Likewise. -- Signed-off-by: Neal H. Walfield GnuPG-bug-id: 2812 --- g10/mainproc.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'g10/mainproc.c') diff --git a/g10/mainproc.c b/g10/mainproc.c index c1819f004..30e19fe1f 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -1015,8 +1015,13 @@ list_node (CTX c, kbnode_t node) keyid_from_pk( pk, keyid ); if (pk->flags.primary) - c->trustletter = (opt.fast_list_mode? - 0 : get_validity_info (c->ctrl, pk, NULL)); + c->trustletter = (opt.fast_list_mode + ? 0 + : get_validity_info + (c->ctrl, + node->pkt->pkttype == PKT_PUBLIC_KEY + ? node : NULL, + pk, NULL)); es_printf ("%s:", pk->flags.primary? "pub":"sub" ); if (c->trustletter) es_putc (c->trustletter, es_stdout); @@ -1973,8 +1978,8 @@ check_sig_and_print (CTX c, kbnode_t node) does not print a LF we need to compute the validity before calling that function. */ if ((opt.verify_options & VERIFY_SHOW_UID_VALIDITY)) - valid = get_validity (c->ctrl, mainpk, un->pkt->pkt.user_id, - NULL, 0); + valid = get_validity (c->ctrl, keyblock, mainpk, + un->pkt->pkt.user_id, NULL, 0); else valid = 0; /* Not used. */ @@ -2075,7 +2080,7 @@ check_sig_and_print (CTX c, kbnode_t node) actually ask the user to update any trust information. */ valid = (trust_value_to_string - (get_validity (c->ctrl, mainpk, + (get_validity (c->ctrl, keyblock, mainpk, un->pkt->pkt.user_id, NULL, 0))); log_printf (" [%s]\n",valid); } -- cgit v1.2.3