Reject blocks with non-canonical signatures starting from protocol version 60016
This commit is contained in:
@@ -176,30 +176,19 @@ bool IsLowDERSignature(const valtype &vchSig, ScriptError* serror, bool haveHash
|
||||
if (!IsValidSignatureEncoding(vchSig, haveHashType)) {
|
||||
return set_error(serror, SCRIPT_ERR_SIG_DER);
|
||||
}
|
||||
unsigned int nLenR = vchSig[3];
|
||||
unsigned int nLenS = vchSig[5+nLenR];
|
||||
const unsigned char *S = &vchSig[6+nLenR];
|
||||
// If the S value is above the order of the curve divided by two, its
|
||||
// complement modulo the order could have been used instead, which is
|
||||
// one byte shorter when encoded correctly.
|
||||
if (!CPubKey::CheckSignatureElement(S, nLenS, true))
|
||||
return set_error(serror, SCRIPT_ERR_SIG_HIGH_S);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
bool IsLowDERSignature(const valtype &vchSig, ScriptError* serror) {
|
||||
if (!IsValidSignatureEncoding(vchSig)) {
|
||||
return set_error(serror, SCRIPT_ERR_SIG_DER);
|
||||
}
|
||||
std::vector<unsigned char> vchSigCopy(vchSig.begin(), vchSig.begin() + vchSig.size() - 1);
|
||||
std::vector<unsigned char> vchSigCopy(vchSig.begin(), vchSig.begin() + vchSig.size() - (haveHashType ? 1 : 0));
|
||||
if (!CPubKey::CheckLowS(vchSigCopy)) {
|
||||
return set_error(serror, SCRIPT_ERR_SIG_HIGH_S);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
bool IsDERSignature(const valtype &vchSig, ScriptError* serror, bool haveHashType) {
|
||||
if (!IsValidSignatureEncoding(vchSig, haveHashType)) {
|
||||
return set_error(serror, SCRIPT_ERR_SIG_DER);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool static IsDefinedHashtypeSignature(const valtype &vchSig) {
|
||||
if (vchSig.size() == 0) {
|
||||
|
||||
Reference in New Issue
Block a user