From 8f0aa7c9336bef8fead8b5052f72c2fa4e830d23 Mon Sep 17 00:00:00 2001 From: matteosz Date: Mon, 4 Mar 2024 11:03:23 +0100 Subject: [PATCH] Added fuzzers to some sign packages --- sign/cosi/cosi_test.go | 1 - sign/schnorr/schnorr_test.go | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/sign/cosi/cosi_test.go b/sign/cosi/cosi_test.go index 0bc4c2bc0..0213aba8b 100644 --- a/sign/cosi/cosi_test.go +++ b/sign/cosi/cosi_test.go @@ -30,7 +30,6 @@ var testSuite = &cosiSuite{edwards25519.NewBlakeSHA256Ed25519(), blake2xb.New(ni func TestCoSi(t *testing.T) { message := []byte("Hello World Cosi") testCoSi(t, 2, 0, message) - testCoSi(t, 2, 0, message) testCoSi(t, 5, 0, message) testCoSi(t, 5, 2, message) testCoSi(t, 5, 4, message) diff --git a/sign/schnorr/schnorr_test.go b/sign/schnorr/schnorr_test.go index 7a0987288..f1a5cead8 100644 --- a/sign/schnorr/schnorr_test.go +++ b/sign/schnorr/schnorr_test.go @@ -128,13 +128,13 @@ func TestSchnorrMalleability(t *testing.T) { } func FuzzSchnorr(f *testing.F) { + suite := edwards25519.NewBlakeSHA256Ed25519() + kp := key.NewKeyPair(suite) + f.Fuzz(func(t *testing.T, msg []byte) { if (len(msg) < 1) || (len(msg) > 1000) { t.Skip("msg must have byte length between 1 and 1000") } - suite := edwards25519.NewBlakeSHA256Ed25519() - kp := key.NewKeyPair(suite) - s, err := Sign(suite, kp.Private, msg) require.NoError(t, err, "Couldn't sign msg: %s: %v", msg, err)