From: Jonathan McDowell Date: Tue, 9 Apr 2019 14:55:02 +0000 (+0100) Subject: Move keysigs into its only user, keydb.c X-Git-Tag: onak-0.6.0~68 X-Git-Url: https://the.earth.li/gitweb/?a=commitdiff_plain;h=357fbc65bfab230bbf12313e8b458d8325a6174f;p=onak.git Move keysigs into its only user, keydb.c keysigs is only actually used within keydb.c and pulls in stats structures unnecessarily to decodekey.c, so pull it inline. --- diff --git a/decodekey.c b/decodekey.c index 5ea48bd..0ff0625 100644 --- a/decodekey.c +++ b/decodekey.c @@ -169,28 +169,6 @@ onak_status_t parse_subpackets(unsigned char *data, size_t len, return ONAK_E_OK; } -/** - * keysigs - Return the sigs on a given OpenPGP signature list. - * @curll: The current linked list. Can be NULL to create a new list. - * @sigs: The signature list we want the sigs on. - * - * Returns a linked list of stats_key elements containing the sigs on the - * supplied OpenPGP packet list. - */ -struct ll *keysigs(struct ll *curll, - struct openpgp_packet_list *sigs) -{ - uint64_t keyid = 0; - - while (sigs != NULL) { - keyid = sig_keyid(sigs->packet); - sigs = sigs->next; - curll = lladd(curll, createandaddtohash(keyid)); - } - - return curll; -} - /** * sig_info - Get info on a given OpenPGP signature packet * @packet: The signature packet diff --git a/keydb.c b/keydb.c index cfcf75c..f92c252 100644 --- a/keydb.c +++ b/keydb.c @@ -88,13 +88,19 @@ struct ll *generic_getkeysigs(struct onak_dbctx *dbctx, { struct ll *sigs = NULL; struct openpgp_signedpacket_list *uids = NULL; + struct openpgp_packet_list *cursig; struct openpgp_publickey *publickey = NULL; dbctx->fetch_key_id(dbctx, keyid, &publickey, false); if (publickey != NULL) { for (uids = publickey->uids; uids != NULL; uids = uids->next) { - sigs = keysigs(sigs, uids->sigs); + for (cursig = uids->sigs; cursig != NULL; + cursig = cursig->next) { + sigs = lladd(sigs, + createandaddtohash(sig_keyid( + cursig->packet))); + } } if (revoked != NULL) { *revoked = publickey->revoked;