From 8431c16823c052bf1f2f526c712fa8c52b7d9a4b Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Wed, 18 Sep 2024 21:40:56 +0200 Subject: [PATCH] bindings/go/*: resolve golint nits. --- bindings/go/blst.go | 8 ++-- bindings/go/blst.tgo | 8 ++-- bindings/go/blst_htoc_test.go | 57 ++++++++++++++-------- bindings/go/blst_miller_loop_test.go | 2 +- bindings/go/blst_minpk_test.go | 72 ++++++++++++++-------------- bindings/go/blst_minsig_test.go | 72 ++++++++++++++-------------- 6 files changed, 118 insertions(+), 101 deletions(-) diff --git a/bindings/go/blst.go b/bindings/go/blst.go index 77f22419..7e4ae6e2 100644 --- a/bindings/go/blst.go +++ b/bindings/go/blst.go @@ -205,11 +205,11 @@ func initMaxProcs() int { return maxProcs } -func SetMaxProcs(max int) { - if max <= 0 { - max = 1 +func SetMaxProcs(procs int) { + if procs <= 0 { + procs = 1 } - maxProcs = max + maxProcs = procs } func numThreads(maxThreads int) int { diff --git a/bindings/go/blst.tgo b/bindings/go/blst.tgo index 947089c3..2b4df901 100644 --- a/bindings/go/blst.tgo +++ b/bindings/go/blst.tgo @@ -195,11 +195,11 @@ func initMaxProcs() int { return maxProcs } -func SetMaxProcs(max int) { - if max <= 0 { - max = 1 +func SetMaxProcs(procs int) { + if procs <= 0 { + procs = 1 } - maxProcs = max + maxProcs = procs } func numThreads(maxThreads int) int { diff --git a/bindings/go/blst_htoc_test.go b/bindings/go/blst_htoc_test.go index 9cf6b241..8151493b 100644 --- a/bindings/go/blst_htoc_test.go +++ b/bindings/go/blst_htoc_test.go @@ -11,7 +11,6 @@ import ( "encoding/hex" "encoding/json" "fmt" - "io/ioutil" "os" "strconv" "strings" @@ -35,22 +34,42 @@ func decodeP1(m map[string]interface{}) *P1Affine { return &p1 } +func readAll(file *os.File) ([]byte, error) { + defer file.Close() + + stat, err := file.Stat() + if err != nil { + return nil, err //nolint:wrapcheck + } + + buf := make([]byte, stat.Size()) + total := 0 + for total < len(buf) { + read, err := file.Read(buf[total:]) + if err != nil { + return nil, err //nolint:wrapcheck + } + total += read + } + + return buf, nil +} + func jsonG1HashToCurve(t *testing.T, fname string) { t.Helper() vfile, err := os.Open(fname) if err != nil { t.Skipf("%.16s... not found", fname) } - defer vfile.Close() - buf, err := ioutil.ReadAll(vfile) + buf, err := readAll(vfile) if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) } var vectors map[string]interface{} err = json.Unmarshal(buf, &vectors) if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) } dst := []byte(vectors["dst"].(string)) @@ -58,7 +77,7 @@ func jsonG1HashToCurve(t *testing.T, fname string) { vectorsArr, ok := vectors["vectors"].([]interface{}) if !ok { - t.Errorf("Could not cast vectors to an array") + t.Error("Could not cast vectors to an array") } for _, v := range vectorsArr { @@ -125,16 +144,15 @@ func jsonG2HashToCurve(t *testing.T, fname string) { if err != nil { t.Skipf("%.16s... not found", fname) } - defer vfile.Close() - buf, err := ioutil.ReadAll(vfile) + buf, err := readAll(vfile) if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) } var vectors map[string]interface{} err = json.Unmarshal(buf, &vectors) if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) } dst := []byte(vectors["dst"].(string)) @@ -142,7 +160,7 @@ func jsonG2HashToCurve(t *testing.T, fname string) { vectorsArr, ok := vectors["vectors"].([]interface{}) if !ok { - t.Errorf("Could not cast vectors to an array") + t.Error("Could not cast vectors to an array") } for _, v := range vectorsArr { @@ -178,44 +196,43 @@ func jsonExpandMessageXmd(t *testing.T, fname string) { if err != nil { t.Skipf("%.16s... not found", fname) } - defer vfile.Close() - buf, err := ioutil.ReadAll(vfile) + buf, err := readAll(vfile) if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) } var vectors map[string]interface{} err = json.Unmarshal(buf, &vectors) if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) } DST := []byte(vectors["DST"].(string)) tests, ok := vectors["tests"].([]interface{}) if !ok { - t.Errorf("Could not cast 'tests' to an array") + t.Error("Could not cast 'tests' to an array") } for _, v := range tests { test, ok := v.(map[string]interface{}) if !ok { - t.Errorf("Could not map 'tests[]' element") + t.Error("Could not map 'tests[]' element") } len_in_bytes, err := strconv.ParseInt(test["len_in_bytes"].(string), 0, 0) if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) } msg := []byte(test["msg"].(string)) expected, err := hex.DecodeString(test["uniform_bytes"].(string)) if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) } hashed := expandMessageXmd(msg, DST, int(len_in_bytes)) if !bytes.Equal(hashed, expected) { - t.Errorf("hashed != expected") + t.Error("hashed != expected") } } } diff --git a/bindings/go/blst_miller_loop_test.go b/bindings/go/blst_miller_loop_test.go index 1d636e33..ee2213f2 100644 --- a/bindings/go/blst_miller_loop_test.go +++ b/bindings/go/blst_miller_loop_test.go @@ -11,7 +11,7 @@ func TestMillerLoopN(t *testing.T) { scalars := make([]byte, npoints*8) _, err := rand.Read(scalars) if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) return } diff --git a/bindings/go/blst_minpk_test.go b/bindings/go/blst_minpk_test.go index 44c55b29..3bffef88 100644 --- a/bindings/go/blst_minpk_test.go +++ b/bindings/go/blst_minpk_test.go @@ -50,13 +50,13 @@ func TestSerdesMinPk(t *testing.T) { sk2 := new(SecretKey).Deserialize(sk.Serialize()) defer sk2.Zeroize() if !sk.Equals(sk2) { - t.Errorf("sk2 != sk") + t.Error("sk2 != sk") } // Negative test equals sk.b[0]++ if sk.Equals(sk2) { - t.Errorf("sk2 == sk") + t.Error("sk2 == sk") } // pk @@ -65,19 +65,19 @@ func TestSerdesMinPk(t *testing.T) { // Compress/decompress sk pk2 := new(PublicKeyMinPk).Uncompress(pk.Compress()) if !pk.Equals(pk2) { - t.Errorf("pk2 != pk") + t.Error("pk2 != pk") } // Serialize/deserialize sk pk3 := new(PublicKeyMinPk).Deserialize(pk.Serialize()) if !pk.Equals(pk3) { - t.Errorf("pk3 != pk") + t.Error("pk3 != pk") } // Negative test equals // pk.x.l[0] = pk.x.l[0] + 1 // if pk.Equals(pk2) { - // t.Errorf("pk2 == pk") + // t.Error("pk2 == pk") // } } @@ -105,27 +105,27 @@ func TestSignVerifyMinPk(t *testing.T) { // Verify if !sig0.Verify(true, pk0, false, msg0, dstMinPk) { - t.Errorf("verify sig0") + t.Error("verify sig0") } if !sig1.Verify(true, pk1, false, msg1, dstMinPk) { - t.Errorf("verify sig1") + t.Error("verify sig1") } if !new(SignatureMinPk).VerifyCompressed(sig1.Compress(), true, pk1.Compress(), false, msg1, dstMinPk) { - t.Errorf("verify sig1") + t.Error("verify sig1") } // Batch verify if !sig0.AggregateVerify(true, []*PublicKeyMinPk{pk0}, false, []Message{msg0}, dstMinPk) { - t.Errorf("aggregate verify sig0") + t.Error("aggregate verify sig0") } // Verify compressed inputs if !new(SignatureMinPk).AggregateVerifyCompressed(sig0.Compress(), true, [][]byte{pk0.Compress()}, false, []Message{msg0}, dstMinPk) { - t.Errorf("aggregate verify sig0 compressed") + t.Error("aggregate verify sig0 compressed") } // Verify serialized inputs @@ -133,26 +133,26 @@ func TestSignVerifyMinPk(t *testing.T) { [][]byte{pk0.Serialize()}, false, []Message{msg0}, dstMinPk) { - t.Errorf("aggregate verify sig0 serialized") + t.Error("aggregate verify sig0 serialized") } // Compressed with empty pk var emptyPk []byte if new(SignatureMinPk).VerifyCompressed(sig0.Compress(), true, emptyPk, false, msg0, dstMinPk) { - t.Errorf("verify sig compressed inputs") + t.Error("verify sig compressed inputs") } // Wrong message if sig0.Verify(true, pk0, false, msg1, dstMinPk) { - t.Errorf("Expected Verify to return false") + t.Error("Expected Verify to return false") } // Wrong key if sig0.Verify(true, pk1, false, msg0, dstMinPk) { - t.Errorf("Expected Verify to return false") + t.Error("Expected Verify to return false") } // Wrong sig if sig1.Verify(true, pk0, false, msg0, dstMinPk) { - t.Errorf("Expected Verify to return false") + t.Error("Expected Verify to return false") } } @@ -164,14 +164,14 @@ func TestSignVerifyAugMinPk(t *testing.T) { aug := []byte("augmentation") sig := new(SignatureMinPk).Sign(sk, msg, dstMinPk, aug) if !sig.Verify(true, pk, false, msg, dstMinPk, aug) { - t.Errorf("verify sig") + t.Error("verify sig") } aug2 := []byte("augmentation2") if sig.Verify(true, pk, false, msg, dstMinPk, aug2) { - t.Errorf("verify sig, wrong augmentation") + t.Error("verify sig, wrong augmentation") } if sig.Verify(true, pk, false, msg, dstMinPk) { - t.Errorf("verify sig, no augmentation") + t.Error("verify sig, no augmentation") } // TODO: augmentation with aggregate verify } @@ -183,13 +183,13 @@ func TestSignVerifyEncodeMinPk(t *testing.T) { msg := []byte("hello foo") sig := new(SignatureMinPk).Sign(sk, msg, dstMinPk, false) if !sig.Verify(true, pk, false, msg, dstMinPk, false) { - t.Errorf("verify sig") + t.Error("verify sig") } if sig.Verify(true, pk, false, msg, dstMinPk) { - t.Errorf("verify sig expected fail, wrong hashing engine") + t.Error("verify sig expected fail, wrong hashing engine") } if sig.Verify(true, pk, false, msg, dstMinPk, 0) { - t.Errorf("verify sig expected fail, illegal argument") + t.Error("verify sig expected fail, illegal argument") } } @@ -199,7 +199,7 @@ func TestSignVerifyAggregateMinPk(t *testing.T) { sks, msgs, _, pubks, _, err := generateBatchTestDataUncompressedMinPk(size) if err { - t.Errorf("Error generating test data") + t.Error("Error generating test data") return } @@ -211,7 +211,7 @@ func TestSignVerifyAggregateMinPk(t *testing.T) { } agProj := new(AggregateSignatureMinPk) if !agProj.Aggregate(sigs, false) { - t.Errorf("Aggregate unexpectedly returned nil") + t.Error("Aggregate unexpectedly returned nil") return } agSig := agProj.ToAffine() @@ -232,7 +232,7 @@ func TestSignVerifyAggregateMinPk(t *testing.T) { } agProj = new(AggregateSignatureMinPk) if !agProj.AggregateCompressed(compSigs, false) { - t.Errorf("AggregateCompressed unexpectedly returned nil") + t.Error("AggregateCompressed unexpectedly returned nil") return } agSig = agProj.ToAffine() @@ -283,7 +283,7 @@ func TestSignMultipleVerifyAggregateMinPk(t *testing.T) { agSig := new(AggregateSignatureMinPk) if !agSig.Aggregate(sigsToAgg, true) { - t.Errorf("failed to aggregate") + t.Error("failed to aggregate") } afSig := agSig.ToAffine() agPk := new(AggregatePublicKeyMinPk) @@ -303,7 +303,7 @@ func TestSignMultipleVerifyAggregateMinPk(t *testing.T) { var rbytes [BLST_SCALAR_BYTES]byte _, err := rand.Read(rbytes[:]) if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) } s.FromBEndian(rbytes[:]) } @@ -565,7 +565,7 @@ func TestSignVerifyAggregateValidatesInfinitePubkeyMinPk(t *testing.T) { sks, msgs, _, pubks, _, err := generateBatchTestDataUncompressedMinPk(size) if err { - t.Errorf("Error generating test data") + t.Error("Error generating test data") return } @@ -580,14 +580,14 @@ func TestSignVerifyAggregateValidatesInfinitePubkeyMinPk(t *testing.T) { zeroSig := new(SignatureMinPk) agProj := new(AggregateSignatureMinPk) if !agProj.Aggregate([]*SignatureMinPk{zeroSig}, false) { - t.Errorf("Aggregate unexpectedly returned nil") + t.Error("Aggregate unexpectedly returned nil") return } agSig := agProj.ToAffine() if agSig.AggregateVerify(false, []*PublicKeyMinPk{zeroKey}, false, [][]byte{msgs[0]}, dstMinPk) { - t.Errorf("failed to NOT verify signature") + t.Error("failed to NOT verify signature") } // Replace firstkey with infinite pubkey. @@ -595,13 +595,13 @@ func TestSignVerifyAggregateValidatesInfinitePubkeyMinPk(t *testing.T) { sigs[0] = zeroSig agProj = new(AggregateSignatureMinPk) if !agProj.Aggregate(sigs, false) { - t.Errorf("Aggregate unexpectedly returned nil") + t.Error("Aggregate unexpectedly returned nil") return } agSig = agProj.ToAffine() if agSig.AggregateVerify(false, pubks, false, msgs, dstMinPk) { - t.Errorf("failed to NOT verify signature") + t.Error("failed to NOT verify signature") } } @@ -616,7 +616,7 @@ func TestEmptyMessageMinPk(t *testing.T) { sig := new(SignatureMinPk).Sign(sk, msg, dstMinPk) if !new(SignatureMinPk).VerifyCompressed(sig.Compress(), true, pk.Compress(), false, msg, dstMinPk) { - t.Errorf("failed to verify empty message") + t.Error("failed to verify empty message") } } @@ -630,7 +630,7 @@ func TestEmptySignatureMinPk(t *testing.T) { pk := new(PublicKeyMinPk).From(sk) var emptySig []byte if new(SignatureMinPk).VerifyCompressed(emptySig, true, pk.Compress(), false, msg, dstMinPk) { - t.Errorf("failed to NOT verify empty signature") + t.Error("failed to NOT verify empty signature") } } @@ -640,7 +640,7 @@ func TestMultiScalarP1(t *testing.T) { scalars := make([]byte, npoints*16) _, err := rand.Read(scalars) if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) return } points := make([]P1, npoints) @@ -653,14 +653,14 @@ func TestMultiScalarP1(t *testing.T) { ref := P1s(refs[:i+1]).Add() ret := P1s(points[:i+1]).Mult(scalars, 128) if !ref.Equals(ret) { - t.Errorf("failed self-consistency multi-scalar test") + t.Error("failed self-consistency multi-scalar test") } } } ref := P1s(refs).Add() ret := P1s(points).Mult(scalars, 128) if !ref.Equals(ret) { - t.Errorf("failed self-consistency multi-scalar test") + t.Error("failed self-consistency multi-scalar test") } } diff --git a/bindings/go/blst_minsig_test.go b/bindings/go/blst_minsig_test.go index f518415d..8549155a 100644 --- a/bindings/go/blst_minsig_test.go +++ b/bindings/go/blst_minsig_test.go @@ -54,13 +54,13 @@ func TestSerdesMinSig(t *testing.T) { sk2 := new(SecretKey).Deserialize(sk.Serialize()) defer sk2.Zeroize() if !sk.Equals(sk2) { - t.Errorf("sk2 != sk") + t.Error("sk2 != sk") } // Negative test equals sk.b[0]++ if sk.Equals(sk2) { - t.Errorf("sk2 == sk") + t.Error("sk2 == sk") } // pk @@ -69,19 +69,19 @@ func TestSerdesMinSig(t *testing.T) { // Compress/decompress sk pk2 := new(PublicKeyMinSig).Uncompress(pk.Compress()) if !pk.Equals(pk2) { - t.Errorf("pk2 != pk") + t.Error("pk2 != pk") } // Serialize/deserialize sk pk3 := new(PublicKeyMinSig).Deserialize(pk.Serialize()) if !pk.Equals(pk3) { - t.Errorf("pk3 != pk") + t.Error("pk3 != pk") } // Negative test equals // pk.x.l[0] = pk.x.l[0] + 1 // if pk.Equals(pk2) { - // t.Errorf("pk2 == pk") + // t.Error("pk2 == pk") // } } @@ -109,27 +109,27 @@ func TestSignVerifyMinSig(t *testing.T) { // Verify if !sig0.Verify(true, pk0, false, msg0, dstMinSig) { - t.Errorf("verify sig0") + t.Error("verify sig0") } if !sig2.Verify(true, pk1, false, msg2, dstMinSig) { - t.Errorf("verify sig2") + t.Error("verify sig2") } if !new(SignatureMinSig).VerifyCompressed(sig2.Compress(), true, pk1.Compress(), false, msg2, dstMinSig) { - t.Errorf("verify sig2") + t.Error("verify sig2") } // Batch verify if !sig0.AggregateVerify(true, []*PublicKeyMinSig{pk0}, false, []Message{msg0}, dstMinSig) { - t.Errorf("aggregate verify sig0") + t.Error("aggregate verify sig0") } // Verify compressed inputs if !new(SignatureMinSig).AggregateVerifyCompressed(sig0.Compress(), true, [][]byte{pk0.Compress()}, false, []Message{msg0}, dstMinSig) { - t.Errorf("aggregate verify sig0 compressed") + t.Error("aggregate verify sig0 compressed") } // Verify serialized inputs @@ -137,26 +137,26 @@ func TestSignVerifyMinSig(t *testing.T) { [][]byte{pk0.Serialize()}, false, []Message{msg0}, dstMinSig) { - t.Errorf("aggregate verify sig0 serialized") + t.Error("aggregate verify sig0 serialized") } // Compressed with empty pk var emptyPk []byte if new(SignatureMinSig).VerifyCompressed(sig0.Compress(), true, emptyPk, false, msg0, dstMinSig) { - t.Errorf("verify sig compressed inputs") + t.Error("verify sig compressed inputs") } // Wrong message if sig0.Verify(true, pk0, false, msg2, dstMinSig) { - t.Errorf("Expected Verify to return false") + t.Error("Expected Verify to return false") } // Wrong key if sig0.Verify(true, pk1, false, msg0, dstMinSig) { - t.Errorf("Expected Verify to return false") + t.Error("Expected Verify to return false") } // Wrong sig if sig2.Verify(true, pk0, false, msg0, dstMinSig) { - t.Errorf("Expected Verify to return false") + t.Error("Expected Verify to return false") } } @@ -168,14 +168,14 @@ func TestSignVerifyAugMinSig(t *testing.T) { aug := []byte("augmentation") sig := new(SignatureMinSig).Sign(sk, msg, dstMinSig, aug) if !sig.Verify(true, pk, false, msg, dstMinSig, aug) { - t.Errorf("verify sig") + t.Error("verify sig") } aug1 := []byte("augmentation2") if sig.Verify(true, pk, false, msg, dstMinSig, aug1) { - t.Errorf("verify sig, wrong augmentation") + t.Error("verify sig, wrong augmentation") } if sig.Verify(true, pk, false, msg, dstMinSig) { - t.Errorf("verify sig, no augmentation") + t.Error("verify sig, no augmentation") } // TODO: augmentation with aggregate verify } @@ -187,13 +187,13 @@ func TestSignVerifyEncodeMinSig(t *testing.T) { msg := []byte("hello foo") sig := new(SignatureMinSig).Sign(sk, msg, dstMinSig, false) if !sig.Verify(true, pk, false, msg, dstMinSig, false) { - t.Errorf("verify sig") + t.Error("verify sig") } if sig.Verify(true, pk, false, msg, dstMinSig) { - t.Errorf("verify sig expected fail, wrong hashing engine") + t.Error("verify sig expected fail, wrong hashing engine") } if sig.Verify(true, pk, false, msg, dstMinSig, 0) { - t.Errorf("verify sig expected fail, illegal argument") + t.Error("verify sig expected fail, illegal argument") } } @@ -203,7 +203,7 @@ func TestSignVerifyAggregateMinSig(t *testing.T) { sks, msgs, _, pubks, _, err := generateBatchTestDataUncompressedMinSig(size) if err { - t.Errorf("Error generating test data") + t.Error("Error generating test data") return } @@ -215,7 +215,7 @@ func TestSignVerifyAggregateMinSig(t *testing.T) { } agProj := new(AggregateSignatureMinSig) if !agProj.Aggregate(sigs, false) { - t.Errorf("Aggregate unexpectedly returned nil") + t.Error("Aggregate unexpectedly returned nil") return } agSig := agProj.ToAffine() @@ -236,7 +236,7 @@ func TestSignVerifyAggregateMinSig(t *testing.T) { } agProj = new(AggregateSignatureMinSig) if !agProj.AggregateCompressed(compSigs, false) { - t.Errorf("AggregateCompressed unexpectedly returned nil") + t.Error("AggregateCompressed unexpectedly returned nil") return } agSig = agProj.ToAffine() @@ -287,7 +287,7 @@ func TestSignMultipleVerifyAggregateMinSig(t *testing.T) { agSig := new(AggregateSignatureMinSig) if !agSig.Aggregate(sigsToAgg, true) { - t.Errorf("failed to aggregate") + t.Error("failed to aggregate") } afSig := agSig.ToAffine() agPk := new(AggregatePublicKeyMinSig) @@ -307,7 +307,7 @@ func TestSignMultipleVerifyAggregateMinSig(t *testing.T) { var rbytes [BLST_SCALAR_BYTES]byte _, err := rand.Read(rbytes[:]) if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) } s.FromBEndian(rbytes[:]) } @@ -569,7 +569,7 @@ func TestSignVerifyAggregateValidatesInfinitePubkeyMinSig(t *testing.T) { sks, msgs, _, pubks, _, err := generateBatchTestDataUncompressedMinSig(size) if err { - t.Errorf("Error generating test data") + t.Error("Error generating test data") return } @@ -584,14 +584,14 @@ func TestSignVerifyAggregateValidatesInfinitePubkeyMinSig(t *testing.T) { zeroSig := new(SignatureMinSig) agProj := new(AggregateSignatureMinSig) if !agProj.Aggregate([]*SignatureMinSig{zeroSig}, false) { - t.Errorf("Aggregate unexpectedly returned nil") + t.Error("Aggregate unexpectedly returned nil") return } agSig := agProj.ToAffine() if agSig.AggregateVerify(false, []*PublicKeyMinSig{zeroKey}, false, [][]byte{msgs[0]}, dstMinSig) { - t.Errorf("failed to NOT verify signature") + t.Error("failed to NOT verify signature") } // Replace firstkey with infinite pubkey. @@ -599,13 +599,13 @@ func TestSignVerifyAggregateValidatesInfinitePubkeyMinSig(t *testing.T) { sigs[0] = zeroSig agProj = new(AggregateSignatureMinSig) if !agProj.Aggregate(sigs, false) { - t.Errorf("Aggregate unexpectedly returned nil") + t.Error("Aggregate unexpectedly returned nil") return } agSig = agProj.ToAffine() if agSig.AggregateVerify(false, pubks, false, msgs, dstMinSig) { - t.Errorf("failed to NOT verify signature") + t.Error("failed to NOT verify signature") } } @@ -620,7 +620,7 @@ func TestEmptyMessageMinSig(t *testing.T) { sig := new(SignatureMinSig).Sign(sk, msg, dstMinSig) if !new(SignatureMinSig).VerifyCompressed(sig.Compress(), true, pk.Compress(), false, msg, dstMinSig) { - t.Errorf("failed to verify empty message") + t.Error("failed to verify empty message") } } @@ -634,7 +634,7 @@ func TestEmptySignatureMinSig(t *testing.T) { pk := new(PublicKeyMinSig).From(sk) var emptySig []byte if new(SignatureMinSig).VerifyCompressed(emptySig, true, pk.Compress(), false, msg, dstMinSig) { - t.Errorf("failed to NOT verify empty signature") + t.Error("failed to NOT verify empty signature") } } @@ -644,7 +644,7 @@ func TestMultiScalarP2(t *testing.T) { scalars := make([]byte, npoints*16) _, err := rand.Read(scalars) if err != nil { - t.Errorf(err.Error()) + t.Error(err.Error()) return } points := make([]P2, npoints) @@ -657,14 +657,14 @@ func TestMultiScalarP2(t *testing.T) { ref := P2s(refs[:i+1]).Add() ret := P2s(points[:i+1]).Mult(scalars, 128) if !ref.Equals(ret) { - t.Errorf("failed self-consistency multi-scalar test") + t.Error("failed self-consistency multi-scalar test") } } } ref := P2s(refs).Add() ret := P2s(points).Mult(scalars, 128) if !ref.Equals(ret) { - t.Errorf("failed self-consistency multi-scalar test") + t.Error("failed self-consistency multi-scalar test") } }