]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.13] crypto/tls: make SSLv3 again disabled by default
authorFilippo Valsorda <filippo@golang.org>
Mon, 26 Aug 2019 20:18:24 +0000 (16:18 -0400)
committerFilippo Valsorda <filippo@golang.org>
Tue, 27 Aug 2019 20:56:38 +0000 (20:56 +0000)
It was mistakenly re-enabled in CL 146217.

Updates #33837

Change-Id: I8c0e1787114c6232df5888e51e355906622295bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/191877
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
(cherry picked from commit 2ebc3d8157fedba633ce90c5454827512734a793)
Reviewed-on: https://go-review.googlesource.com/c/go/+/191998

doc/go1.13.html
src/crypto/tls/common.go
src/crypto/tls/handshake_server_test.go

index ef56a862a54fae4b914aca882df866f84e070544..f13c0e58e78cc5c0c5940fe0c2dc246fe83764aa 100644 (file)
@@ -593,10 +593,15 @@ godoc
   <dd>
     <p>
       Support for SSL version 3.0 (SSLv3) <a href="https://golang.org/issue/32716">
-      is now deprecated and will be removed in Go 1.14</a>. Note that SSLv3
-      <a href="https://tools.ietf.org/html/rfc7568">is cryptographically
-      broken</a>, is already disabled by default in <code>crypto/tls</code>,
-      and was never supported by Go clients.
+      is now deprecated and will be removed in Go 1.14</a>. Note that SSLv3 is the
+      <a href="https://tools.ietf.org/html/rfc7568">cryptographically broken</a>
+      protocol predating TLS.
+    </p>
+
+    <p>
+      SSLv3 was always disabled by default, other than in Go 1.12, when it was
+      mistakenly enabled by default server-side. It is now again disabled by
+      default. (SSLv3 was never supported client-side.)
     </p>
 
     <p><!-- CL 177698 -->
index da1eae08009f1ee2acfd64aa144c378572650198..ef0b38584876c6b91ce445296959e893a8406268 100644 (file)
@@ -794,6 +794,10 @@ var supportedVersions = []uint16{
 func (c *Config) supportedVersions(isClient bool) []uint16 {
        versions := make([]uint16, 0, len(supportedVersions))
        for _, v := range supportedVersions {
+               // TLS 1.0 is the default minimum version.
+               if (c == nil || c.MinVersion == 0) && v < VersionTLS10 {
+                       continue
+               }
                if c != nil && c.MinVersion != 0 && v < c.MinVersion {
                        continue
                }
index 22b126fa22dc5ce8c62be8000041b7961fd11132..a9c1c08cbc429ed3eba18a4e9d14d4222293265a 100644 (file)
@@ -77,6 +77,20 @@ func TestRejectBadProtocolVersion(t *testing.T) {
        }, "unsupported versions")
 }
 
+func TestSSLv3OptIn(t *testing.T) {
+       config := testConfig.Clone()
+       config.MinVersion = 0
+       testClientHelloFailure(t, config, &clientHelloMsg{
+               vers:   VersionSSL30,
+               random: make([]byte, 32),
+       }, "unsupported versions")
+       testClientHelloFailure(t, config, &clientHelloMsg{
+               vers:              VersionTLS12,
+               supportedVersions: []uint16{VersionSSL30},
+               random:            make([]byte, 32),
+       }, "unsupported versions")
+}
+
 func TestNoSuiteOverlap(t *testing.T) {
        clientHello := &clientHelloMsg{
                vers:               VersionTLS10,