X-Git-Url: http://the.earth.li/gitweb/?p=onak.git;a=blobdiff_plain;f=decodekey.c;h=f8cc40771c63f85e845216b7b0c0a128e5e8fbda;hp=481b8aaa94e68cae12de3c5f1df987300a349465;hb=76f079e5ebdb34acaaa2462a8d915ee06d3c8425;hpb=b3c67e7383ef6ece55dcf6fbfa9587f5d0a14546 diff --git a/decodekey.c b/decodekey.c index 481b8aa..f8cc407 100644 --- a/decodekey.c +++ b/decodekey.c @@ -230,17 +230,27 @@ onak_status_t sig_info(struct openpgp_packet *packet, uint64_t *keyid, break; case 4: case 5: + if (keyid != NULL) { + *keyid = 0; + } res = parse_subpackets(&packet->data[4], packet->length - 4, &length, keyid, creation); if (res != ONAK_E_OK) { return res; } - res = parse_subpackets(&packet->data[length + 4], - packet->length - (4 + length), - &length, keyid, creation); - if (res != ONAK_E_OK) { - return res; + /* + * Only look at the unhashed subpackets if we want the + * keyid and it wasn't in the signed subpacket + * section. + */ + if (keyid != NULL && *keyid == 0) { + res = parse_subpackets(&packet->data[length + 4], + packet->length - (4 + length), + &length, keyid, NULL); + if (res != ONAK_E_OK) { + return res; + } } break; default: