]> Cypherpunks repositories - gostls13.git/commit
crypto/tls: select only compatible chains from Certificates
authorFilippo Valsorda <filippo@golang.org>
Sat, 2 Nov 2019 18:43:34 +0000 (14:43 -0400)
committerFilippo Valsorda <filippo@golang.org>
Tue, 12 Nov 2019 01:08:57 +0000 (01:08 +0000)
commiteb93c684d40de4924fc0664d7d9e98a84d5a100b
treeca46482d7a1ce6e76e5b058a1f32e18c0274f273
parent4b21642161570dad6e94fb7722cd3c9156874cea
crypto/tls: select only compatible chains from Certificates

Now that we have a full implementation of the logic to check certificate
compatibility, we can let applications just list multiple chains in
Certificates (for example, an RSA and an ECDSA one) and choose the most
appropriate automatically.

NameToCertificate only maps each name to one chain, so simply deprecate
it, and while at it simplify its implementation by not stripping
trailing dots from the SNI (which is specified not to have any, see RFC
6066, Section 3) and by not supporting multi-level wildcards, which are
not a thing in the WebPKI (and in crypto/x509).

The performance of SupportsCertificate without Leaf is poor, but doesn't
affect current users. For now document that, and address it properly in
the next cycle. See #35504.

While cleaning up the Certificates/GetCertificate/GetConfigForClient
behavior, also support leaving Certificates/GetCertificate nil if
GetConfigForClient is set, and send unrecognized_name when there are no
available certificates.

Fixes #29139
Fixes #18377

Change-Id: I26604db48806fe4d608388e55da52f34b7ca4566
Reviewed-on: https://go-review.googlesource.com/c/go/+/205059
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
src/crypto/tls/alert.go
src/crypto/tls/common.go
src/crypto/tls/conn_test.go
src/crypto/tls/handshake_server.go
src/crypto/tls/handshake_server_test.go
src/crypto/tls/handshake_server_tls13.go
src/crypto/tls/tls.go