@@ -880,25 +880,29 @@ index 3278a7ff30..b994daec19 100644
880
880
priv := new(PrivateKey)
881
881
priv.PublicKey = PublicKey{N: n, E: test.e}
882
882
diff --git a/src/crypto/tls/boring.go b/src/crypto/tls/boring.go
883
- index 1827f76458..140b1a3dd8 100644
883
+ index aad96b1c74..bbf3d38339 100644
884
884
--- a/src/crypto/tls/boring.go
885
885
+++ b/src/crypto/tls/boring.go
886
- @@ -8,8 +8,15 @@ package tls
887
-
888
- import (
889
- "crypto/internal/boring/fipstls"
886
+ @@ -6,9 +6,16 @@
887
+
888
+ package tls
889
+
890
+ - import (
891
+ - "crypto/internal/boring/fipstls"
892
+ - )
893
+ + import (
890
894
+ boring "crypto/internal/backend"
891
- )
892
-
895
+ + "crypto/internal/boring/fipstls"
896
+ + )
897
+ +
893
898
+ func init() {
894
- + if boring.Enabled && !boring.ExecutingTest() {
895
- + fipstls.Force()
896
- + }
899
+ + if boring.Enabled && !boring.ExecutingTest() {
900
+ + fipstls.Force()
901
+ + }
897
902
+ }
898
- +
903
+
899
904
// needFIPS returns fipstls.Required(); it avoids a new import in common.go.
900
905
func needFIPS() bool {
901
- return fipstls.Required()
902
906
@@ -17,14 +24,18 @@ func needFIPS() bool {
903
907
904
908
// fipsMinVersion replaces c.minVersion in FIPS-only mode.
@@ -953,7 +957,7 @@ index ba68f355eb..7bfe3f9417 100644
953
957
test("VersionTLS12", VersionTLS12, "")
954
958
- test("VersionTLS13", VersionTLS13, "client offered only unsupported versions")
955
959
+ if boring.SupportsHKDF() {
956
- + test("VersionTLS13", VersionTLS13, "")
960
+ + test("VersionTLS13/fipstls ", VersionTLS13, "")
957
961
+ }
958
962
}
959
963
@@ -963,17 +967,6 @@ index ba68f355eb..7bfe3f9417 100644
963
967
}
964
968
965
969
func isBoringCipherSuite(id uint16) bool {
966
- @@ -66,7 +74,9 @@ func isBoringCipherSuite(id uint16) bool {
967
- TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
968
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
969
- TLS_RSA_WITH_AES_128_GCM_SHA256,
970
- - TLS_RSA_WITH_AES_256_GCM_SHA384:
971
- + TLS_RSA_WITH_AES_256_GCM_SHA384,
972
- + TLS_AES_128_GCM_SHA256,
973
- + TLS_AES_256_GCM_SHA384:
974
- return true
975
- }
976
- return false
977
970
@@ -226,7 +236,14 @@ func TestBoringServerSignatureAndHash(t *testing.T) {
978
971
// 1.3, and the ECDSA ones bind to the curve used.
979
972
serverConfig.MaxVersion = VersionTLS12
@@ -1165,21 +1158,6 @@ index 5394d64ac6..db4e2dbf60 100644
1165
1158
if needFIPS() && (v < fipsMinVersion(c) || v > fipsMaxVersion(c)) {
1166
1159
continue
1167
1160
}
1168
- diff --git a/src/crypto/tls/handshake_client.go b/src/crypto/tls/handshake_client.go
1169
- index 63d86b9f3a..a8ee915041 100644
1170
- --- a/src/crypto/tls/handshake_client.go
1171
- +++ b/src/crypto/tls/handshake_client.go
1172
- @@ -127,7 +127,9 @@ func (c *Conn) makeClientHello() (*clientHelloMsg, *ecdh.PrivateKey, error) {
1173
- if len(hello.supportedVersions) == 1 {
1174
- hello.cipherSuites = nil
1175
- }
1176
- - if hasAESGCMHardwareSupport {
1177
- + if needFIPS() {
1178
- + hello.cipherSuites = append(hello.cipherSuites, defaultFIPSCipherSuitesTLS13...)
1179
- + } else if hasAESGCMHardwareSupport {
1180
- hello.cipherSuites = append(hello.cipherSuites, defaultCipherSuitesTLS13...)
1181
- } else {
1182
- hello.cipherSuites = append(hello.cipherSuites, defaultCipherSuitesTLS13NoAES...)
1183
1161
diff --git a/src/crypto/tls/handshake_client_test.go b/src/crypto/tls/handshake_client_test.go
1184
1162
index 22be38faff..d460eeb880 100644
1185
1163
--- a/src/crypto/tls/handshake_client_test.go
@@ -1192,36 +1170,6 @@ index 22be38faff..d460eeb880 100644
1192
1170
c, s := localPipe(t)
1193
1171
done := make(chan bool)
1194
1172
1195
- diff --git a/src/crypto/tls/handshake_client_tls13.go b/src/crypto/tls/handshake_client_tls13.go
1196
- index 4a8661085e..87fe11de5c 100644
1197
- --- a/src/crypto/tls/handshake_client_tls13.go
1198
- +++ b/src/crypto/tls/handshake_client_tls13.go
1199
- @@ -41,10 +41,6 @@ type clientHandshakeStateTLS13 struct {
1200
- func (hs *clientHandshakeStateTLS13) handshake() error {
1201
- c := hs.c
1202
-
1203
- - if needFIPS() {
1204
- - return errors.New("tls: internal error: TLS 1.3 reached in FIPS mode")
1205
- - }
1206
- -
1207
- // The server must not select TLS 1.3 in a renegotiation. See RFC 8446,
1208
- // sections 4.1.2 and 4.1.3.
1209
- if c.handshakes > 0 {
1210
- diff --git a/src/crypto/tls/handshake_server_tls13.go b/src/crypto/tls/handshake_server_tls13.go
1211
- index b7b568cd84..af75e7dbe0 100644
1212
- --- a/src/crypto/tls/handshake_server_tls13.go
1213
- +++ b/src/crypto/tls/handshake_server_tls13.go
1214
- @@ -44,10 +44,6 @@ type serverHandshakeStateTLS13 struct {
1215
- func (hs *serverHandshakeStateTLS13) handshake() error {
1216
- c := hs.c
1217
-
1218
- - if needFIPS() {
1219
- - return errors.New("tls: internal error: TLS 1.3 reached in FIPS mode")
1220
- - }
1221
- -
1222
- // For an overview of the TLS 1.3 handshake, see RFC 8446, Section 2.
1223
- if err := hs.processClientHello(); err != nil {
1224
- return err
1225
1173
diff --git a/src/crypto/tls/key_schedule.go b/src/crypto/tls/key_schedule.go
1226
1174
index ae8f80a7cf..30a8450f40 100644
1227
1175
--- a/src/crypto/tls/key_schedule.go
@@ -1532,7 +1480,7 @@ index 780b481de8..63db9e9ed7 100644
1532
1480
+ map2.Offset = (addr2 - map2.Start) + map2.Offset
1533
1481
+ map2.Start = addr2
1534
1482
map2.BuildID, _ = elfBuildID(map2.File)
1535
- case "windows":
1483
+ case "windows", "darwin", "ios" :
1536
1484
addr1 = uint64(abi.FuncPCABIInternal(f1))
1537
1485
@@ -145,6 +150,29 @@ func testPCs(t *testing.T) (addr1, addr2 uint64, map1, map2 *profile.Mapping) {
1538
1486
return
0 commit comments