Skip to content

Commit f241e00

Browse files
committed
[dev.boringcrypto.go1.18] crypto/tls: allow BoringCrypto to use 4096-bit keys
FIPS-140 has been updated to allow 4096-bit RSA keys. Allow them in certificate processing. This is the Go 1.18 boringcrypto branch version of CL 447655. Not a straight cherry-pick, because the code in the boringcrypto branch is different from the code that merged into the main branch. Fixes #41147 for the Go 1.18 boringcrypto branch. Change-Id: Iae8a6406a2885e6546df2c28c1791c19cfafb6b5 Reviewed-on: https://go-review.googlesource.com/c/go/+/449639 Run-TryBot: Russ Cox <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Roland Shoemaker <[email protected]>
1 parent 94108e2 commit f241e00

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/crypto/tls/boring.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func isBoringCertificate(c *x509.Certificate) bool {
9191
default:
9292
return false
9393
case *rsa.PublicKey:
94-
if size := k.N.BitLen(); size != 2048 && size != 3072 {
94+
if size := k.N.BitLen(); size != 2048 && size != 3072 && size != 4096 {
9595
return false
9696
}
9797
case *ecdsa.PublicKey:

src/crypto/tls/boring_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ func TestBoringCertAlgs(t *testing.T) {
309309
// Set up some roots, intermediate CAs, and leaf certs with various algorithms.
310310
// X_Y is X signed by Y.
311311
R1 := boringCert(t, "R1", boringRSAKey(t, 2048), nil, boringCertCA|boringCertFIPSOK)
312-
R2 := boringCert(t, "R2", boringRSAKey(t, 4096), nil, boringCertCA)
312+
R2 := boringCert(t, "R2", boringRSAKey(t, 1024), nil, boringCertCA)
313313

314314
M1_R1 := boringCert(t, "M1_R1", boringECDSAKey(t, elliptic.P256()), R1, boringCertCA|boringCertFIPSOK)
315315
M2_R1 := boringCert(t, "M2_R1", boringECDSAKey(t, elliptic.P224()), R1, boringCertCA)

0 commit comments

Comments
 (0)