From 3cbc66410d62ad2f7e559095753a2385fe644d07 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 23 Apr 2021 20:45:25 +0200 Subject: [PATCH] gpg: Replace an obsolete trustdb function. * g10/trustdb.c (tdb_register_trusted_keyid): Make static. (tdb_register_trusted_key): Replace register_trusted_keyid by tdb_register_trusted_key. * g10/keygen.c (do_generate_keypair): Ditto. * g10/trust.c (register_trusted_keyid): Remove. --- g10/keygen.c | 5 +++-- g10/trust.c | 11 ----------- g10/trustdb.c | 8 ++++---- g10/trustdb.h | 2 -- 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/g10/keygen.c b/g10/keygen.c index a4117cdd0..5d85c05d4 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -5576,6 +5576,7 @@ do_generate_keypair (ctrl_t ctrl, struct para_data_s *para, { int no_enc_rsa; PKT_public_key *pk; + char hexfpr[2*MAX_FINGERPRINT_LEN + 1]; no_enc_rsa = ((get_parameter_algo (ctrl, para, pKEYTYPE, NULL) == PUBKEY_ALGO_RSA) @@ -5585,8 +5586,8 @@ do_generate_keypair (ctrl_t ctrl, struct para_data_s *para, pk = find_kbnode (pub_root, PKT_PUBLIC_KEY)->pkt->pkt.public_key; - keyid_from_pk (pk, pk->main_keyid); - register_trusted_keyid (pk->main_keyid); + hexfingerprint (pk, hexfpr, sizeof hexfpr); + register_trusted_key (hexfpr); if (!opt.flags.no_auto_trust_new_key) update_ownertrust (ctrl, pk, diff --git a/g10/trust.c b/g10/trust.c index bd1c89458..67cb1029b 100644 --- a/g10/trust.c +++ b/g10/trust.c @@ -49,17 +49,6 @@ cache_disabled_value (ctrl_t ctrl, PKT_public_key *pk) } -void -register_trusted_keyid (u32 *keyid) -{ -#ifdef NO_TRUST_MODELS - (void)keyid; -#else - tdb_register_trusted_keyid (keyid); -#endif -} - - void register_trusted_key (const char *string) { diff --git a/g10/trustdb.c b/g10/trustdb.c index a313a423c..0b9625ea6 100644 --- a/g10/trustdb.c +++ b/g10/trustdb.c @@ -232,7 +232,7 @@ release_key_array ( struct key_array *keys ) * before initializing the validation module. * FIXME: Should be replaced by a function to add those keys to the trustdb. */ -void +static void tdb_register_trusted_keyid (u32 *keyid) { struct key_item *k; @@ -257,21 +257,21 @@ tdb_register_trusted_key (const char *string) { if (desc.mode == KEYDB_SEARCH_MODE_LONG_KID) { - register_trusted_keyid (desc.u.kid); + tdb_register_trusted_keyid (desc.u.kid); return; } if (desc.mode == KEYDB_SEARCH_MODE_FPR && desc.fprlen == 20) { kid[0] = buf32_to_u32 (desc.u.fpr+12); kid[1] = buf32_to_u32 (desc.u.fpr+16); - register_trusted_keyid (kid); + tdb_register_trusted_keyid (kid); return; } if (desc.mode == KEYDB_SEARCH_MODE_FPR && desc.fprlen == 32) { kid[0] = buf32_to_u32 (desc.u.fpr); kid[1] = buf32_to_u32 (desc.u.fpr+4); - register_trusted_keyid (kid); + tdb_register_trusted_keyid (kid); return; } } diff --git a/g10/trustdb.h b/g10/trustdb.h index d52fc53f2..6c7fd6c8e 100644 --- a/g10/trustdb.h +++ b/g10/trustdb.h @@ -48,7 +48,6 @@ /*-- trust.c --*/ int cache_disabled_value (ctrl_t ctrl, PKT_public_key *pk); -void register_trusted_keyid (u32 *keyid); void register_trusted_key (const char *string); const char *trust_value_to_string (unsigned int value); @@ -75,7 +74,6 @@ const char *get_validity_string (ctrl_t ctrl, /*-- 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);