X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;f=decodekey.c;h=28f8ceef39f90dd7151bc1f4692ac520d6487493;hb=85187675424f3854869f1607afd8a1e84e536946;hp=5ea48bde1f247af058b42404822da6a46c767859;hpb=6df51fef2960f533a741fb7290867387ed3fbba5;p=onak.git diff --git a/decodekey.c b/decodekey.c index 5ea48bd..28f8cee 100644 --- a/decodekey.c +++ b/decodekey.c @@ -48,6 +48,8 @@ onak_status_t parse_subpackets(unsigned char *data, size_t len, int offset = 0; int length = 0; int packetlen = 0; + struct openpgp_fingerprint fp; + int i; assert(data != NULL); @@ -122,6 +124,16 @@ onak_status_t parse_subpackets(unsigned char *data, size_t len, *keyid += data[offset+packetlen - 1]; } break; + case OPENPGP_SIGSUB_ISSUER_FINGER: + if ((packetlen - 2) <= MAX_FINGERPRINT_LEN && + keyid != NULL) { + fp.length = packetlen - 2; + for (i = 0; i < fp.length; i++) { + fp.fp[i] = data[offset + i + 2]; + } + *keyid = fingerprint2keyid(&fp); + } + break; case OPENPGP_SIGSUB_EXPIRY: case OPENPGP_SIGSUB_EXPORTABLE: case OPENPGP_SIGSUB_TRUSTSIG: @@ -134,7 +146,7 @@ onak_status_t parse_subpackets(unsigned char *data, size_t len, case OPENPGP_SIGSUB_REVOCATION_KEY: case OPENPGP_SIGSUB_ISSUER_UID: case OPENPGP_SIGSUB_URL: - case OPENPGP_SIGSUB_ISSUER_FINGER: + case OPENPGP_SIGSUB_X_ISSUER_FINGER: case OPENPGP_SIGSUB_NOTATION: case OPENPGP_SIGSUB_PREFHASH: case OPENPGP_SIGSUB_PREFCOMPRESS: @@ -169,28 +181,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 @@ -239,6 +229,7 @@ onak_status_t sig_info(struct openpgp_packet *packet, uint64_t *keyid, } break; case 4: + case 5: res = parse_subpackets(&packet->data[4], packet->length - 4, &length, keyid, creation);