]> Cypherpunks repositories - gostls13.git/commit
crypto/tls: implement TLS 1.3 version negotiation
authorFilippo Valsorda <filippo@golang.org>
Wed, 31 Oct 2018 13:34:10 +0000 (09:34 -0400)
committerFilippo Valsorda <filippo@golang.org>
Fri, 2 Nov 2018 22:05:06 +0000 (22:05 +0000)
commit7f5dce08ad77519bfea58880492e1d290cd13cb0
treea72ef5006dace9ac6c6cc95e9099cd417537f3c6
parent0663fe9862951a52cc67e3af8213ee99b76297e0
crypto/tls: implement TLS 1.3 version negotiation

RFC 8446 recommends using the supported_versions extension to negotiate
lower versions as well, so begin by implementing it to negotiate the
currently supported versions.

Note that pickTLSVersion was incorrectly negotiating the ServerHello
version down on the client. If the server had illegally sent a version
higher than the ClientHello version, the client would have just
downgraded it, hopefully failing later in the handshake.

In TestGetConfigForClient, we were hitting the record version check
because the server would select TLS 1.1, the handshake would fail on the
client which required TLS 1.2, which would then send a TLS 1.0 record
header on its fatal alert (not having negotiated a version), while the
server would expect a TLS 1.1 header at that point. Now, the client gets
to communicate the minimum version through the extension and the
handshake fails on the server.

Updates #9671

Change-Id: Ie33c7124c0c769f62e10baad51cbed745c424e5b
Reviewed-on: https://go-review.googlesource.com/c/146217
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
src/crypto/tls/common.go
src/crypto/tls/handshake_client.go
src/crypto/tls/handshake_client_test.go
src/crypto/tls/handshake_server.go
src/crypto/tls/handshake_server_test.go