1
0
mirror of https://github.com/golang/go synced 2024-11-23 00:00:07 -07:00

crypto/rsa: use BoringCrypto for 4096 bit keys

Fixes #58803

Change-Id: I097938ff61dae2b65214f8d0126d68de63525f5b
Reviewed-on: https://go-review.googlesource.com/c/go/+/474515
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
This commit is contained in:
Filippo Valsorda 2023-03-08 17:35:30 +01:00
parent 547aed18e0
commit 7bc3281747

View File

@ -286,7 +286,8 @@ func GenerateKey(random io.Reader, bits int) (*PrivateKey, error) {
func GenerateMultiPrimeKey(random io.Reader, nprimes int, bits int) (*PrivateKey, error) {
randutil.MaybeReadByte(random)
if boring.Enabled && random == boring.RandReader && nprimes == 2 && (bits == 2048 || bits == 3072) {
if boring.Enabled && random == boring.RandReader && nprimes == 2 &&
(bits == 2048 || bits == 3072 || bits == 4096) {
bN, bE, bD, bP, bQ, bDp, bDq, bQinv, err := boring.GenerateKeyRSA(bits)
if err != nil {
return nil, err