| 158 | } |
| 159 | |
| 160 | static bool CheckRawECDSASignatureEncoding(const slicedvaltype &sig, |
| 161 | uint32_t flags, |
| 162 | ScriptError *serror) { |
| 163 | if (IsSchnorrSig(sig)) { |
| 164 | // In an ECDSA-only context, 64-byte signatures are forbidden. |
| 165 | return set_error(serror, ScriptError::SIG_BADLENGTH); |
| 166 | } |
| 167 | // https://bitcoin.stackexchange.com/a/12556: |
| 168 | if ((flags & (SCRIPT_VERIFY_DERSIG | SCRIPT_VERIFY_LOW_S | |
| 169 | SCRIPT_VERIFY_STRICTENC)) && |
| 170 | !IsValidDERSignatureEncoding(sig)) { |
| 171 | return set_error(serror, ScriptError::SIG_DER); |
| 172 | } |
| 173 | // If the S value is above the order of the curve divided by two, its |
| 174 | // complement modulo the order could have been used instead, which is |
| 175 | // one byte shorter when encoded correctly. |
| 176 | if ((flags & SCRIPT_VERIFY_LOW_S) && !CPubKey::CheckLowS(sig)) { |
| 177 | return set_error(serror, ScriptError::SIG_HIGH_S); |
| 178 | } |
| 179 | |
| 180 | return true; |
| 181 | } |
| 182 | |
| 183 | static bool CheckRawSchnorrSignatureEncoding(const slicedvaltype &sig, |
| 184 | uint32_t flags, |
no test coverage detected