fix #9: enable verifying own signature

This commit is contained in:
TLINDEN
2015-04-01 20:40:08 +02:00
parent 5d44a4d9ba
commit 677eb92001

View File

@@ -403,6 +403,21 @@ pcp_pubkey_t *pcp_ed_detachverify_buffered(PCPCTX *ptx, Pcpstream *in, Pcpstream
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 {
verifiedhash = pcp_ed_verify(ptx, sighash, mlen, p);