MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / CheckSignatureEncoding

Function CheckSignatureEncoding

src/script/interpreter.cpp:211–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209}
210
211bool CheckSignatureEncoding(const std::vector<unsigned char> &vchSig, script_verify_flags flags, ScriptError* serror) {
212 // Empty signature. Not strictly DER encoded, but allowed to provide a
213 // compact way to provide an invalid signature for use with CHECK(MULTI)SIG
214 if (vchSig.size() == 0) {
215 return true;
216 }
217 if ((flags & (SCRIPT_VERIFY_DERSIG | SCRIPT_VERIFY_LOW_S | SCRIPT_VERIFY_STRICTENC)) != 0 && !IsValidSignatureEncoding(vchSig)) {
218 return set_error(serror, SCRIPT_ERR_SIG_DER);
219 } else if ((flags & SCRIPT_VERIFY_LOW_S) != 0 && !IsLowDERSignature(vchSig, serror)) {
220 // serror is set
221 return false;
222 } else if ((flags & SCRIPT_VERIFY_STRICTENC) != 0 && !IsDefinedHashtypeSignature(vchSig)) {
223 return set_error(serror, SCRIPT_ERR_SIG_HASHTYPE);
224 }
225 return true;
226}
227
228bool static CheckPubKeyEncoding(const valtype &vchPubKey, script_verify_flags flags, const SigVersion &sigversion, ScriptError* serror) {
229 if ((flags & SCRIPT_VERIFY_STRICTENC) != 0 && !IsCompressedOrUncompressedPubKey(vchPubKey)) {

Callers 4

ScriptToAsmStrFunction · 0.85
UnserializeMethod · 0.85
EvalChecksigPreTapscriptFunction · 0.85
EvalScriptFunction · 0.85

Calls 5

IsValidSignatureEncodingFunction · 0.85
set_errorFunction · 0.85
IsLowDERSignatureFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected