]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/internal/fips140/entropy: increase AllocsPerRun iterations
authorqmuntal <quimmuntal@gmail.com>
Fri, 17 Oct 2025 10:40:05 +0000 (12:40 +0200)
committerGopher Robot <gobot@golang.org>
Tue, 21 Oct 2025 15:42:07 +0000 (08:42 -0700)
TestNISTECAllocations is flaky (~1% failure rate) on my local Windows
machine since CL 710058, which touched TestEntropyRace.

These tests are unrelated, but some allocations might be incorrectly
accounted to TestNISTECAllocations, affecting the end result due to
the low number of iterations done in that test.

Change-Id: I01323c2a45b12665e86d940467f4f91c2e66696b
Reviewed-on: https://go-review.googlesource.com/c/go/+/712620
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/crypto/internal/fips140test/nistec_test.go
src/crypto/internal/fips140test/xaes_test.go

index 3b3de2bc2cb1f68bb0980a853f321f38e7ebede9..9b4b7cba7fa3e7e8fee6181dff2cae9ca470fd20 100644 (file)
@@ -18,7 +18,7 @@ import (
 func TestNISTECAllocations(t *testing.T) {
        cryptotest.SkipTestAllocations(t)
        t.Run("P224", func(t *testing.T) {
-               if allocs := testing.AllocsPerRun(10, func() {
+               if allocs := testing.AllocsPerRun(100, func() {
                        p := nistec.NewP224Point().SetGenerator()
                        scalar := make([]byte, 28)
                        rand.Read(scalar)
@@ -37,7 +37,7 @@ func TestNISTECAllocations(t *testing.T) {
                }
        })
        t.Run("P256", func(t *testing.T) {
-               if allocs := testing.AllocsPerRun(10, func() {
+               if allocs := testing.AllocsPerRun(100, func() {
                        p := nistec.NewP256Point().SetGenerator()
                        scalar := make([]byte, 32)
                        rand.Read(scalar)
@@ -56,7 +56,7 @@ func TestNISTECAllocations(t *testing.T) {
                }
        })
        t.Run("P384", func(t *testing.T) {
-               if allocs := testing.AllocsPerRun(10, func() {
+               if allocs := testing.AllocsPerRun(100, func() {
                        p := nistec.NewP384Point().SetGenerator()
                        scalar := make([]byte, 48)
                        rand.Read(scalar)
@@ -75,7 +75,7 @@ func TestNISTECAllocations(t *testing.T) {
                }
        })
        t.Run("P521", func(t *testing.T) {
-               if allocs := testing.AllocsPerRun(10, func() {
+               if allocs := testing.AllocsPerRun(100, func() {
                        p := nistec.NewP521Point().SetGenerator()
                        scalar := make([]byte, 66)
                        rand.Read(scalar)
index 9406bfab7bf5cc95c4de8290f5330eae5f203736..c852832fcea71322befdd22be043669dc5ca8207 100644 (file)
@@ -21,7 +21,7 @@ func TestXAESAllocations(t *testing.T) {
                t.Skip("Test reports non-zero allocation count. See issue #70448")
        }
        cryptotest.SkipTestAllocations(t)
-       if allocs := testing.AllocsPerRun(10, func() {
+       if allocs := testing.AllocsPerRun(100, func() {
                key := make([]byte, 32)
                nonce := make([]byte, 24)
                plaintext := make([]byte, 16)