1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

gpg: Factor out code into a standalone function.

* g10/trustdb.c (tdb_keyid_is_utk): New function.
(add_utk): Use it.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
This commit is contained in:
Neal H. Walfield 2015-10-21 12:52:56 +02:00
parent a79045e38d
commit 243f90afba
2 changed files with 16 additions and 7 deletions

View File

@ -229,13 +229,8 @@ add_utk (u32 *kid)
{
struct key_item *k;
for (k = utk_list; k; k = k->next)
{
if (k->kid[0] == kid[0] && k->kid[1] == kid[1])
{
return 0;
}
}
if (tdb_keyid_is_utk (kid))
return 0;
k = new_key_item ();
k->kid[0] = kid[0];
@ -317,6 +312,18 @@ verify_own_keys(void)
return;
}
/* Returns whether KID is on the list of ultimately trusted keys. */
int
tdb_keyid_is_utk (u32 *kid)
{
struct key_item *k;
for (k = utk_list; k; k = k->next)
if (k->kid[0] == kid[0] && k->kid[1] == kid[1])
return 1;
return 0;
}
/*********************************************
*********** TrustDB stuff *******************

View File

@ -111,6 +111,8 @@ void clean_key (kbnode_t keyblock, int noisy, int self_only,
/*-- trustdb.c --*/
void tdb_register_trusted_keyid (u32 *keyid);
void tdb_register_trusted_key (const char *string);
/* Returns whether KID is on the list of ultimately trusted keys. */
int tdb_keyid_is_utk (u32 *kid);
void check_trustdb (void);
void update_trustdb (void);
int setup_trustdb( int level, const char *dbname );