1
0
mirror of https://github.com/golang/go synced 2024-11-23 03:40:02 -07:00

crypto/tls: make SSLv3 again disabled by default

It was mistakenly re-enabled in CL 146217.

Fixes #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>
This commit is contained in:
Filippo Valsorda 2019-08-26 16:18:24 -04:00
parent 8f5353fd1c
commit 2ebc3d8157
3 changed files with 27 additions and 4 deletions

View 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 -->

View 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
}

View 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,