fix #9: enable verifying own signature for normal sigs as well

This commit is contained in:
TLINDEN
2015-04-01 20:47:35 +02:00
parent 677eb92001
commit 30bd90381c

View File

@@ -277,6 +277,21 @@ pcp_pubkey_t *pcp_ed_verify_buffered(PCPCTX *ptx, Pcpstream *in, pcp_pubkey_t *p
verifiedhash = pcp_ed_verify(ptx, sighash, mlen, p);
if(verifiedhash != NULL)
break;
}
/* no pubkey found yet, try our own */
pcp_key_t *k;
pcp_pubkey_t *pub;
pcphash_iterate(ptx, k) {
if(k->type == PCP_KEY_TYPE_MAINSECRET) {
pub = pcpkey_pub_from_secret(k);
verifiedhash = pcp_ed_verify(ptx, sighash, mlen, pub);
if(verifiedhash != NULL) {
/* good, self-signed */
p = pub;
break;
}
}
}
}
else {