]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/tls: don't call tlsrsakex.IncNonDefault with FIPS
authorMike Beaumont <mjboamail@gmail.com>
Mon, 29 Apr 2024 10:14:32 +0000 (12:14 +0200)
committerGopher Robot <gobot@golang.org>
Thu, 16 May 2024 17:33:18 +0000 (17:33 +0000)
We haven't called tlsrsakex.Value() yet at this point if we're using
FIPS, like if CipherSuites != nil. This adds needFIPS as a gate next to
CipherSuites != nil. FIPS specifies suites that would be skipped if
tlsarsakex were set.

Fixes #65991

Change-Id: I8070d8f43f27c04067490af8cc7ec5e787f2b9bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/582315
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Bypass: Filippo Valsorda <filippo@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
src/crypto/tls/handshake_client.go
src/crypto/tls/handshake_server.go

index 0b35deefa145e6ab411b4eef5d551a2fb973dc08..d046c86679ea51244cc8b86a63dc4f33517429c4 100644 (file)
@@ -526,7 +526,7 @@ func (hs *clientHandshakeState) pickCipherSuite() error {
                return errors.New("tls: server chose an unconfigured cipher suite")
        }
 
-       if hs.c.config.CipherSuites == nil && rsaKexCiphers[hs.suite.id] {
+       if hs.c.config.CipherSuites == nil && !needFIPS() && rsaKexCiphers[hs.suite.id] {
                tlsrsakex.IncNonDefault()
        }
 
index eb87ee038c72d0b1411aac214d34c053b2c61c01..d5f8cc843ed6dadfd5d2d52e2f3533cc22593181 100644 (file)
@@ -370,7 +370,7 @@ func (hs *serverHandshakeState) pickCipherSuite() error {
        }
        c.cipherSuite = hs.suite.id
 
-       if c.config.CipherSuites == nil && rsaKexCiphers[hs.suite.id] {
+       if c.config.CipherSuites == nil && !needFIPS() && rsaKexCiphers[hs.suite.id] {
                tlsrsakex.IncNonDefault()
        }