Skip to content

Commit b86e774

Browse files
authored
Go 1.22.0 (#160)
* Go 1.22rc1 * fix formatting on patch * fix build * remove uneccesary patch in 000 initial patch * Support 1.22.0 * Update openssl backend * skip test due to change in openssl * review feedback * fix test run in ./all.bash
1 parent 56ac3db commit b86e774

11 files changed

+595
-251
lines changed

config/versions.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"github.com/golang-fips/go": "main",
3-
"github.com/golang-fips/openssl": "41b6eb24da2819f9ebf7818b82a0da94dc3ae309",
4-
"github.com/golang/go": "go1.21.4"
5-
}
3+
"github.com/golang-fips/openssl": "576fe0d377882f8d0fd6537762ef2ff7918facc8",
4+
"github.com/golang/go": "go1.22.0"
5+
}

patches/000-initial-setup.patch

+18-70
Original file line numberDiff line numberDiff line change
@@ -880,25 +880,29 @@ index 3278a7ff30..b994daec19 100644
880880
priv := new(PrivateKey)
881881
priv.PublicKey = PublicKey{N: n, E: test.e}
882882
diff --git a/src/crypto/tls/boring.go b/src/crypto/tls/boring.go
883-
index 1827f76458..140b1a3dd8 100644
883+
index aad96b1c74..bbf3d38339 100644
884884
--- a/src/crypto/tls/boring.go
885885
+++ 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 (
890894
+ boring "crypto/internal/backend"
891-
)
892-
895+
+ "crypto/internal/boring/fipstls"
896+
+)
897+
+
893898
+func init() {
894-
+ if boring.Enabled && !boring.ExecutingTest() {
895-
+ fipstls.Force()
896-
+ }
899+
+ if boring.Enabled && !boring.ExecutingTest() {
900+
+ fipstls.Force()
901+
+ }
897902
+}
898-
+
903+
899904
// needFIPS returns fipstls.Required(); it avoids a new import in common.go.
900905
func needFIPS() bool {
901-
return fipstls.Required()
902906
@@ -17,14 +24,18 @@ func needFIPS() bool {
903907

904908
// fipsMinVersion replaces c.minVersion in FIPS-only mode.
@@ -953,7 +957,7 @@ index ba68f355eb..7bfe3f9417 100644
953957
test("VersionTLS12", VersionTLS12, "")
954958
- test("VersionTLS13", VersionTLS13, "client offered only unsupported versions")
955959
+ if boring.SupportsHKDF() {
956-
+ test("VersionTLS13", VersionTLS13, "")
960+
+ test("VersionTLS13/fipstls", VersionTLS13, "")
957961
+ }
958962
}
959963

@@ -963,17 +967,6 @@ index ba68f355eb..7bfe3f9417 100644
963967
}
964968

965969
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
977970
@@ -226,7 +236,14 @@ func TestBoringServerSignatureAndHash(t *testing.T) {
978971
// 1.3, and the ECDSA ones bind to the curve used.
979972
serverConfig.MaxVersion = VersionTLS12
@@ -1165,21 +1158,6 @@ index 5394d64ac6..db4e2dbf60 100644
11651158
if needFIPS() && (v < fipsMinVersion(c) || v > fipsMaxVersion(c)) {
11661159
continue
11671160
}
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...)
11831161
diff --git a/src/crypto/tls/handshake_client_test.go b/src/crypto/tls/handshake_client_test.go
11841162
index 22be38faff..d460eeb880 100644
11851163
--- a/src/crypto/tls/handshake_client_test.go
@@ -1192,36 +1170,6 @@ index 22be38faff..d460eeb880 100644
11921170
c, s := localPipe(t)
11931171
done := make(chan bool)
11941172

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
12251173
diff --git a/src/crypto/tls/key_schedule.go b/src/crypto/tls/key_schedule.go
12261174
index ae8f80a7cf..30a8450f40 100644
12271175
--- a/src/crypto/tls/key_schedule.go
@@ -1532,7 +1480,7 @@ index 780b481de8..63db9e9ed7 100644
15321480
+ map2.Offset = (addr2 - map2.Start) + map2.Offset
15331481
+ map2.Start = addr2
15341482
map2.BuildID, _ = elfBuildID(map2.File)
1535-
case "windows":
1483+
case "windows", "darwin", "ios":
15361484
addr1 = uint64(abi.FuncPCABIInternal(f1))
15371485
@@ -145,6 +150,29 @@ func testPCs(t *testing.T) (addr1, addr2 uint64, map1, map2 *profile.Mapping) {
15381486
return

0 commit comments

Comments
 (0)