Skip to content

Commit b84dc86

Browse files
committed
The client Finished message can't be protected with 1-RTT keys
1 parent 26355bc commit b84dc86

File tree

1 file changed

+35
-57
lines changed

1 file changed

+35
-57
lines changed

draft-ietf-quic-tls.md

Lines changed: 35 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ ensures that TLS handshake messages are delivered in the correct order.
314314

315315
QUIC Frames <any> @1
316316
<--------
317-
@1 QUIC STREAM Frame(s) <1>:
317+
@C QUIC STREAM Frame(s) <1>:
318318
(EndOfEarlyData)
319319
{Finished}
320320
-------->
@@ -334,7 +334,7 @@ In {{quic-tls-handshake}}, symbols mean:
334334

335335
If 0-RTT is not attempted, then the client does not send packets protected by
336336
the 0-RTT key (@0). In that case, the only key transition on the client is from
337-
unprotected packets (@C) to 1-RTT protection (@1), which happens before it sends
337+
unprotected packets (@C) to 1-RTT protection (@1), which happens after it sends
338338
its final set of TLS handshake messages.
339339

340340
The server sends TLS handshake messages without protection (@C). The server
@@ -347,7 +347,7 @@ QUIC. QUIC packets from the server are sent in the clear until the final
347347
transition to 1-RTT keys.
348348

349349
The client transitions from cleartext (@C) to 0-RTT keys (@0) when sending 0-RTT
350-
data, and subsequently to to 1-RTT keys (@1) for its second flight of TLS
350+
data, and subsequently to to 1-RTT keys (@1) after its second flight of TLS
351351
handshake messages. This creates the potential for unprotected packets to be
352352
received by a server in close proximity to packets that are protected with 1-RTT
353353
keys.
@@ -418,14 +418,14 @@ TLS provides QUIC with signals when 0-RTT and 1-RTT keys are ready for use.
418418
These events are not asynchronous, they always occur immediately after TLS is
419419
provided with new handshake octets, or after TLS produces handshake octets.
420420

421-
When TLS has enough information to generate 1-RTT keys, it indicates their
422-
availability. On the client, this occurs after receiving the entirety of the
423-
first flight of TLS handshake messages from the server. A server indicates that
424-
1-RTT keys are available after it sends its handshake messages.
421+
When TLS completed its handshake, 1-RTT keys can be provided to QUIC. On both
422+
client and server, this occurs after sending the TLS Finished message.
425423

426-
This ordering ensures that a client sends its second flight of handshake
427-
messages protected with 1-RTT keys. More importantly, it ensures that the
428-
server sends its flight of handshake messages without protection.
424+
This ordering means that there could be frames that carry TLS handshake messages
425+
ready to send at the same time that application data is available. An
426+
implementation MUST ensure that TLS handshake messages are always sent in
427+
cleartext packets. Separate packets are required for data that needs protection
428+
from 1-RTT keys.
429429

430430
If 0-RTT is possible, it is ready after the client sends a TLS ClientHello
431431
message or the server receives that message. After providing a QUIC client with
@@ -459,9 +459,9 @@ Get Handshake
459459
1-RTT Keys Ready
460460
<--- send/receive ---
461461
Handshake Received
462-
1-RTT Keys Ready
463462
Get Handshake
464463
Handshake Complete
464+
1-RTT Keys Ready
465465
--- send/receive --->
466466
Handshake Received
467467
Get Handshake
@@ -573,8 +573,8 @@ packets sent by the client.
573573

574574
1-RTT keys are used by both client and server after the TLS handshake completes.
575575
There are two secrets used at any time: one is used to derive packet protection
576-
keys for packets sent by the client, the other for protecting packets sent by
577-
the server.
576+
keys for packets sent by the client, the other for packet protection keys on
577+
packets sent by the server.
578578

579579
The initial client packet protection secret is exported from TLS using the
580580
exporter label "EXPORTER-QUIC client 1-RTT Secret"; the initial server packet
@@ -765,19 +765,15 @@ ensure that TLS handshake messages are sent with the correct packet protection.
765765
The initial exchange of packets are sent without protection. These packets are
766766
marked with a KEY_PHASE of 0.
767767

768-
TLS handshake messages that are critical to the TLS key exchange cannot be
769-
protected using QUIC packet protection. A KEY_PHASE of 0 is used for all of
770-
these packets, even during retransmission. The messages critical to key
771-
exchange are the TLS ClientHello and any TLS handshake message from the server,
772-
except those that are sent after the handshake completes, such as
773-
NewSessionTicket.
768+
TLS handshake messages MUST NOT be protected using QUIC packet protection. A
769+
KEY_PHASE of 0 is used for all of these packets, even during retransmission.
770+
The messages affected are all TLS handshake message up to the TLS Finished that
771+
is sent by each endpoint.
774772

