mirror of
git://git.gnupg.org/gnupg.git
synced 2025-03-28 22:49:59 +01:00
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 <neal@g10code.com>
This commit is contained in:
parent
614ca00676
commit
eec365a02b
18
g10/tofu.c
18
g10/tofu.c
@ -1821,7 +1821,9 @@ ask_about_binding (ctrl_t ctrl,
|
|||||||
email> (including the binding itself, which will be first in the
|
email> (including the binding itself, which will be first in the
|
||||||
list). For each returned key also sets BINDING_NEW, etc. */
|
list). For each returned key also sets BINDING_NEW, etc. */
|
||||||
static strlist_t
|
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;
|
gpg_error_t rc;
|
||||||
char *sqerr;
|
char *sqerr;
|
||||||
@ -1898,6 +1900,18 @@ build_conflict_set (tofu_dbs_t dbs, const char *fingerprint, const char *email)
|
|||||||
|
|
||||||
/* Eliminate false conflicts. */
|
/* 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
|
/* If two keys have cross signatures, then they are controlled by
|
||||||
* the same person and thus are not in conflict. */
|
* the same person and thus are not in conflict. */
|
||||||
kb_all = xcalloc (sizeof (kb_all[0]), conflict_set_count);
|
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. */
|
/* 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);
|
conflict_set_count = strlist_length (conflict_set);
|
||||||
if (conflict_set_count == 0)
|
if (conflict_set_count == 0)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user