• Filippo Valsorda's avatar
    crypto/tls: implement TLS 1.3 version negotiation · 7f5dce08
    Filippo Valsorda authored
    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: default avatarAdam Langley <agl@golang.org>
    7f5dce08
handshake_client_test.go 46.5 KB