bool CKey::Sign(uint256 hash, std::vector<unsigned char>& vchSig)
{
vchSig.clear();
- auto sig = ECDSA_do_sign((unsigned char*)&hash, sizeof(hash), pkey);
+ auto sig = ECDSA_do_sign(hash.begin(), hash.size(), pkey);
if (sig==NULL)
return false;
auto group = EC_KEY_get0_group(pkey);
bnHash.setuint160(Hash160(vchLr));
CPoint pointH;
- pointH.setPubKey(pubKeyH);
+ if (!pointH.setPubKey(pubKeyH)) {
+ throw key_error("CMalleablePubKey::GetVariant() : Unable to decode H value");
+ }
CPoint P;
// Calculate P = Hash(L*r)*G + H
}
std::vector<unsigned char> vchResult;
- P.getBytes(vchResult);
+ if (!P.getBytes(vchResult)) {
+ throw key_error("CMalleablePubKey::GetVariant() : Unable to convert P value");
+ }
vchPubKeyVariant = CPubKey(vchResult);
}