]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/tls: mark RSA KEX cipher suites insecure
authorFilippo Valsorda <filippo@golang.org>
Tue, 21 Nov 2023 22:25:51 +0000 (23:25 +0100)
committerGopher Robot <gobot@golang.org>
Tue, 21 Nov 2023 23:27:54 +0000 (23:27 +0000)
Updates #63413

Change-Id: I31fc2f9728582524cac5d101d0011093dbd05ed3
Reviewed-on: https://go-review.googlesource.com/c/go/+/544336
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Roland Shoemaker <roland@golang.org>
src/crypto/tls/cipher_suites.go
src/crypto/tls/tls_test.go

index af7c64c4d5d866f356dc4eb4bf0ccf7a9c49a404..6f5bc37197a4f4a1f23f816f829ac1368a80b5a7 100644 (file)
@@ -52,11 +52,6 @@ var (
 // and might not match those returned by this function.
 func CipherSuites() []*CipherSuite {
        return []*CipherSuite{
-               {TLS_RSA_WITH_AES_128_CBC_SHA, "TLS_RSA_WITH_AES_128_CBC_SHA", supportedUpToTLS12, false},
-               {TLS_RSA_WITH_AES_256_CBC_SHA, "TLS_RSA_WITH_AES_256_CBC_SHA", supportedUpToTLS12, false},
-               {TLS_RSA_WITH_AES_128_GCM_SHA256, "TLS_RSA_WITH_AES_128_GCM_SHA256", supportedOnlyTLS12, false},
-               {TLS_RSA_WITH_AES_256_GCM_SHA384, "TLS_RSA_WITH_AES_256_GCM_SHA384", supportedOnlyTLS12, false},
-
                {TLS_AES_128_GCM_SHA256, "TLS_AES_128_GCM_SHA256", supportedOnlyTLS13, false},
                {TLS_AES_256_GCM_SHA384, "TLS_AES_256_GCM_SHA384", supportedOnlyTLS13, false},
                {TLS_CHACHA20_POLY1305_SHA256, "TLS_CHACHA20_POLY1305_SHA256", supportedOnlyTLS13, false},
@@ -85,7 +80,11 @@ func InsecureCipherSuites() []*CipherSuite {
        return []*CipherSuite{
                {TLS_RSA_WITH_RC4_128_SHA, "TLS_RSA_WITH_RC4_128_SHA", supportedUpToTLS12, true},
                {TLS_RSA_WITH_3DES_EDE_CBC_SHA, "TLS_RSA_WITH_3DES_EDE_CBC_SHA", supportedUpToTLS12, true},
+               {TLS_RSA_WITH_AES_128_CBC_SHA, "TLS_RSA_WITH_AES_128_CBC_SHA", supportedUpToTLS12, true},
+               {TLS_RSA_WITH_AES_256_CBC_SHA, "TLS_RSA_WITH_AES_256_CBC_SHA", supportedUpToTLS12, true},
                {TLS_RSA_WITH_AES_128_CBC_SHA256, "TLS_RSA_WITH_AES_128_CBC_SHA256", supportedOnlyTLS12, true},
+               {TLS_RSA_WITH_AES_128_GCM_SHA256, "TLS_RSA_WITH_AES_128_GCM_SHA256", supportedOnlyTLS12, true},
+               {TLS_RSA_WITH_AES_256_GCM_SHA384, "TLS_RSA_WITH_AES_256_GCM_SHA384", supportedOnlyTLS12, true},
                {TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA", supportedUpToTLS12, true},
                {TLS_ECDHE_RSA_WITH_RC4_128_SHA, "TLS_ECDHE_RSA_WITH_RC4_128_SHA", supportedUpToTLS12, true},
                {TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA", supportedUpToTLS12, true},
index 58369adda722995e8f4cac7ea00ab7f5b3ee4031..42a0272f0051d8a43497981fdef0ce5e83d4e49c 100644 (file)
@@ -1490,16 +1490,21 @@ func TestCipherSuites(t *testing.T) {
        if len(cipherSuitesPreferenceOrderNoAES) != len(cipherSuitesPreferenceOrder) {
                t.Errorf("cipherSuitesPreferenceOrderNoAES is not the same size as cipherSuitesPreferenceOrder")
        }
+       if len(defaultCipherSuites) >= len(defaultCipherSuitesWithRSAKex) {
+               t.Errorf("defaultCipherSuitesWithRSAKex should be longer than defaultCipherSuites")
+       }
 
        // Check that disabled suites are marked insecure.
-       for id := range disabledCipherSuites {
-               c := CipherSuiteByID(id)
-               if c == nil {
-                       t.Errorf("%#04x: no CipherSuite entry", id)
-                       continue
-               }
-               if !c.Insecure {
-                       t.Errorf("%#04x: disabled by default but not marked insecure", id)
+       for _, badSuites := range []map[uint16]bool{disabledCipherSuites, rsaKexCiphers} {
+               for id := range badSuites {
+                       c := CipherSuiteByID(id)
+                       if c == nil {
+                               t.Errorf("%#04x: no CipherSuite entry", id)
+                               continue
+                       }
+                       if !c.Insecure {
+                               t.Errorf("%#04x: disabled by default but not marked insecure", id)
+                       }
                }
        }