@@ -820,7 +820,7 @@ index 51f9760187..eceb31aa71 100644
820820 t.Fatal(err)
821821 }
822822diff --git a/src/crypto/rsa/rsa_test.go b/src/crypto/rsa/rsa_test.go
823- index 766d9a954f..7d24a08882 100644
823+ index 766d9a954f..ef84e75b04 100644
824824--- a/src/crypto/rsa/rsa_test.go
825825+++ b/src/crypto/rsa/rsa_test.go
826826@@ -16,6 +16,7 @@ import (
@@ -875,8 +875,8 @@ index 766d9a954f..7d24a08882 100644
875875 n := new(big.Int)
876876 for i, test := range testEncryptOAEPData {
877877 n.SetString(test.modulus, 16)
878- + if boring.Enabled && !boringtest.Supports(t, "RSA1024") && n.BitLen() < 2048 {
879- + t.Logf ("skipping encryption tests with BoringCrypto: too short key: %d", n.BitLen() )
878+ + if boring.Enabled {
879+ + t.Log ("skipping test in FIPS mode due to short keys and unpadded RSA operations not allowed with FIPS" )
880880+ continue
881881+ }
882882 public := PublicKey{N: n, E: test.e}
@@ -947,7 +947,7 @@ index 1827f76458..140b1a3dd8 100644
947947
948948 // default defaultFIPSCurvePreferences is the FIPS-allowed curves,
949949diff --git a/src/crypto/tls/boring_test.go b/src/crypto/tls/boring_test.go
950- index ba68f355eb..8ddd2526c7 100644
950+ index ba68f355eb..7bfe3f9417 100644
951951--- a/src/crypto/tls/boring_test.go
952952+++ b/src/crypto/tls/boring_test.go
953953@@ -9,6 +9,8 @@ package tls
@@ -999,7 +999,23 @@ index ba68f355eb..8ddd2526c7 100644
999999 return true
10001000 }
10011001 return false
1002- @@ -315,15 +325,31 @@ func TestBoringCertAlgs(t *testing.T) {
1002+ @@ -226,7 +236,14 @@ func TestBoringServerSignatureAndHash(t *testing.T) {
1003+ // 1.3, and the ECDSA ones bind to the curve used.
1004+ serverConfig.MaxVersion = VersionTLS12
1005+
1006+ - clientErr, serverErr := boringHandshake(t, testConfig, serverConfig)
1007+ + clientConfig := testConfig.Clone()
1008+ +
1009+ + if boring.Enabled {
1010+ + serverConfig.Rand = boring.RandReader
1011+ + clientConfig.Rand = boring.RandReader
1012+ + }
1013+ +
1014+ + clientErr, serverErr := boringHandshake(t, clientConfig, serverConfig)
1015+ if clientErr != nil {
1016+ t.Fatalf("expected handshake with %#x to succeed; client error: %v; server error: %v", sigHash, clientErr, serverErr)
1017+ }
1018+ @@ -315,15 +332,31 @@ func TestBoringCertAlgs(t *testing.T) {
10031019 R2 := boringCert(t, "R2", boringRSAKey(t, 512), nil, boringCertCA)
10041020
10051021 M1_R1 := boringCert(t, "M1_R1", boringECDSAKey(t, elliptic.P256()), R1, boringCertCA|boringCertFIPSOK)
@@ -1034,19 +1050,36 @@ index ba68f355eb..8ddd2526c7 100644
10341050
10351051 // client verifying server cert
10361052 testServerCert := func(t *testing.T, desc string, pool *x509.CertPool, key interface{}, list [][]byte, ok bool) {
1037- @@ -362,6 +388,11 @@ func TestBoringCertAlgs(t *testing.T) {
1053+ @@ -336,6 +369,11 @@ func TestBoringCertAlgs(t *testing.T) {
1054+ serverConfig.Certificates = []Certificate{{Certificate: list, PrivateKey: key}}
1055+ serverConfig.BuildNameToCertificate()
1056+
1057+ + if boring.Enabled {
1058+ + serverConfig.Rand = boring.RandReader
1059+ + clientConfig.Rand = boring.RandReader
1060+ + }
1061+ +
1062+ clientErr, _ := boringHandshake(t, clientConfig, serverConfig)
1063+
1064+ if (clientErr == nil) == ok {
1065+ @@ -362,6 +400,16 @@ func TestBoringCertAlgs(t *testing.T) {
10381066 serverConfig := testConfig.Clone()
10391067 serverConfig.ClientCAs = pool
10401068 serverConfig.ClientAuth = RequireAndVerifyClientCert
10411069+ if boring.Enabled {
10421070+ serverConfig.Certificates[0].Certificate = [][]byte{testRSA2048Certificate}
10431071+ serverConfig.Certificates[0].PrivateKey = testRSA2048PrivateKey
10441072+ serverConfig.BuildNameToCertificate()
1073+ + }
1074+ +
1075+ + if boring.Enabled {
1076+ + serverConfig.Rand = boring.RandReader
1077+ + clientConfig.Rand = boring.RandReader
10451078+ }
10461079
10471080 _, serverErr := boringHandshake(t, clientConfig, serverConfig)
10481081
1049- @@ -384,8 +415 ,8 @@ func TestBoringCertAlgs(t *testing.T) {
1082+ @@ -384,8 +432 ,8 @@ func TestBoringCertAlgs(t *testing.T) {
10501083 // exhaustive test with computed answers.
10511084 r1pool := x509.NewCertPool()
10521085 r1pool.AddCert(R1.cert)
@@ -1057,7 +1090,7 @@ index ba68f355eb..8ddd2526c7 100644
10571090 fipstls.Force()
10581091 testServerCert(t, "basic (fips)", r1pool, L2_I.key, [][]byte{L2_I.der, I_R1.der}, false)
10591092 testClientCert(t, "basic (fips, client cert)", r1pool, L2_I.key, [][]byte{L2_I.der, I_R1.der}, false)
1060- @@ -406,7 +437 ,7 @@ func TestBoringCertAlgs(t *testing.T) {
1093+ @@ -406,7 +454 ,7 @@ func TestBoringCertAlgs(t *testing.T) {
10611094 leaf = L2_I
10621095 }
10631096 for i := 0; i < 64; i++ {
@@ -1066,7 +1099,7 @@ index ba68f355eb..8ddd2526c7 100644
10661099 reachableFIPS := map[string]bool{leaf.parentOrg: leaf.fipsOK}
10671100 list := [][]byte{leaf.der}
10681101 listName := leaf.name
1069- @@ -414,7 +445 ,7 @@ func TestBoringCertAlgs(t *testing.T) {
1102+ @@ -414,7 +462 ,7 @@ func TestBoringCertAlgs(t *testing.T) {
10701103 if cond != 0 {
10711104 list = append(list, c.der)
10721105 listName += "," + c.name
@@ -1075,7 +1108,7 @@ index ba68f355eb..8ddd2526c7 100644
10751108 reachable[c.parentOrg] = true
10761109 }
10771110 if reachableFIPS[c.org] && c.fipsOK {
1078- @@ -438,7 +469 ,7 @@ func TestBoringCertAlgs(t *testing.T) {
1111+ @@ -438,7 +486 ,7 @@ func TestBoringCertAlgs(t *testing.T) {
10791112 if cond != 0 {
10801113 rootName += "," + c.name
10811114 pool.AddCert(c.cert)
@@ -1084,23 +1117,23 @@ index ba68f355eb..8ddd2526c7 100644
10841117 shouldVerify = true
10851118 }
10861119 if reachableFIPS[c.org] && c.fipsOK {
1087- @@ -464,6 +495 ,7 @@ const (
1120+ @@ -464,6 +512 ,7 @@ const (
10881121 boringCertCA = iota
10891122 boringCertLeaf
10901123 boringCertFIPSOK = 0x80
10911124+ boringCertNotBoring = 0x100
10921125 )
10931126
10941127 func boringRSAKey(t *testing.T, size int) *rsa.PrivateKey {
1095- @@ -490,6 +522 ,7 @@ type boringCertificate struct {
1128+ @@ -490,6 +539 ,7 @@ type boringCertificate struct {
10961129 cert *x509.Certificate
10971130 key interface{}
10981131 fipsOK bool
10991132+ notBoring bool
11001133 }
11011134
11021135 func boringCert(t *testing.T, name string, key interface{}, parent *boringCertificate, mode int) *boringCertificate {
1103- @@ -511,7 +544 ,7 @@ func boringCert(t *testing.T, name string, key interface{}, parent *boringCertif
1136+ @@ -511,7 +561 ,7 @@ func boringCert(t *testing.T, name string, key interface{}, parent *boringCertif
11041137 ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth},
11051138 BasicConstraintsValid: true,
11061139 }
@@ -1109,7 +1142,7 @@ index ba68f355eb..8ddd2526c7 100644
11091142 tmpl.DNSNames = []string{"example.com"}
11101143 } else {
11111144 tmpl.IsCA = true
1112- @@ -548,7 +581 ,8 @@ func boringCert(t *testing.T, name string, key interface{}, parent *boringCertif
1145+ @@ -548,7 +598 ,8 @@ func boringCert(t *testing.T, name string, key interface{}, parent *boringCertif
11131146 }
11141147
11151148 fipsOK := mode&boringCertFIPSOK != 0
@@ -1173,10 +1206,10 @@ index 898d2e9af6..553dc02446 100644
11731206 } else {
11741207 hello.cipherSuites = append(hello.cipherSuites, defaultCipherSuitesTLS13NoAES...)
11751208diff --git a/src/crypto/tls/handshake_client_test.go b/src/crypto/tls/handshake_client_test.go
1176- index 749c9fc954..2e37a1867c 100644
1209+ index 22be38faff..d460eeb880 100644
11771210--- a/src/crypto/tls/handshake_client_test.go
11781211+++ b/src/crypto/tls/handshake_client_test.go
1179- @@ -2135 ,6 +2135 ,7 @@ func testBuffering(t *testing.T, version uint16) {
1212+ @@ -2156 ,6 +2156 ,7 @@ func testBuffering(t *testing.T, version uint16) {
11801213 }
11811214
11821215 func TestAlertFlushing(t *testing.T) {
@@ -1185,7 +1218,7 @@ index 749c9fc954..2e37a1867c 100644
11851218 done := make(chan bool)
11861219
11871220diff --git a/src/crypto/tls/handshake_client_tls13.go b/src/crypto/tls/handshake_client_tls13.go
1188- index 0f2dee42de..b7a087eea9 100644
1221+ index f32d71c191..8dd1e30192 100644
11891222--- a/src/crypto/tls/handshake_client_tls13.go
11901223+++ b/src/crypto/tls/handshake_client_tls13.go
11911224@@ -41,10 +41,6 @@ type clientHandshakeStateTLS13 struct {
0 commit comments