schnorr: bip-340 compliant signing

fixes https://github.com/btcsuite/btcd/issues/2021
This commit is contained in:
wydengyre 2023-08-15 14:58:15 +01:00
parent 0bed86b3f0
commit 1c0bc470e8

View File

@ -174,10 +174,7 @@ func schnorrVerify(sig *Signature, hash []byte, pubKeyBytes []byte) error {
)
var e btcec.ModNScalar
if overflow := e.SetBytes((*[32]byte)(commitment)); overflow != 0 {
str := "hash of (r || P || m) too big"
return signatureError(ecdsa_schnorr.ErrSchnorrHashValue, str)
}
e.SetBytes((*[32]byte)(commitment))
// Negate e here so we can use AddNonConst below to subtract the s*G
// point from e*P.