Skip to content

Commit db85a0e

Browse files
committed
crypto/tls: Support TLS 1.3 and Ed25519 signature algorithm in FIPS-mode
TLS 1.3 is permitted by NIST SP 800-52 Rev. 2 and will be required starting January 1, 2024. Ed25519 as a signature algorithm is permitted by FIPS 186-5. Fixes #62372.
1 parent 1f8f2ab commit db85a0e

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

src/crypto/tls/boring.go

+10-4
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,19 @@ func needFIPS() bool {
1717

1818
// fipsMinVersion replaces c.minVersion in FIPS-only mode.
1919
func fipsMinVersion(c *Config) uint16 {
20-
// FIPS requires TLS 1.2.
20+
// FIPS required minimum of TLS 1.2 (see NIST SP 800-52).
2121
return VersionTLS12
2222
}
2323

2424
// fipsMaxVersion replaces c.maxVersion in FIPS-only mode.
2525
func fipsMaxVersion(c *Config) uint16 {
26-
// FIPS requires TLS 1.2.
27-
return VersionTLS12
26+
// FIPS required maximum of TLS 1.3 (see NIST SP 800-52).
27+
return VersionTLS13
2828
}
2929

3030
// default defaultFIPSCurvePreferences is the FIPS-allowed curves,
3131
// in preference order (most preferable first).
32+
// See NIST SP 800-186.
3233
var defaultFIPSCurvePreferences = []CurveID{CurveP256, CurveP384, CurveP521}
3334

3435
// fipsCurvePreferences replaces c.curvePreferences in FIPS-only mode.
@@ -49,7 +50,10 @@ func fipsCurvePreferences(c *Config) []CurveID {
4950
}
5051

5152
// defaultCipherSuitesFIPS are the FIPS-allowed cipher suites.
53+
// See NIST SP 800-52.
5254
var defaultCipherSuitesFIPS = []uint16{
55+
TLS_AES_128_GCM_SHA256,
56+
TLS_AES_256_GCM_SHA384,
5357
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
5458
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
5559
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
@@ -76,8 +80,10 @@ func fipsCipherSuites(c *Config) []uint16 {
7680
}
7781

7882
// fipsSupportedSignatureAlgorithms currently are a subset of
79-
// defaultSupportedSignatureAlgorithms without Ed25519 and SHA-1.
83+
// defaultSupportedSignatureAlgorithms without SHA-1.
84+
// See FIPS 186-5.
8085
var fipsSupportedSignatureAlgorithms = []SignatureScheme{
86+
Ed25519,
8187
PSSWithSHA256,
8288
PSSWithSHA384,
8389
PSSWithSHA512,

src/crypto/tls/boring_test.go

+11-4
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,22 @@ func TestBoringServerProtocolVersion(t *testing.T) {
5252
test("VersionTLS10", VersionTLS10, "client offered only unsupported versions")
5353
test("VersionTLS11", VersionTLS11, "client offered only unsupported versions")
5454
test("VersionTLS12", VersionTLS12, "")
55-
test("VersionTLS13", VersionTLS13, "client offered only unsupported versions")
55+
test("VersionTLS13", VersionTLS13, "")
5656
}
5757

5858
func isBoringVersion(v uint16) bool {
59-
return v == VersionTLS12
59+
switch v {
60+
case VersionTLS12, VersionTLS13:
61+
return true
62+
}
63+
return false
6064
}
6165

6266
func isBoringCipherSuite(id uint16) bool {
6367
switch id {
64-
case TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
68+
case TLS_AES_128_GCM_SHA256,
69+
TLS_AES_256_GCM_SHA384,
70+
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
6571
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
6672
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
6773
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
@@ -93,7 +99,8 @@ func isBoringSignatureScheme(alg SignatureScheme) bool {
9399
switch alg {
94100
default:
95101
return false
96-
case PKCS1WithSHA256,
102+
case Ed25519,
103+
PKCS1WithSHA256,
97104
ECDSAWithP256AndSHA256,
98105
PKCS1WithSHA384,
99106
ECDSAWithP384AndSHA384,

0 commit comments

Comments
 (0)