Skip to content

Commit

Permalink
crypto/rsa: use BoringCrypto for 4096 bit keys
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
FiloSottile committed May 17, 2023
1 parent 547aed1 commit 7bc3281
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/crypto/rsa/rsa.go
Expand Up @@ -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
Expand Down

0 comments on commit 7bc3281

Please sign in to comment.