775-
The second flight of TLS handshake messages from the client, and any TLS
776-
handshake messages that are sent after completing the TLS handshake do not need
777-
special packet protection rules. This includes the EndOfEarlyData message that
778-
is sent by a client to mark the end of its 0-RTT data. Packets containing these
779-
messages use the packet protection keys that are current at the time of sending
780-
(or retransmission).
773+
Any TLS handshake messages that are sent after completing the TLS handshake do
774+
not need special packet protection rules. Packets containing these messages use
775+
the packet protection keys that are current at the time of sending (or
776+
retransmission).
781777

782778
Like the client, a server MUST send retransmissions of its unprotected handshake
783779
messages or acknowledgments for unprotected handshake messages sent by the
@@ -786,27 +782,25 @@ client in unprotected packets (KEY_PHASE=0).
786782

787783
### Initial Key Transitions {#first-keys}
788784

789-
Once the TLS key exchange is complete, keying material is exported from TLS and
785+
Once the TLS handshake is complete, keying material is exported from TLS and
790786
QUIC packet protection commences.
791787

792788
Packets protected with 1-RTT keys have a KEY_PHASE bit set to 1. These packets
793789
also have a VERSION bit set to 0.
794790

795-
If the client is unable to send 0-RTT data - or it does not have 0-RTT data to
796-
send - packet protection with 1-RTT keys starts with the packets that contain
797-
its second flight of TLS handshake messages. That is, the flight containing the
798-
TLS Finished handshake message and optionally a Certificate and
799-
CertificateVerify message.
800-
801791
If the client sends 0-RTT data, it marks packets protected with 0-RTT keys with
802792
a KEY_PHASE of 1 and a VERSION bit of 1. Setting the version bit means that all
803-
packets also include the version field. The client removes the VERSION bit when
804-
it transitions to using 1-RTT keys, but it does not change the KEY_PHASE bit.
793+
packets also include the version field. The client retains the VERSION bit, but
794+
reverts the KEY_PHASE bit for the packet that contains the TLS EndOfEarlyData
795+
and Finished messages.
796+
797+
The client clears the VERSION bit and sets the KEY_PHASE bit to 1 when it
798+
transitions to using 1-RTT keys.
805799

806800
Marking 0-RTT data with the both KEY_PHASE and VERSION bits ensures that the
807-
server is able to identify these packets as 0-RTT data in case the packet
808-
containing the TLS ClientHello is lost or delayed. Including the version also
809-
ensures that the packet format is known to the server in this case.
801+
server is able to identify these packets as 0-RTT data in case packets
802+
containing TLS handshake message are lost or delayed. Including the version
803+
also ensures that the packet format is known to the server in this case.
810804

811805
Using both KEY_PHASE and VERSION also ensures that the server is able to
812806
distinguish between cleartext handshake packets (KEY_PHASE=0, VERSION=1), 0-RTT
@@ -830,26 +824,16 @@ KEY_PHASE of 1.
830824

831825
### Retransmission and Acknowledgment of Unprotected Packets
832826

833-
The first flight of TLS handshake messages from both client and server
834-
(ClientHello, or ServerHello through to the server's Finished) are critical to
835-
the key exchange. The contents of these messages determines the keys used to
836-
protect later messages. If these handshake messages are included in packets
837-
that are protected with these keys, they will be indecipherable to the
838-
recipient.
827+
TLS handshake messages from both client and server are critical to the key
828+
exchange. The contents of these messages determines the keys used to protect
829+
later messages. If these handshake messages are included in packets that are
830+
protected with these keys, they will be indecipherable to the recipient.
839831

840832
Even though newer keys could be available when retranmitting, retransmissions of
841833
these handshake messages MUST be sent in unprotected packets (with a KEY_PHASE
842834
of 0). An endpoint MUST also generate ACK frames for these messages that are
843835
sent in unprotected packets.
844836

845-
The TLS handshake messages that are affected by this rule are specifically:
846-
847-
* A client MUST NOT restransmit a TLS ClientHello with 0-RTT keys. The server
848-
needs this message in order to determine the 0-RTT keys.
849-
850-
* A server MUST NOT retransmit any of its TLS handshake messages with 1-RTT
851-
keys. The client needs these messages in order to determine the 1-RTT keys.
852-
853837
A HelloRetryRequest handshake message might be used to reject an initial
854838
ClientHello. A HelloRetryRequest handshake message and any second ClientHello
855839
that is sent in response MUST also be sent without packet protection. This is
@@ -858,12 +842,6 @@ need to be sent. Upon receipt of a HelloRetryRequest, a client SHOULD cease any
858842
transmission of 0-RTT data; 0-RTT data will only be discarded by any server that
859843
sends a HelloRetryRequest.
860844

861-
Note:
862-
863-
: TLS handshake data that needs to be sent without protection is all the
864-
handshake data acquired from TLS before the point that 1-RTT keys are provided
865-
by TLS (see {{key-ready-events}}).
866-
867845
The KEY_PHASE and VERSION bits ensure that protected packets are clearly
868846
distinguished from unprotected packets. Loss or reordering might cause
869847
unprotected packets to arrive once 1-RTT keys are in use, unprotected packets

0 commit comments

Comments
 (0)