crypto/internal/fips140/entropy: increase AllocsPerRun iterations

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>
This commit is contained in:
qmuntal 2025-10-17 12:40:05 +02:00 committed by Gopher Robot
parent 306eacbc11
commit 2163a58021
2 changed files with 5 additions and 5 deletions

View file

@ -18,7 +18,7 @@ import (
func TestNISTECAllocations(t *testing.T) { func TestNISTECAllocations(t *testing.T) {
cryptotest.SkipTestAllocations(t) cryptotest.SkipTestAllocations(t)
t.Run("P224", func(t *testing.T) { t.Run("P224", func(t *testing.T) {
if allocs := testing.AllocsPerRun(10, func() { if allocs := testing.AllocsPerRun(100, func() {
p := nistec.NewP224Point().SetGenerator() p := nistec.NewP224Point().SetGenerator()
scalar := make([]byte, 28) scalar := make([]byte, 28)
rand.Read(scalar) rand.Read(scalar)
@ -37,7 +37,7 @@ func TestNISTECAllocations(t *testing.T) {
} }
}) })
t.Run("P256", func(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() p := nistec.NewP256Point().SetGenerator()
scalar := make([]byte, 32) scalar := make([]byte, 32)
rand.Read(scalar) rand.Read(scalar)
@ -56,7 +56,7 @@ func TestNISTECAllocations(t *testing.T) {
} }
}) })
t.Run("P384", func(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() p := nistec.NewP384Point().SetGenerator()
scalar := make([]byte, 48) scalar := make([]byte, 48)
rand.Read(scalar) rand.Read(scalar)
@ -75,7 +75,7 @@ func TestNISTECAllocations(t *testing.T) {
} }
}) })
t.Run("P521", func(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() p := nistec.NewP521Point().SetGenerator()
scalar := make([]byte, 66) scalar := make([]byte, 66)
rand.Read(scalar) rand.Read(scalar)

View file

@ -21,7 +21,7 @@ func TestXAESAllocations(t *testing.T) {
t.Skip("Test reports non-zero allocation count. See issue #70448") t.Skip("Test reports non-zero allocation count. See issue #70448")
} }
cryptotest.SkipTestAllocations(t) cryptotest.SkipTestAllocations(t)
if allocs := testing.AllocsPerRun(10, func() { if allocs := testing.AllocsPerRun(100, func() {
key := make([]byte, 32) key := make([]byte, 32)
nonce := make([]byte, 24) nonce := make([]byte, 24)
plaintext := make([]byte, 16) plaintext := make([]byte, 16)