| 252 | } |
| 253 | |
| 254 | bool 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 | |
| 271 | bool static IsDefinedHashtypeSignature(const valtype &vchSig, unsigned int flags) { |
| 272 | if (vchSig.size() == 0) { |
no test coverage detected