secp256k1

Pure Haskell Schnorr, ECDSA on the elliptic curve secp256k1 (docs.ppad.tech/secp256k1).
git clone git://git.ppad.tech/secp256k1.git
Log | Files | Refs | README | LICENSE

commit a1474850185530cbd51b5cbccbd710bee5140184
parent 52214de15457f96370063bf3791797c384d64f2a
Author: Jared Tobin <jared@jtobin.io>
Date:   Sat,  1 Aug 2026 13:48:03 -0230

test: assert rejection once in the noble invalid-verify group

The group handled an unparseable public key with
assertBool "no parse" True, which asserts nothing. Every vector here
expects rejection, so this was harmless, but it is the shape that
would silently pass a vector that ought to have verified.

State the requirement once instead: the vector must be rejected,
whether by the point parser or by verification.

Diffstat:
Mtest/Noble.hs | 17+++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/test/Noble.hs b/test/Noble.hs @@ -70,15 +70,16 @@ execute_invalid_sign tex (label, InvalidSignTest {..}) = execute_invalid_verify :: Context -> (Int, InvalidVerifyTest) -> TestTree execute_invalid_verify tex (label, InvalidVerifyTest {..}) = - testCase ("noble-secp256k1, invalid verify (" <> show label <> ")") $ - case parse_point (decodeLenient ivv_Q) of - Nothing -> assertBool "no parse" True - Just pub -> do + testCase ("noble-secp256k1, invalid verify (" <> show label <> ")") $ + -- every vector in this group must be rejected, whether by the + -- point parser or by verification itself + assertBool mempty (not accepted) + where + accepted = case parse_point (decodeLenient ivv_Q) of + Nothing -> False + Just pub -> let sig = parse_compact ivv_signature - ver = verify_ecdsa ivv_m pub sig - ver' = verify_ecdsa' tex ivv_m pub sig - assertBool mempty (not ver) - assertBool mempty (not ver') + in verify_ecdsa ivv_m pub sig || verify_ecdsa' tex ivv_m pub sig -- parser helper toBS :: T.Text -> BS.ByteString