]> Cypherpunks repositories - gostls13.git/commit
crypto: use provided random Reader in FIPS mode
authorFilippo Valsorda <filippo@golang.org>
Wed, 11 Dec 2024 13:50:00 +0000 (14:50 +0100)
committerGopher Robot <gobot@golang.org>
Wed, 11 Dec 2024 21:26:50 +0000 (13:26 -0800)
commitc93477b5e563dd0ed7b45fd519762f24b7cfa7b0
treeb5ed6ef40501cba83645e0dfc0408516fa9ce807
parent3104b6adbb36a43284f51ab0cb67c44f8ba75fac
crypto: use provided random Reader in FIPS mode

This removes the difference in behavior between FIPS mode on and off.

Instead of the sentinel type we could have moved the Reader to the
drbg package and checked for equality, but then we would have locked the
crypto/rand.Reader implementation to the one in the FIPS module (which
we might have to support for years).

In internal/ed25519.GenerateKey we remove the random parameter entirely,
since that function is not actually used by crypto/ed25519.GenerateKey,
which instead commits to being deterministic.

Fixes #70772

Change-Id: Ic1c7ca2c1cd59eb9cd090a8b235c0ce218921ac5
Reviewed-on: https://go-review.googlesource.com/c/go/+/635195
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
15 files changed:
src/crypto/ecdh/nist.go
src/crypto/ecdsa/ecdsa.go
src/crypto/internal/fips140/drbg/rand.go
src/crypto/internal/fips140/ecdh/ecdh.go
src/crypto/internal/fips140/ecdsa/cast.go
src/crypto/internal/fips140/ecdsa/ecdsa.go
src/crypto/internal/fips140/ed25519/ed25519.go
src/crypto/internal/fips140/rsa/keygen.go
src/crypto/internal/fips140/rsa/pkcs1v22.go
src/crypto/internal/fips140only/fips140only.go
src/crypto/internal/fips140test/cast_test.go
src/crypto/rand/rand.go
src/crypto/rsa/fips.go
src/crypto/rsa/rsa.go
src/crypto/rsa/rsa_test.go