mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Merge pull request #3637
6fd7ef2 Also switch the (unused) verification code to low-s instead of even-s. (Pieter Wuille)
This commit is contained in:
commit
72f754cf51
5 changed files with 78 additions and 25 deletions
|
|
@ -286,9 +286,12 @@ bool IsCanonicalSignature(const valtype &vchSig, unsigned int flags) {
|
|||
if (nLenS > 1 && (S[0] == 0x00) && !(S[1] & 0x80))
|
||||
return error("Non-canonical signature: S value excessively padded");
|
||||
|
||||
if (flags & SCRIPT_VERIFY_EVEN_S) {
|
||||
if (S[nLenS-1] & 1)
|
||||
return error("Non-canonical signature: S value odd");
|
||||
if (flags & SCRIPT_VERIFY_LOW_S) {
|
||||
// If the S value is above the order of the curve divided by two, its
|
||||
// complement modulo the order could have been used instead, which is
|
||||
// one byte shorter when encoded correctly.
|
||||
if (!CKey::CheckSignatureElement(S, nLenS, true))
|
||||
return error("Non-canonical signature: S value is unnecessarily high");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue