]> Cypherpunks.ru repositories - gostls13.git/commit
crypto/tls: don't reverify but check certificate expiration on resumption
authorFilippo Valsorda <filippo@golang.org>
Wed, 24 May 2023 13:49:56 +0000 (15:49 +0200)
committerGopher Robot <gobot@golang.org>
Thu, 25 May 2023 00:14:50 +0000 (00:14 +0000)
commitd4bd855cfb5319bfa560251d60a93369c0ce0763
treedd4ebf0ed61450cfe1519c631ec737ae8235f418
parentb267db08b22de7a7bbe700530fd9e71ca060610f
crypto/tls: don't reverify but check certificate expiration on resumption

We used to inconsistently run certificate verification on the server on
resumption, but not on the client. This made TLS 1.3 resumption pretty
much useless, as it didn't save bytes, CPU, or round-trips.

This requires serializing the verified chains into the session ticket,
so it's a tradeoff making the ticket bigger to save computation (and for
consistency).

The previous behavior also had a "stickyness" issue: if a ticket
contained invalid certificates, they would be used even if the client
had in the meantime configured valid certificates for a full handshake.

We also didn't check expiration on the client side on resumption if
InsecureSkipVerify was set. Again for consistency, we do that now.

Also, we used to run VerifyPeerCertificates on resumption even if
NoClientCerts was set.

Fixes #31641

Change-Id: Icc88269ea4adb544fa81158114aae76f3c91a15f
Reviewed-on: https://go-review.googlesource.com/c/go/+/497895
Reviewed-by: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
36 files changed:
src/crypto/tls/common.go
src/crypto/tls/handshake_client.go
src/crypto/tls/handshake_messages_test.go
src/crypto/tls/handshake_server.go
src/crypto/tls/handshake_server_tls13.go
src/crypto/tls/testdata/Server-TLSv10-ExportKeyingMaterial
src/crypto/tls/testdata/Server-TLSv12-ALPN
src/crypto/tls/testdata/Server-TLSv12-ALPN-Fallback
src/crypto/tls/testdata/Server-TLSv12-ALPN-NotConfigured
src/crypto/tls/testdata/Server-TLSv12-ExportKeyingMaterial
src/crypto/tls/testdata/Server-TLSv12-IssueTicket
src/crypto/tls/testdata/Server-TLSv12-IssueTicketPreDisable
src/crypto/tls/testdata/Server-TLSv12-Resume
src/crypto/tls/testdata/Server-TLSv13-AES128-SHA256
src/crypto/tls/testdata/Server-TLSv13-AES256-SHA384
src/crypto/tls/testdata/Server-TLSv13-ALPN
src/crypto/tls/testdata/Server-TLSv13-ALPN-Fallback
src/crypto/tls/testdata/Server-TLSv13-ALPN-NotConfigured
src/crypto/tls/testdata/Server-TLSv13-CHACHA20-SHA256
src/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndECDSAGiven
src/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndEd25519Given
src/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedAndGiven
src/crypto/tls/testdata/Server-TLSv13-ClientAuthRequestedNotGiven
src/crypto/tls/testdata/Server-TLSv13-ECDHE-ECDSA-AES
src/crypto/tls/testdata/Server-TLSv13-Ed25519
src/crypto/tls/testdata/Server-TLSv13-ExportKeyingMaterial
src/crypto/tls/testdata/Server-TLSv13-HelloRetryRequest
src/crypto/tls/testdata/Server-TLSv13-IssueTicket
src/crypto/tls/testdata/Server-TLSv13-IssueTicketPreDisable
src/crypto/tls/testdata/Server-TLSv13-P256
src/crypto/tls/testdata/Server-TLSv13-RSA-RSAPSS
src/crypto/tls/testdata/Server-TLSv13-Resume
src/crypto/tls/testdata/Server-TLSv13-Resume-HelloRetryRequest
src/crypto/tls/testdata/Server-TLSv13-X25519
src/crypto/tls/ticket.go
src/crypto/tls/tls_test.go