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

Function CheckSignatureEncoding

src/script/interpreter.cpp:220–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218}
219
220bool CheckSignatureEncoding(const std::vector<unsigned char> &vchSig, unsigned int flags, ScriptError* serror) {
221 // Empty signature. Not strictly DER encoded, but allowed to provide a
222 // compact way to provide an invalid signature for use with CHECK(MULTI)SIG
223 if (vchSig.size() == 0) {
224 return true;
225 }
226 if ((flags & (SCRIPT_VERIFY_DERSIG | SCRIPT_VERIFY_LOW_S | SCRIPT_VERIFY_STRICTENC)) != 0 && !IsValidSignatureEncoding(vchSig)) {
227 return set_error(serror, SCRIPT_ERR_SIG_DER);
228 } else if ((flags & SCRIPT_VERIFY_LOW_S) != 0 && !IsLowDERSignature(vchSig, serror)) {
229 // serror is set
230 return false;
231 } else if ((flags & SCRIPT_VERIFY_STRICTENC) != 0) {
232 if (!IsDefinedHashtypeSignature(vchSig)) {
233 return set_error(serror, SCRIPT_ERR_SIG_HASHTYPE);
234 }
235
236 bool requiresForkId = !ForkIdDisabled(flags);
237 bool usesForkId = UsesForkId(vchSig);
238 if (requiresForkId && !usesForkId) {
239 return set_error(serror, SCRIPT_ERR_SIG_HASHTYPE);
240 }
241 }
242 return true;
243}
244
245bool static CheckPubKeyEncoding(const valtype &vchPubKey, unsigned int flags, const SigVersion &sigversion, ScriptError* serror) {
246 if ((flags & SCRIPT_VERIFY_STRICTENC) != 0 && !IsCompressedOrUncompressedPubKey(vchPubKey)) {

Callers 2

ScriptToAsmStrFunction · 0.85
EvalScriptFunction · 0.85

Calls 7

IsValidSignatureEncodingFunction · 0.85
IsLowDERSignatureFunction · 0.85
ForkIdDisabledFunction · 0.85
UsesForkIdFunction · 0.85
set_errorFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected