]> Cypherpunks repositories - gostls13.git/commit
crypto/tls: implement TLS 1.3 KeyUpdate messages
authorFilippo Valsorda <filippo@golang.org>
Sat, 3 Nov 2018 22:29:09 +0000 (18:29 -0400)
committerFilippo Valsorda <filippo@golang.org>
Mon, 12 Nov 2018 20:42:36 +0000 (20:42 +0000)
commitdb27e782780fcfe5da39671007374b06a4d8f2d4
tree9990e8bce479ffe870108bbb2a0418870a3a2b9c
parent29b01d556de22ad0c8b7b24d827123886ae9a701
crypto/tls: implement TLS 1.3 KeyUpdate messages

Since TLS 1.3 delivers handshake messages (including KeyUpdate) after
the handshake, the want argument to readRecord had became almost
pointless: it only meant something when set to recordTypeChangeCipherSpec.
Replaced it with a bool to reflect that, and added two shorthands to
avoid anonymous bools in calls.

Took the occasion to simplify and formalize the invariants of readRecord.

The maxConsecutiveEmptyRecords loop became useless when readRecord
started retrying on any non-advancing record in CL 145297.

Replaced panics with errors, because failure is better than undefined
behavior, but contained failure is better than a DoS vulnerability. For
example, I suspect the panic at the top of readRecord was reachable from
handleRenegotiation, which calls readHandshake with handshakeComplete
false. Thankfully it was not a panic in 1.11, and it's allowed now.

Removed Client-TLSv13-RenegotiationRejected because OpenSSL isn't
actually willing to ask for renegotiation over TLS 1.3, the expected
error was due to NewSessionTicket messages, which didn't break the rest
of the tests because they stop too soon.

Updates #9671

Change-Id: I297a81bde5c8020a962a92891b70d6d70b90f5e3
Reviewed-on: https://go-review.googlesource.com/c/147418
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/conn.go
src/crypto/tls/handshake_client.go
src/crypto/tls/handshake_client_test.go
src/crypto/tls/handshake_server.go
src/crypto/tls/testdata/Client-TLSv13-KeyUpdate [new file with mode: 0644]
src/crypto/tls/testdata/Client-TLSv13-RenegotiationRejected [deleted file]