diff options
author | Neal H. Walfield <[email protected]> | 2016-10-30 18:03:51 +0000 |
---|---|---|
committer | Neal H. Walfield <[email protected]> | 2016-10-30 18:03:51 +0000 |
commit | eec365a02bd35d2d5c9e4d2c8d18bcd9180cf859 (patch) | |
tree | 42dd1e4ba20699fd169ab5c324bff72187245f63 | |
parent | g10: Fix bit setting. (diff) | |
download | gnupg-eec365a02bd35d2d5c9e4d2c8d18bcd9180cf859.tar.gz gnupg-eec365a02bd35d2d5c9e4d2c8d18bcd9180cf859.zip |
g10: Avoid reading in keys when possible.
* g10/tofu.c (build_conflict_set): If CONFLICT_SET contains a single
element, don't bother to check for cross sigs. Add parameter PK.
Update callers.
--
Signed-off-by: Neal H. Walfield <[email protected]>
-rw-r--r-- | g10/tofu.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/g10/tofu.c b/g10/tofu.c index 6156bcc2d..a0f80b3d4 100644 --- a/g10/tofu.c +++ b/g10/tofu.c @@ -1821,7 +1821,9 @@ ask_about_binding (ctrl_t ctrl, email> (including the binding itself, which will be first in the list). For each returned key also sets BINDING_NEW, etc. */ static strlist_t -build_conflict_set (tofu_dbs_t dbs, const char *fingerprint, const char *email) +build_conflict_set (tofu_dbs_t dbs, + PKT_public_key *pk, const char *fingerprint, + const char *email) { gpg_error_t rc; char *sqerr; @@ -1898,6 +1900,18 @@ build_conflict_set (tofu_dbs_t dbs, const char *fingerprint, const char *email) /* Eliminate false conflicts. */ + if (conflict_set_count == 1) + /* We only have a single key. There are no false conflicts to + eliminate. But, we do need to set the flags. */ + { + if (pk->has_expired) + conflict_set->flags |= BINDING_EXPIRED; + if (pk->flags.revoked) + conflict_set->flags |= BINDING_REVOKED; + + return conflict_set; + } + /* If two keys have cross signatures, then they are controlled by * the same person and thus are not in conflict. */ kb_all = xcalloc (sizeof (kb_all[0]), conflict_set_count); @@ -2267,7 +2281,7 @@ get_trust (ctrl_t ctrl, PKT_public_key *pk, /* Look for conflicts. This is needed in all 3 cases. */ - conflict_set = build_conflict_set (dbs, fingerprint, email); + conflict_set = build_conflict_set (dbs, pk, fingerprint, email); conflict_set_count = strlist_length (conflict_set); if (conflict_set_count == 0) { |