From a680c363172ae700f7b18cf7caefce178b5566bd Mon Sep 17 00:00:00 2001 From: Gautam Botrel Date: Fri, 15 Dec 2023 13:28:03 -0600 Subject: [PATCH] build: make staticcheck happier --- ecc/bls12-377/fr/sis/sis_test.go | 9 ++++----- ecc/bn254/fr/sis/sis_test.go | 9 ++++----- ecc/stark-curve/g1_test.go | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/ecc/bls12-377/fr/sis/sis_test.go b/ecc/bls12-377/fr/sis/sis_test.go index e15626f8e..3df4ff66a 100644 --- a/ecc/bls12-377/fr/sis/sis_test.go +++ b/ecc/bls12-377/fr/sis/sis_test.go @@ -16,14 +16,14 @@ package sis import ( "bytes" + "crypto/rand" "encoding/binary" "encoding/json" "fmt" "io" - "io/ioutil" "math/big" "math/bits" - "math/rand" + "os" "testing" "time" @@ -69,7 +69,7 @@ func TestReference(t *testing.T) { // read the test case file var testCases TestCases - data, err := ioutil.ReadFile("test_cases.json") + data, err := os.ReadFile("test_cases.json") assert.NoError(err, "reading test cases failed") err = json.Unmarshal(data, &testCases) assert.NoError(err, "reading test cases failed") @@ -391,8 +391,7 @@ func TestLimbDecompositionFastPath(t *testing.T) { nValues := bitset.New(uint(size)) // Generate a random buffer - rand.Seed(time.Now().UnixNano()) //#nosec G404 weak rng is fine here - _, err := rand.Read(buf) //#nosec G404 weak rng is fine here + _, err := rand.Read(buf) //#nosec G404 weak rng is fine here assert.NoError(err) limbDecomposeBytes8_64(buf, m, mValues) diff --git a/ecc/bn254/fr/sis/sis_test.go b/ecc/bn254/fr/sis/sis_test.go index cde678d21..480a11277 100644 --- a/ecc/bn254/fr/sis/sis_test.go +++ b/ecc/bn254/fr/sis/sis_test.go @@ -16,14 +16,14 @@ package sis import ( "bytes" + "crypto/rand" "encoding/binary" "encoding/json" "fmt" "io" - "io/ioutil" "math/big" "math/bits" - "math/rand" + "os" "testing" "time" @@ -68,7 +68,7 @@ func TestReference(t *testing.T) { // read the test case file var testCases TestCases - data, err := ioutil.ReadFile("test_cases.json") + data, err := os.ReadFile("test_cases.json") assert.NoError(err, "reading test cases failed") err = json.Unmarshal(data, &testCases) assert.NoError(err, "reading test cases failed") @@ -390,8 +390,7 @@ func TestLimbDecompositionFastPath(t *testing.T) { nValues := bitset.New(uint(size)) // Generate a random buffer - rand.Seed(time.Now().UnixNano()) //#nosec G404 weak rng is fine here - _, err := rand.Read(buf) //#nosec G404 weak rng is fine here + _, err := rand.Read(buf) assert.NoError(err) limbDecomposeBytes8_64(buf, m, mValues) diff --git a/ecc/stark-curve/g1_test.go b/ecc/stark-curve/g1_test.go index 31abc377f..0e3373eb9 100644 --- a/ecc/stark-curve/g1_test.go +++ b/ecc/stark-curve/g1_test.go @@ -17,8 +17,8 @@ package starkcurve import ( + "crypto/rand" "math/big" - "math/rand" "testing" "github.com/consensys/gnark-crypto/ecc/stark-curve/fp"