diff --git a/sm2/fuzz_test.go b/sm2/fuzz_test.go index e6cfb87..90c5b4a 100644 --- a/sm2/fuzz_test.go +++ b/sm2/fuzz_test.go @@ -4,11 +4,15 @@ package sm2 import ( + "crypto/elliptic" "crypto/rand" + "io" "testing" "time" ) +var _ = elliptic.P256() + func TestFuzz(t *testing.T) { p256 := P256() p256Generic := p256.Params() @@ -30,8 +34,8 @@ func TestFuzz(t *testing.T) { default: } - rand.Read(scalar1[:]) - rand.Read(scalar2[:]) + io.ReadFull(rand.Reader, scalar1[:]) + io.ReadFull(rand.Reader, scalar2[:]) x, y := p256.ScalarBaseMult(scalar1[:]) x2, y2 := p256Generic.ScalarBaseMult(scalar1[:])