MCPcopy Create free account
hub / github.com/ElementsProject/elements / IsLowDERSignature

Function IsLowDERSignature

src/script/interpreter.cpp:254–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252}
253
254bool static IsLowDERSignature(const valtype &vchSig, ScriptError* serror) {
255 if (!IsValidSignatureEncoding(vchSig)) {
256 return set_error(serror, SCRIPT_ERR_SIG_DER);
257 }
258 // https://bitcoin.stackexchange.com/a/12556:
259 // Also note that inside transaction signatures, an extra hashtype byte
260 // follows the actual signature data.
261 std::vector<unsigned char> vchSigCopy(vchSig.begin(), vchSig.begin() + vchSig.size() - 1);
262 // If the S value is above the order of the curve divided by two, its
263 // complement modulo the order could have been used instead, which is
264 // one byte shorter when encoded correctly.
265 if (!CPubKey::CheckLowS(vchSigCopy)) {
266 return set_error(serror, SCRIPT_ERR_SIG_HIGH_S);
267 }
268 return true;
269}
270
271bool static IsDefinedHashtypeSignature(const valtype &vchSig, unsigned int flags) {
272 if (vchSig.size() == 0) {

Callers 1

CheckSignatureEncodingFunction · 0.85

Calls 4

IsValidSignatureEncodingFunction · 0.85
set_errorFunction · 0.70
beginMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected