From 1c0bc470e8a0a295a58492d67c0de1b6c0aafa87 Mon Sep 17 00:00:00 2001 From: wydengyre Date: Tue, 15 Aug 2023 14:58:15 +0100 Subject: [PATCH] schnorr: bip-340 compliant signing fixes https://github.com/btcsuite/btcd/issues/2021 --- btcec/schnorr/signature.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/btcec/schnorr/signature.go b/btcec/schnorr/signature.go index 83ab44c743..95cad532a0 100644 --- a/btcec/schnorr/signature.go +++ b/btcec/schnorr/signature.go @@ -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.