idnits 2.17.1 draft-ietf-quic-tls-18.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The abstract seems to contain references ([2], [3], [1]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'MUST not' in this paragraph: o If the packet is from a previously installed encryption level, it MUST not contain data which extends past the end of previously received data in that flow. Implementations MUST treat any violations of this requirement as a connection error of type PROTOCOL_VIOLATION. -- The document date (January 23, 2019) is 1914 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: '1' on line 1543 -- Looks like a reference, but probably isn't: '2' on line 1545 -- Looks like a reference, but probably isn't: '3' on line 1547 -- Looks like a reference, but probably isn't: '0' on line 1637 == Unused Reference: 'QUIC-HTTP' is defined on line 1526, but no explicit reference was found in the text -- Possible downref: Non-RFC (?) normative reference: ref. 'AES' ** Downref: Normative reference to an Informational RFC: RFC 8439 (ref. 'CHACHA') == Outdated reference: A later version (-34) exists of draft-ietf-quic-recovery-18 == Outdated reference: A later version (-34) exists of draft-ietf-quic-transport-18 -- Possible downref: Non-RFC (?) normative reference: ref. 'SHA' == Outdated reference: A later version (-34) exists of draft-ietf-quic-http-18 -- Obsolete informational reference (is this intentional?): RFC 2818 (Obsoleted by RFC 9110) Summary: 2 errors (**), 0 flaws (~~), 6 warnings (==), 9 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 QUIC M. Thomson, Ed. 3 Internet-Draft Mozilla 4 Intended status: Standards Track S. Turner, Ed. 5 Expires: July 27, 2019 sn3rd 6 January 23, 2019 8 Using TLS to Secure QUIC 9 draft-ietf-quic-tls-18 11 Abstract 13 This document describes how Transport Layer Security (TLS) is used to 14 secure QUIC. 16 Note to Readers 18 Discussion of this draft takes place on the QUIC working group 19 mailing list (quic@ietf.org), which is archived at 20 https://mailarchive.ietf.org/arch/search/?email_list=quic [1]. 22 Working Group information can be found at https://github.com/quicwg 23 [2]; source code and issues list for this draft can be found at 24 https://github.com/quicwg/base-drafts/labels/-tls [3]. 26 Status of This Memo 28 This Internet-Draft is submitted in full conformance with the 29 provisions of BCP 78 and BCP 79. 31 Internet-Drafts are working documents of the Internet Engineering 32 Task Force (IETF). Note that other groups may also distribute 33 working documents as Internet-Drafts. The list of current Internet- 34 Drafts is at https://datatracker.ietf.org/drafts/current/. 36 Internet-Drafts are draft documents valid for a maximum of six months 37 and may be updated, replaced, or obsoleted by other documents at any 38 time. It is inappropriate to use Internet-Drafts as reference 39 material or to cite them other than as "work in progress." 41 This Internet-Draft will expire on July 27, 2019. 43 Copyright Notice 45 Copyright (c) 2019 IETF Trust and the persons identified as the 46 document authors. All rights reserved. 48 This document is subject to BCP 78 and the IETF Trust's Legal 49 Provisions Relating to IETF Documents 50 (https://trustee.ietf.org/license-info) in effect on the date of 51 publication of this document. Please review these documents 52 carefully, as they describe your rights and restrictions with respect 53 to this document. Code Components extracted from this document must 54 include Simplified BSD License text as described in Section 4.e of 55 the Trust Legal Provisions and are provided without warranty as 56 described in the Simplified BSD License. 58 Table of Contents 60 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 61 2. Notational Conventions . . . . . . . . . . . . . . . . . . . 4 62 2.1. TLS Overview . . . . . . . . . . . . . . . . . . . . . . 4 63 3. Protocol Overview . . . . . . . . . . . . . . . . . . . . . . 6 64 4. Carrying TLS Messages . . . . . . . . . . . . . . . . . . . . 7 65 4.1. Interface to TLS . . . . . . . . . . . . . . . . . . . . 9 66 4.1.1. Sending and Receiving Handshake Messages . . . . . . 9 67 4.1.2. Encryption Level Changes . . . . . . . . . . . . . . 11 68 4.1.3. TLS Interface Summary . . . . . . . . . . . . . . . . 12 69 4.2. TLS Version . . . . . . . . . . . . . . . . . . . . . . . 13 70 4.3. ClientHello Size . . . . . . . . . . . . . . . . . . . . 14 71 4.4. Peer Authentication . . . . . . . . . . . . . . . . . . . 14 72 4.5. Enabling 0-RTT . . . . . . . . . . . . . . . . . . . . . 15 73 4.6. Rejecting 0-RTT . . . . . . . . . . . . . . . . . . . . . 15 74 4.7. HelloRetryRequest . . . . . . . . . . . . . . . . . . . . 15 75 4.8. TLS Errors . . . . . . . . . . . . . . . . . . . . . . . 16 76 4.9. Discarding Unused Keys . . . . . . . . . . . . . . . . . 16 77 4.10. Discarding Initial Keys . . . . . . . . . . . . . . . . . 17 78 5. Packet Protection . . . . . . . . . . . . . . . . . . . . . . 18 79 5.1. Packet Protection Keys . . . . . . . . . . . . . . . . . 18 80 5.2. Initial Secrets . . . . . . . . . . . . . . . . . . . . . 18 81 5.3. AEAD Usage . . . . . . . . . . . . . . . . . . . . . . . 19 82 5.4. Header Protection . . . . . . . . . . . . . . . . . . . . 20 83 5.4.1. Header Protection Application . . . . . . . . . . . . 21 84 5.4.2. Header Protection Sample . . . . . . . . . . . . . . 22 85 5.4.3. AES-Based Header Protection . . . . . . . . . . . . . 23 86 5.4.4. ChaCha20-Based Header Protection . . . . . . . . . . 24 87 5.5. Receiving Protected Packets . . . . . . . . . . . . . . . 24 88 5.6. Use of 0-RTT Keys . . . . . . . . . . . . . . . . . . . . 24 89 5.7. Receiving Out-of-Order Protected Frames . . . . . . . . . 25 90 6. Key Update . . . . . . . . . . . . . . . . . . . . . . . . . 25 91 7. Security of Initial Messages . . . . . . . . . . . . . . . . 27 92 8. QUIC-Specific Additions to the TLS Handshake . . . . . . . . 28 93 8.1. Protocol and Version Negotiation . . . . . . . . . . . . 28 94 8.2. QUIC Transport Parameters Extension . . . . . . . . . . . 28 95 8.3. Removing the EndOfEarlyData Message . . . . . . . . . . . 29 97 9. Security Considerations . . . . . . . . . . . . . . . . . . . 29 98 9.1. Packet Reflection Attack Mitigation . . . . . . . . . . . 29 99 9.2. Peer Denial of Service . . . . . . . . . . . . . . . . . 30 100 9.3. Header Protection Analysis . . . . . . . . . . . . . . . 30 101 9.4. Key Diversity . . . . . . . . . . . . . . . . . . . . . . 31 102 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 32 103 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 32 104 11.1. Normative References . . . . . . . . . . . . . . . . . . 32 105 11.2. Informative References . . . . . . . . . . . . . . . . . 33 106 11.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 34 107 Appendix A. Sample Initial Packet Protection . . . . . . . . . . 34 108 A.1. Keys . . . . . . . . . . . . . . . . . . . . . . . . . . 34 109 A.2. Client Initial . . . . . . . . . . . . . . . . . . . . . 35 110 A.3. Server Initial . . . . . . . . . . . . . . . . . . . . . 37 111 Appendix B. Change Log . . . . . . . . . . . . . . . . . . . . . 38 112 B.1. Since draft-ietf-quic-tls-17 . . . . . . . . . . . . . . 38 113 B.2. Since draft-ietf-quic-tls-14 . . . . . . . . . . . . . . 38 114 B.3. Since draft-ietf-quic-tls-13 . . . . . . . . . . . . . . 39 115 B.4. Since draft-ietf-quic-tls-12 . . . . . . . . . . . . . . 39 116 B.5. Since draft-ietf-quic-tls-11 . . . . . . . . . . . . . . 39 117 B.6. Since draft-ietf-quic-tls-10 . . . . . . . . . . . . . . 39 118 B.7. Since draft-ietf-quic-tls-09 . . . . . . . . . . . . . . 39 119 B.8. Since draft-ietf-quic-tls-08 . . . . . . . . . . . . . . 40 120 B.9. Since draft-ietf-quic-tls-07 . . . . . . . . . . . . . . 40 121 B.10. Since draft-ietf-quic-tls-05 . . . . . . . . . . . . . . 40 122 B.11. Since draft-ietf-quic-tls-04 . . . . . . . . . . . . . . 40 123 B.12. Since draft-ietf-quic-tls-03 . . . . . . . . . . . . . . 40 124 B.13. Since draft-ietf-quic-tls-02 . . . . . . . . . . . . . . 40 125 B.14. Since draft-ietf-quic-tls-01 . . . . . . . . . . . . . . 40 126 B.15. Since draft-ietf-quic-tls-00 . . . . . . . . . . . . . . 41 127 B.16. Since draft-thomson-quic-tls-01 . . . . . . . . . . . . . 41 128 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 41 129 Contributors . . . . . . . . . . . . . . . . . . . . . . . . . . 41 130 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 41 132 1. Introduction 134 This document describes how QUIC [QUIC-TRANSPORT] is secured using 135 TLS [TLS13]. 137 TLS 1.3 provides critical latency improvements for connection 138 establishment over previous versions. Absent packet loss, most new 139 connections can be established and secured within a single round 140 trip; on subsequent connections between the same client and server, 141 the client can often send application data immediately, that is, 142 using a zero round trip setup. 144 This document describes how TLS acts as a security component of QUIC. 146 2. Notational Conventions 148 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 149 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 150 "OPTIONAL" in this document are to be interpreted as described in BCP 151 14 [RFC2119] [RFC8174] when, and only when, they appear in all 152 capitals, as shown here. 154 This document uses the terminology established in [QUIC-TRANSPORT]. 156 For brevity, the acronym TLS is used to refer to TLS 1.3, though a 157 newer version could be used (see Section 4.2). 159 2.1. TLS Overview 161 TLS provides two endpoints with a way to establish a means of 162 communication over an untrusted medium (that is, the Internet) that 163 ensures that messages they exchange cannot be observed, modified, or 164 forged. 166 Internally, TLS is a layered protocol, with the structure shown 167 below: 169 +--------------+--------------+--------------+ 170 | Handshake | Alerts | Application | 171 | Layer | | Data | 172 | | | | 173 +--------------+--------------+--------------+ 174 | | 175 | Record Layer | 176 | | 177 +--------------------------------------------+ 179 Each upper layer (handshake, alerts, and application data) is carried 180 as a series of typed TLS records. Records are individually 181 cryptographically protected and then transmitted over a reliable 182 transport (typically TCP) which provides sequencing and guaranteed 183 delivery. 185 Change Cipher Spec records cannot be sent in QUIC. 187 The TLS authenticated key exchange occurs between two entities: 188 client and server. The client initiates the exchange and the server 189 responds. If the key exchange completes successfully, both client 190 and server will agree on a secret. TLS supports both pre-shared key 191 (PSK) and Diffie-Hellman (DH) key exchanges. PSK is the basis for 192 0-RTT; the latter provides perfect forward secrecy (PFS) when the DH 193 keys are destroyed. 195 After completing the TLS handshake, the client will have learned and 196 authenticated an identity for the server and the server is optionally 197 able to learn and authenticate an identity for the client. TLS 198 supports X.509 [RFC5280] certificate-based authentication for both 199 server and client. 201 The TLS key exchange is resistant to tampering by attackers and it 202 produces shared secrets that cannot be controlled by either 203 participating peer. 205 TLS provides two basic handshake modes of interest to QUIC: 207 o A full 1-RTT handshake in which the client is able to send 208 application data after one round trip and the server immediately 209 responds after receiving the first handshake message from the 210 client. 212 o A 0-RTT handshake in which the client uses information it has 213 previously learned about the server to send application data 214 immediately. This application data can be replayed by an attacker 215 so it MUST NOT carry a self-contained trigger for any non- 216 idempotent action. 218 A simplified TLS handshake with 0-RTT application data is shown in 219 Figure 1. Note that this omits the EndOfEarlyData message, which is 220 not used in QUIC (see Section 8.3). 222 Client Server 224 ClientHello 225 (0-RTT Application Data) --------> 226 ServerHello 227 {EncryptedExtensions} 228 {Finished} 229 <-------- [Application Data] 230 {Finished} --------> 232 [Application Data] <-------> [Application Data] 234 () Indicates messages protected by early data (0-RTT) keys 235 {} Indicates messages protected using handshake keys 236 [] Indicates messages protected using application data 237 (1-RTT) keys 239 Figure 1: TLS Handshake with 0-RTT 241 Data is protected using a number of encryption levels: 243 o Plaintext 245 o Early Data (0-RTT) Keys 247 o Handshake Keys 249 o Application Data (1-RTT) Keys 251 Application data may appear only in the early data and application 252 data levels. Handshake and Alert messages may appear in any level. 254 The 0-RTT handshake is only possible if the client and server have 255 previously communicated. In the 1-RTT handshake, the client is 256 unable to send protected application data until it has received all 257 of the handshake messages sent by the server. 259 3. Protocol Overview 261 QUIC [QUIC-TRANSPORT] assumes responsibility for the confidentiality 262 and integrity protection of packets. For this it uses keys derived 263 from a TLS handshake [TLS13], but instead of carrying TLS records 264 over QUIC (as with TCP), TLS Handshake and Alert messages are carried 265 directly over the QUIC transport, which takes over the 266 responsibilities of the TLS record layer, as shown below. 268 +--------------+--------------+ +-------------+ 269 | TLS | TLS | | QUIC | 270 | Handshake | Alerts | | Applications| 271 | | | | (h2q, etc.) | 272 +--------------+--------------+-+-------------+ 273 | | 274 | QUIC Transport | 275 | (streams, reliability, congestion, etc.) | 276 | | 277 +---------------------------------------------+ 278 | | 279 | QUIC Packet Protection | 280 | | 281 +---------------------------------------------+ 283 QUIC also relies on TLS for authentication and negotiation of 284 parameters that are critical to security and performance. 286 Rather than a strict layering, these two protocols are co-dependent: 287 QUIC uses the TLS handshake; TLS uses the reliability, ordered 288 delivery, and record layer provided by QUIC. 290 At a high level, there are two main interactions between the TLS and 291 QUIC components: 293 o The TLS component sends and receives messages via the QUIC 294 component, with QUIC providing a reliable stream abstraction to 295 TLS. 297 o The TLS component provides a series of updates to the QUIC 298 component, including (a) new packet protection keys to install (b) 299 state changes such as handshake completion, the server 300 certificate, etc. 302 Figure 2 shows these interactions in more detail, with the QUIC 303 packet protection being called out specially. 305 +------------+ +------------+ 306 | |<- Handshake Messages ->| | 307 | |<---- 0-RTT Keys -------| | 308 | |<--- Handshake Keys-----| | 309 | QUIC |<---- 1-RTT Keys -------| TLS | 310 | |<--- Handshake Done ----| | 311 +------------+ +------------+ 312 | ^ 313 | Protect | Protected 314 v | Packet 315 +------------+ 316 | QUIC | 317 | Packet | 318 | Protection | 319 +------------+ 321 Figure 2: QUIC and TLS Interactions 323 Unlike TLS over TCP, QUIC applications which want to send data do not 324 send it through TLS "application_data" records. Rather, they send it 325 as QUIC STREAM frames which are then carried in QUIC packets. 327 4. Carrying TLS Messages 329 QUIC carries TLS handshake data in CRYPTO frames, each of which 330 consists of a contiguous block of handshake data identified by an 331 offset and length. Those frames are packaged into QUIC packets and 332 encrypted under the current TLS encryption level. As with TLS over 333 TCP, once TLS handshake data has been delivered to QUIC, it is QUIC's 334 responsibility to deliver it reliably. Each chunk of data that is 335 produced by TLS is associated with the set of keys that TLS is 336 currently using. If QUIC needs to retransmit that data, it MUST use 337 the same keys even if TLS has already updated to newer keys. 339 One important difference between TLS records (used with TCP) and QUIC 340 CRYPTO frames is that in QUIC multiple frames may appear in the same 341 QUIC packet as long as they are associated with the same encryption 342 level. For instance, an implementation might bundle a Handshake 343 message and an ACK for some Handshake data into the same packet. 345 Each encryption level has a specific list of frames which may appear 346 in it. The rules here generalize those of TLS, in that frames 347 associated with establishing the connection can usually appear at any 348 encryption level, whereas those associated with transferring data can 349 only appear in the 0-RTT and 1-RTT encryption levels: 351 o CRYPTO frames MAY appear in packets of any encryption level except 352 0-RTT. 354 o CONNECTION_CLOSE MAY appear in packets of any encryption level 355 other than 0-RTT. 357 o PADDING frames MAY appear in packets of any encryption level. 359 o ACK frames MAY appear in packets of any encryption level other 360 than 0-RTT, but can only acknowledge packets which appeared in 361 that packet number space. 363 o STREAM frames MUST ONLY appear in the 0-RTT and 1-RTT levels. 365 o All other frame types MUST only appear at the 1-RTT levels. 367 Because packets could be reordered on the wire, QUIC uses the packet 368 type to indicate which level a given packet was encrypted under, as 369 shown in Table 1. When multiple packets of different encryption 370 levels need to be sent, endpoints SHOULD use coalesced packets to 371 send them in the same UDP datagram. 373 +-----------------+------------------+-----------+ 374 | Packet Type | Encryption Level | PN Space | 375 +-----------------+------------------+-----------+ 376 | Initial | Initial secrets | Initial | 377 | | | | 378 | 0-RTT Protected | 0-RTT | 0/1-RTT | 379 | | | | 380 | Handshake | Handshake | Handshake | 381 | | | | 382 | Retry | N/A | N/A | 383 | | | | 384 | Short Header | 1-RTT | 0/1-RTT | 385 +-----------------+------------------+-----------+ 387 Table 1: Encryption Levels by Packet Type 389 Section 17 of [QUIC-TRANSPORT] shows how packets at the various 390 encryption levels fit into the handshake process. 392 4.1. Interface to TLS 394 As shown in Figure 2, the interface from QUIC to TLS consists of 395 three primary functions: 397 o Sending and receiving handshake messages 399 o Rekeying (both transmit and receive) 401 o Handshake state updates 403 Additional functions might be needed to configure TLS. 405 4.1.1. Sending and Receiving Handshake Messages 407 In order to drive the handshake, TLS depends on being able to send 408 and receive handshake messages. There are two basic functions on 409 this interface: one where QUIC requests handshake messages and one 410 where QUIC provides handshake packets. 412 Before starting the handshake QUIC provides TLS with the transport 413 parameters (see Section 8.2) that it wishes to carry. 415 A QUIC client starts TLS by requesting TLS handshake bytes from TLS. 416 The client acquires handshake bytes before sending its first packet. 417 A QUIC server starts the process by providing TLS with the client's 418 handshake bytes. 420 At any given time, the TLS stack at an endpoint will have a current 421 sending encryption level and receiving encryption level. Each 422 encryption level is associated with a different flow of bytes, which 423 is reliably transmitted to the peer in CRYPTO frames. When TLS 424 provides handshake bytes to be sent, they are appended to the current 425 flow and any packet that includes the CRYPTO frame is protected using 426 keys from the corresponding encryption level. 428 QUIC takes the unprotected content of TLS handshake records as the 429 content of CRYPTO frames. TLS record protection is not used by QUIC. 430 QUIC assembles CRYPTO frames into QUIC packets, which are protected 431 using QUIC packet protection. 433 When an endpoint receives a QUIC packet containing a CRYPTO frame 434 from the network, it proceeds as follows: 436 o If the packet was in the TLS receiving encryption level, sequence 437 the data into the input flow as usual. As with STREAM frames, the 438 offset is used to find the proper location in the data sequence. 439 If the result of this process is that new data is available, then 440 it is delivered to TLS in order. 442 o If the packet is from a previously installed encryption level, it 443 MUST not contain data which extends past the end of previously 444 received data in that flow. Implementations MUST treat any 445 violations of this requirement as a connection error of type 446 PROTOCOL_VIOLATION. 448 o If the packet is from a new encryption level, it is saved for 449 later processing by TLS. Once TLS moves to receiving from this 450 encryption level, saved data can be provided. When providing data 451 from any new encryption level to TLS, if there is data from a 452 previous encryption level that TLS has not consumed, this MUST be 453 treated as a connection error of type PROTOCOL_VIOLATION. 455 Each time that TLS is provided with new data, new handshake bytes are 456 requested from TLS. TLS might not provide any bytes if the handshake 457 messages it has received are incomplete or it has no data to send. 459 Once the TLS handshake is complete, this is indicated to QUIC along 460 with any final handshake bytes that TLS needs to send. TLS also 461 provides QUIC with the transport parameters that the peer advertised 462 during the handshake. 464 Once the handshake is complete, TLS becomes passive. TLS can still 465 receive data from its peer and respond in kind, but it will not need 466 to send more data unless specifically requested - either by an 467 application or QUIC. One reason to send data is that the server 468 might wish to provide additional or updated session tickets to a 469 client. 471 When the handshake is complete, QUIC only needs to provide TLS with 472 any data that arrives in CRYPTO streams. In the same way that is 473 done during the handshake, new data is requested from TLS after 474 providing received data. 476 Important: Until the handshake is reported as complete, the 477 connection and key exchange are not properly authenticated at the 478 server. Even though 1-RTT keys are available to a server after 479 receiving the first handshake messages from a client, the server 480 cannot consider the client to be authenticated until it receives 481 and validates the client's Finished message. 483 The requirement for the server to wait for the client Finished 484 message creates a dependency on that message being delivered. A 485 client can avoid the potential for head-of-line blocking that this 486 implies by sending a copy of the CRYPTO frame that carries the 487 Finished message in multiple packets. This enables immediate 488 server processing for those packets. 490 4.1.2. Encryption Level Changes 492 As keys for new encryption levels become available, TLS provides QUIC 493 with those keys. Separately, as TLS starts using keys at a given 494 encryption level, TLS indicates to QUIC that it is now reading or 495 writing with keys at that encryption level. These events are not 496 asynchronous; they always occur immediately after TLS is provided 497 with new handshake bytes, or after TLS produces handshake bytes. 499 TLS provides QUIC with three items as a new encryption level becomes 500 available: 502 o A secret 504 o An Authenticated Encryption with Associated Data (AEAD) function 506 o A Key Derivation Function (KDF) 508 These values are based on the values that TLS negotiates and are used 509 by QUIC to generate packet and header protection keys (see Section 5 510 and Section 5.4). 512 If 0-RTT is possible, it is ready after the client sends a TLS 513 ClientHello message or the server receives that message. After 514 providing a QUIC client with the first handshake bytes, the TLS stack 515 might signal the change to 0-RTT keys. On the server, after 516 receiving handshake bytes that contain a ClientHello message, a TLS 517 server might signal that 0-RTT keys are available. 519 Although TLS only uses one encryption level at a time, QUIC may use 520 more than one level. For instance, after sending its Finished 521 message (using a CRYPTO frame at the Handshake encryption level) an 522 endpoint can send STREAM data (in 1-RTT encryption). If the Finished 523 message is lost, the endpoint uses the Handshake encryption level to 524 retransmit the lost message. Reordering or loss of packets can mean 525 that QUIC will need to handle packets at multiple encryption levels. 526 During the handshake, this means potentially handling packets at 527 higher and lower encryption levels than the current encryption level 528 used by TLS. 530 In particular, server implementations need to be able to read packets 531 at the Handshake encryption level at the same time as the 0-RTT 532 encryption level. A client could interleave ACK frames that are 533 protected with Handshake keys with 0-RTT data and the server needs to 534 process those acknowledgments in order to detect lost Handshake 535 packets. 537 4.1.3. TLS Interface Summary 539 Figure 3 summarizes the exchange between QUIC and TLS for both client 540 and server. Each arrow is tagged with the encryption level used for 541 that transmission. 543 Client Server 545 Get Handshake 546 Initial -------------> 547 Rekey tx to 0-RTT Keys 548 0-RTT ---------------> 549 Handshake Received 550 Get Handshake 551 <------------- Initial 552 Rekey rx to 0-RTT keys 553 Handshake Received 554 Rekey rx to Handshake keys 555 Get Handshake 556 <----------- Handshake 557 Rekey tx to 1-RTT keys 558 <--------------- 1-RTT 559 Handshake Received 560 Rekey rx to Handshake keys 561 Handshake Received 562 Get Handshake 563 Handshake Complete 564 Handshake -----------> 565 Rekey tx to 1-RTT keys 566 1-RTT ---------------> 567 Handshake Received 568 Rekey rx to 1-RTT keys 569 Get Handshake 570 Handshake Complete 571 <--------------- 1-RTT 572 Handshake Received 574 Figure 3: Interaction Summary between QUIC and TLS 576 4.2. TLS Version 578 This document describes how TLS 1.3 [TLS13] is used with QUIC. 580 In practice, the TLS handshake will negotiate a version of TLS to 581 use. This could result in a newer version of TLS than 1.3 being 582 negotiated if both endpoints support that version. This is 583 acceptable provided that the features of TLS 1.3 that are used by 584 QUIC are supported by the newer version. 586 A badly configured TLS implementation could negotiate TLS 1.2 or 587 another older version of TLS. An endpoint MUST terminate the 588 connection if a version of TLS older than 1.3 is negotiated. 590 4.3. ClientHello Size 592 QUIC requires that the first Initial packet from a client contain an 593 entire cryptographic handshake message, which for TLS is the 594 ClientHello. Though a packet larger than 1200 bytes might be 595 supported by the path, a client improves the likelihood that a packet 596 is accepted if it ensures that the first ClientHello message is small 597 enough to stay within this limit. 599 QUIC packet and framing add at least 36 bytes of overhead to the 600 ClientHello message. That overhead increases if the client chooses a 601 connection ID without zero length. Overheads also do not include the 602 token or a connection ID longer than 8 bytes, both of which might be 603 required if a server sends a Retry packet. 605 A typical TLS ClientHello can easily fit into a 1200 byte packet. 606 However, in addition to the overheads added by QUIC, there are 607 several variables that could cause this limit to be exceeded. Large 608 session tickets, multiple or large key shares, and long lists of 609 supported ciphers, signature algorithms, versions, QUIC transport 610 parameters, and other negotiable parameters and extensions could 611 cause this message to grow. 613 For servers, in addition to connection IDs and tokens, the size of 614 TLS session tickets can have an effect on a client's ability to 615 connect. Minimizing the size of these values increases the 616 probability that they can be successfully used by a client. 618 A client is not required to fit the ClientHello that it sends in 619 response to a HelloRetryRequest message into a single UDP datagram. 621 The TLS implementation does not need to ensure that the ClientHello 622 is sufficiently large. QUIC PADDING frames are added to increase the 623 size of the packet as necessary. 625 4.4. Peer Authentication 627 The requirements for authentication depend on the application 628 protocol that is in use. TLS provides server authentication and 629 permits the server to request client authentication. 631 A client MUST authenticate the identity of the server. This 632 typically involves verification that the identity of the server is 633 included in a certificate and that the certificate is issued by a 634 trusted entity (see for example [RFC2818]). 636 A server MAY request that the client authenticate during the 637 handshake. A server MAY refuse a connection if the client is unable 638 to authenticate when requested. The requirements for client 639 authentication vary based on application protocol and deployment. 641 A server MUST NOT use post-handshake client authentication (see 642 Section 4.6.2 of [TLS13]). 644 4.5. Enabling 0-RTT 646 In order to be usable for 0-RTT, TLS MUST provide a NewSessionTicket 647 message that contains the "early_data" extension with a 648 max_early_data_size of 0xffffffff; the amount of data which the 649 client can send in 0-RTT is controlled by the "initial_max_data" 650 transport parameter supplied by the server. A client MUST treat 651 receipt of a NewSessionTicket that contains an "early_data" extension 652 with any other value as a connection error of type 653 PROTOCOL_VIOLATION. 655 Early data within the TLS connection MUST NOT be used. As it is for 656 other TLS application data, a server MUST treat receiving early data 657 on the TLS connection as a connection error of type 658 PROTOCOL_VIOLATION. 660 4.6. Rejecting 0-RTT 662 A server rejects 0-RTT by rejecting 0-RTT at the TLS layer. This 663 also prevents QUIC from sending 0-RTT data. A server will always 664 reject 0-RTT if it sends a TLS HelloRetryRequest. 666 When 0-RTT is rejected, all connection characteristics that the 667 client assumed might be incorrect. This includes the choice of 668 application protocol, transport parameters, and any application 669 configuration. The client therefore MUST reset the state of all 670 streams, including application state bound to those streams. 672 A client MAY attempt to send 0-RTT again if it receives a Retry or 673 Version Negotiation packet. These packets do not signify rejection 674 of 0-RTT. 676 4.7. HelloRetryRequest 678 In TLS over TCP, the HelloRetryRequest feature (see Section 4.1.4 of 679 [TLS13]) can be used to correct a client's incorrect KeyShare 680 extension as well as for a stateless round-trip check. From the 681 perspective of QUIC, this just looks like additional messages carried 682 in the Initial encryption level. Although it is in principle 683 possible to use this feature for address verification in QUIC, QUIC 684 implementations SHOULD instead use the Retry feature (see Section 8.1 685 of [QUIC-TRANSPORT]). HelloRetryRequest is still used to request key 686 shares. 688 4.8. TLS Errors 690 If TLS experiences an error, it generates an appropriate alert as 691 defined in Section 6 of [TLS13]. 693 A TLS alert is turned into a QUIC connection error by converting the 694 one-byte alert description into a QUIC error code. The alert 695 description is added to 0x100 to produce a QUIC error code from the 696 range reserved for CRYPTO_ERROR. The resulting value is sent in a 697 QUIC CONNECTION_CLOSE frame. 699 The alert level of all TLS alerts is "fatal"; a TLS stack MUST NOT 700 generate alerts at the "warning" level. 702 4.9. Discarding Unused Keys 704 After QUIC moves to a new encryption level, packet protection keys 705 for previous encryption levels can be discarded. This occurs several 706 times during the handshake, as well as when keys are updated (see 707 Section 6). Initial packet protection keys are treated specially, 708 see Section 4.10. 710 Packet protection keys are not discarded immediately when new keys 711 are available. If packets from a lower encryption level contain 712 CRYPTO frames, frames that retransmit that data MUST be sent at the 713 same encryption level. Similarly, an endpoint generates 714 acknowledgements for packets at the same encryption level as the 715 packet being acknowledged. Thus, it is possible that keys for a 716 lower encryption level are needed for a short time after keys for a 717 newer encryption level are available. 719 An endpoint cannot discard keys for a given encryption level unless 720 it has both received and acknowledged all CRYPTO frames for that 721 encryption level and when all CRYPTO frames for that encryption level 722 have been acknowledged by its peer. However, this does not guarantee 723 that no further packets will need to be received or sent at that 724 encryption level because a peer might not have received all the 725 acknowledgements necessary to reach the same state. 727 After all CRYPTO frames for a given encryption level have been sent 728 and all expected CRYPTO frames received, and all the corresponding 729 acknowledgments have been received or sent, an endpoint starts a 730 timer. For 0-RTT keys, which do not carry CRYPTO frames, this timer 731 starts when the first packets protected with 1-RTT are sent or 732 received. To limit the effect of packet loss around a change in 733 keys, endpoints MUST retain packet protection keys for that 734 encryption level for at least three times the current Probe Timeout 735 (PTO) interval as defined in [QUIC-RECOVERY]. Retaining keys for 736 this interval allows packets containing CRYPTO or ACK frames at that 737 encryption level to be sent if packets are determined to be lost or 738 new packets require acknowledgment. 740 Though an endpoint might retain older keys, new data MUST be sent at 741 the highest currently-available encryption level. Only ACK frames 742 and retransmissions of data in CRYPTO frames are sent at a previous 743 encryption level. These packets MAY also include PADDING frames. 745 Once this timer expires, an endpoint MUST NOT either accept or 746 generate new packets using those packet protection keys. An endpoint 747 can discard packet protection keys for that encryption level. 749 Key updates (see Section 6) can be used to update 1-RTT keys before 750 keys from other encryption levels are discarded. In that case, 751 packets protected with the newest packet protection keys and packets 752 sent two updates prior will appear to use the same keys. After the 753 handshake is complete, endpoints only need to maintain the two latest 754 sets of packet protection keys and MAY discard older keys. Updating 755 keys multiple times rapidly can cause packets to be effectively lost 756 if packets are significantly delayed. Because key updates can only 757 be performed once per round trip time, only packets that are delayed 758 by more than a round trip will be lost as a result of changing keys; 759 such packets will be marked as lost before this, as they leave a gap 760 in the sequence of packet numbers. 762 4.10. Discarding Initial Keys 764 Packets protected with Initial secrets (Section 5.2) are not 765 authenticated, meaning that an attacker could spoof packets with the 766 intent to disrupt a connection. To limit these attacks, Initial 767 packet protection keys can be discarded more aggressively than other 768 keys. 770 The successful use of Handshake packets indicates that no more 771 Initial packets need to be exchanged, as these keys can only be 772 produced after receiving all CRYPTO frames from Initial packets. 773 Thus, a client MUST discard Initial keys when it first sends a 774 Handshake packet and a server MUST discard Initial keys when it first 775 successfully processes a Handshake packet. Endpoints MUST NOT send 776 Initial packets after this point. 778 This results in abandoning loss recovery state for the Initial 779 encryption level and ignoring any outstanding Initial packets. 781 5. Packet Protection 783 As with TLS over TCP, QUIC protects packets with keys derived from 784 the TLS handshake, using the AEAD algorithm negotiated by TLS. 786 5.1. Packet Protection Keys 788 QUIC derives packet protection keys in the same way that TLS derives 789 record protection keys. 791 Each encryption level has separate secret values for protection of 792 packets sent in each direction. These traffic secrets are derived by 793 TLS (see Section 7.1 of [TLS13]) and are used by QUIC for all 794 encryption levels except the Initial encryption level. The secrets 795 for the Initial encryption level are computed based on the client's 796 initial Destination Connection ID, as described in Section 5.2. 798 The keys used for packet protection are computed from the TLS secrets 799 using the KDF provided by TLS. In TLS 1.3, the HKDF-Expand-Label 800 function described in Section 7.1 of [TLS13]) is used, using the hash 801 function from the negotiated cipher suite. Other versions of TLS 802 MUST provide a similar function in order to be used QUIC. 804 The current encryption level secret and the label "quic key" are 805 input to the KDF to produce the AEAD key; the label "quic iv" is used 806 to derive the IV, see Section 5.3. The header protection key uses 807 the "quic hp" label, see Section 5.4). Using these labels provides 808 key separation between QUIC and TLS, see Section 9.4. 810 The KDF used for initial secrets is always the HKDF-Expand-Label 811 function from TLS 1.3 (see Section 5.2). 813 5.2. Initial Secrets 815 Initial packets are protected with a secret derived from the 816 Destination Connection ID field from the client's first Initial 817 packet of the connection. Specifically: 819 initial_salt = 0xef4fb0abb47470c41befcf8031334fae485e09a0 820 initial_secret = HKDF-Extract(initial_salt, 821 client_dst_connection_id) 823 client_initial_secret = HKDF-Expand-Label(initial_secret, 824 "client in", "", 825 Hash.length) 826 server_initial_secret = HKDF-Expand-Label(initial_secret, 827 "server in", "", 828 Hash.length) 830 The hash function for HKDF when deriving initial secrets and keys is 831 SHA-256 [SHA]. 833 The connection ID used with HKDF-Expand-Label is the Destination 834 Connection ID in the Initial packet sent by the client. This will be 835 a randomly-selected value unless the client creates the Initial 836 packet after receiving a Retry packet, where the Destination 837 Connection ID is selected by the server. 839 The value of initial_salt is a 20 byte sequence shown in the figure 840 in hexadecimal notation. Future versions of QUIC SHOULD generate a 841 new salt value, thus ensuring that the keys are different for each 842 version of QUIC. This prevents a middlebox that only recognizes one 843 version of QUIC from seeing or modifying the contents of handshake 844 packets from future versions. 846 The HKDF-Expand-Label function defined in TLS 1.3 MUST be used for 847 Initial packets even where the TLS versions offered do not include 848 TLS 1.3. 850 Appendix A contains test vectors for the initial packet encryption. 852 Note: The Destination Connection ID is of arbitrary length, and it 853 could be zero length if the server sends a Retry packet with a 854 zero-length Source Connection ID field. In this case, the Initial 855 keys provide no assurance to the client that the server received 856 its packet; the client has to rely on the exchange that included 857 the Retry packet for that property. 859 5.3. AEAD Usage 861 The Authentication Encryption with Associated Data (AEAD) [AEAD] 862 function used for QUIC packet protection is the AEAD that is 863 negotiated for use with the TLS connection. For example, if TLS is 864 using the TLS_AES_128_GCM_SHA256, the AEAD_AES_128_GCM function is 865 used. 867 Packets are protected prior to applying header protection 868 (Section 5.4). The unprotected packet header is part of the 869 associated data (A). When removing packet protection, an endpoint 870 first removes the header protection. 872 All QUIC packets other than Version Negotiation and Retry packets are 873 protected with an AEAD algorithm [AEAD]. Prior to establishing a 874 shared secret, packets are protected with AEAD_AES_128_GCM and a key 875 derived from the destination connection ID in the client's first 876 Initial packet (see Section 5.2). This provides protection against 877 off-path attackers and robustness against QUIC version unaware 878 middleboxes, but not against on-path attackers. 880 QUIC can use any of the ciphersuites defined in [TLS13] with the 881 exception of TLS_AES_128_CCM_8_SHA256. The AEAD for that 882 ciphersuite, AEAD_AES_128_CCM_8 [CCM], does not produce a large 883 enough authentication tag for use with the header protection designs 884 provided (see Section 5.4). All other ciphersuites defined in 885 [TLS13] have a 16-byte authentication tag and produce an output 16 886 bytes larger than their input. 888 The key and IV for the packet are computed as described in 889 Section 5.1. The nonce, N, is formed by combining the packet 890 protection IV with the packet number. The 62 bits of the 891 reconstructed QUIC packet number in network byte order are left- 892 padded with zeros to the size of the IV. The exclusive OR of the 893 padded packet number and the IV forms the AEAD nonce. 895 The associated data, A, for the AEAD is the contents of the QUIC 896 header, starting from the flags byte in either the short or long 897 header, up to and including the unprotected packet number. 899 The input plaintext, P, for the AEAD is the payload of the QUIC 900 packet, as described in [QUIC-TRANSPORT]. 902 The output ciphertext, C, of the AEAD is transmitted in place of P. 904 Some AEAD functions have limits for how many packets can be encrypted 905 under the same key and IV (see for example [AEBounds]). This might 906 be lower than the packet number limit. An endpoint MUST initiate a 907 key update (Section 6) prior to exceeding any limit set for the AEAD 908 that is in use. 910 5.4. Header Protection 912 Parts of QUIC packet headers, in particular the Packet Number field, 913 are protected using a key that is derived separate to the packet 914 protection key and IV. The key derived using the "quic hp" label is 915 used to provide confidentiality protection for those fields that are 916 not exposed to on-path elements. 918 This protection applies to the least-significant bits of the first 919 byte, plus the Packet Number field. The four least-significant bits 920 of the first byte are protected for packets with long headers; the 921 five least significant bits of the first byte are protected for 922 packets with short headers. For both header forms, this covers the 923 reserved bits and the Packet Number Length field; the Key Phase bit 924 is also protected for packets with a short header. 926 The same header protection key is used for the duration of the 927 connection, with the value not changing after a key update (see 928 Section 6). This allows header protection to be used to protect the 929 key phase. 931 This process does not apply to Retry or Version Negotiation packets, 932 which do not contain a protected payload or any of the fields that 933 are protected by this process. 935 5.4.1. Header Protection Application 937 Header protection is applied after packet protection is applied (see 938 Section 5.3). The ciphertext of the packet is sampled and used as 939 input to an encryption algorithm. The algorithm used depends on the 940 negotiated AEAD. 942 The output of this algorithm is a 5 byte mask which is applied to the 943 protected header fields using exclusive OR. The least significant 944 bits of the first byte of the packet are masked by the least 945 significant bits of the first mask byte, and the packet number is 946 masked with the remaining bytes. Any unused bytes of mask that might 947 result from a shorter packet number encoding are unused. 949 Figure 4 shows a sample algorithm for applying header protection. 950 Removing header protection only differs in the order in which the 951 packet number length (pn_length) is determined. 953 mask = header_protection(hp_key, sample) 955 pn_length = (packet[0] & 0x03) + 1 956 if (packet[0] & 0x80) == 0x80: 957 # Long header: 4 bits masked 958 packet[0] ^= mask[0] & 0x0f 959 else: 960 # Short header: 5 bits masked 961 packet[0] ^= mask[0] & 0x1f 963 # pn_offset is the start of the Packet Number field. 964 packet[pn_offset:pn_offset+pn_length] ^= mask[1:1+pn_length] 966 Figure 4: Header Protection Pseudocode 968 Figure 5 shows the protected fields of long and short headers marked 969 with an E. Figure 5 also shows the sampled fields. 971 Long Header: 972 +-+-+-+-+-+-+-+-+ 973 |1|1|T T|E E E E| 974 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 975 | Version -> Length Fields ... 976 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 978 Short Header: 979 +-+-+-+-+-+-+-+-+ 980 |0|1|S|E E E E E| 981 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 982 | Destination Connection ID (0/32..144) ... 983 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 985 Common Fields: 986 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 987 |E E E E E E E E E Packet Number (8/16/24/32) E E E E E E E E... 988 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 989 | [Protected Payload (8/16/24)] ... 990 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 991 | Sampled part of Protected Payload (128) ... 992 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 993 | Protected Payload Remainder (*) ... 994 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 996 Figure 5: Header Protection and Ciphertext Sample 998 Before a TLS ciphersuite can be used with QUIC, a header protection 999 algorithm MUST be specified for the AEAD used with that ciphersuite. 1000 This document defines algorithms for AEAD_AES_128_GCM, 1001 AEAD_AES_128_CCM, AEAD_AES_256_GCM, AEAD_AES_256_CCM (all AES AEADs 1002 are defined in [AEAD]), and AEAD_CHACHA20_POLY1305 [CHACHA]. Prior 1003 to TLS selecting a ciphersuite, AES header protection is used 1004 (Section 5.4.3), matching the AEAD_AES_128_GCM packet protection. 1006 5.4.2. Header Protection Sample 1008 The header protection algorithm uses both the header protection key 1009 and a sample of the ciphertext from the packet Payload field. 1011 The same number of bytes are always sampled, but an allowance needs 1012 to be made for the endpoint removing protection, which will not know 1013 the length of the Packet Number field. In sampling the packet 1014 ciphertext, the Packet Number field is assumed to be 4 bytes long 1015 (its maximum possible encoded length). 1017 An endpoint MUST discard packets that are not long enough to contain 1018 a complete sample. 1020 To ensure that sufficient data is available for sampling, packets are 1021 padded so that the combined lengths of the encoded packet number and 1022 protected payload is at least 4 bytes longer than the sample required 1023 for header protection. For the AEAD functions defined in [TLS13], 1024 which have 16-byte expansions and 16-byte header protection samples, 1025 this results in needing at least 3 bytes of frames in the unprotected 1026 payload if the packet number is encoded on a single byte, or 2 bytes 1027 of frames for a 2-byte packet number encoding. 1029 The sampled ciphertext for a packet with a short header can be 1030 determined by the following pseudocode: 1032 sample_offset = 1 + len(connection_id) + 4 1034 sample = packet[sample_offset..sample_offset+sample_length] 1036 For example, for a packet with a short header, an 8 byte connection 1037 ID, and protected with AEAD_AES_128_GCM, the sample takes bytes 13 to 1038 28 inclusive (using zero-based indexing). 1040 A packet with a long header is sampled in the same way, noting that 1041 multiple QUIC packets might be included in the same UDP datagram and 1042 that each one is handled separately. 1044 sample_offset = 6 + len(destination_connection_id) + 1045 len(source_connection_id) + 1046 len(payload_length) + 4 1047 if packet_type == Initial: 1048 sample_offset += len(token_length) + 1049 len(token) 1051 sample = packet[sample_offset..sample_offset+sample_length] 1053 5.4.3. AES-Based Header Protection 1055 This section defines the packet protection algorithm for 1056 AEAD_AES_128_GCM, AEAD_AES_128_CCM, AEAD_AES_256_GCM, and 1057 AEAD_AES_256_CCM. AEAD_AES_128_GCM and AEAD_AES_128_CCM use 128-bit 1058 AES [AES] in electronic code-book (ECB) mode. AEAD_AES_256_GCM, and 1059 AEAD_AES_256_CCM use 256-bit AES in ECB mode. 1061 This algorithm samples 16 bytes from the packet ciphertext. This 1062 value is used as the input to AES-ECB. In pseudocode: 1064 mask = AES-ECB(hp_key, sample) 1066 5.4.4. ChaCha20-Based Header Protection 1068 When AEAD_CHACHA20_POLY1305 is in use, header protection uses the raw 1069 ChaCha20 function as defined in Section 2.4 of [CHACHA]. This uses a 1070 256-bit key and 16 bytes sampled from the packet protection output. 1072 The first 4 bytes of the sampled ciphertext are interpreted as a 1073 32-bit number in little-endian order and are used as the block count. 1074 The remaining 12 bytes are interpreted as three concatenated 32-bit 1075 numbers in little-endian order and used as the nonce. 1077 The encryption mask is produced by invoking ChaCha20 to protect 5 1078 zero bytes. In pseudocode: 1080 counter = DecodeLE(sample[0..3]) 1081 nonce = DecodeLE(sample[4..7], sample[8..11], sample[12..15]) 1082 mask = ChaCha20(hp_key, counter, nonce, {0,0,0,0,0}) 1084 5.5. Receiving Protected Packets 1086 Once an endpoint successfully receives a packet with a given packet 1087 number, it MUST discard all packets in the same packet number space 1088 with higher packet numbers if they cannot be successfully unprotected 1089 with either the same key, or - if there is a key update - the next 1090 packet protection key (see Section 6). Similarly, a packet that 1091 appears to trigger a key update, but cannot be unprotected 1092 successfully MUST be discarded. 1094 Failure to unprotect a packet does not necessarily indicate the 1095 existence of a protocol error in a peer or an attack. The truncated 1096 packet number encoding used in QUIC can cause packet numbers to be 1097 decoded incorrectly if they are delayed significantly. 1099 5.6. Use of 0-RTT Keys 1101 If 0-RTT keys are available (see Section 4.5), the lack of replay 1102 protection means that restrictions on their use are necessary to 1103 avoid replay attacks on the protocol. 1105 A client MUST only use 0-RTT keys to protect data that is idempotent. 1106 A client MAY wish to apply additional restrictions on what data it 1107 sends prior to the completion of the TLS handshake. A client 1108 otherwise treats 0-RTT keys as equivalent to 1-RTT keys, except that 1109 it MUST NOT send ACKs with 0-RTT keys. 1111 A client that receives an indication that its 0-RTT data has been 1112 accepted by a server can send 0-RTT data until it receives all of the 1113 server's handshake messages. A client SHOULD stop sending 0-RTT data 1114 if it receives an indication that 0-RTT data has been rejected. 1116 A server MUST NOT use 0-RTT keys to protect packets; it uses 1-RTT 1117 keys to protect acknowledgements of 0-RTT packets. A client MUST NOT 1118 attempt to decrypt 0-RTT packets it receives and instead MUST discard 1119 them. 1121 Note: 0-RTT data can be acknowledged by the server as it receives 1122 it, but any packets containing acknowledgments of 0-RTT data 1123 cannot have packet protection removed by the client until the TLS 1124 handshake is complete. The 1-RTT keys necessary to remove packet 1125 protection cannot be derived until the client receives all server 1126 handshake messages. 1128 5.7. Receiving Out-of-Order Protected Frames 1130 Due to reordering and loss, protected packets might be received by an 1131 endpoint before the final TLS handshake messages are received. A 1132 client will be unable to decrypt 1-RTT packets from the server, 1133 whereas a server will be able to decrypt 1-RTT packets from the 1134 client. 1136 However, a server MUST NOT process data from incoming 1-RTT protected 1137 packets before verifying either the client Finished message or - in 1138 the case that the server has chosen to use a pre-shared key - the 1139 pre-shared key binder (see Section 4.2.11 of [TLS13]). Verifying 1140 these values provides the server with an assurance that the 1141 ClientHello has not been modified. Packets protected with 1-RTT keys 1142 MAY be stored and later decrypted and used once the handshake is 1143 complete. 1145 A server could receive packets protected with 0-RTT keys prior to 1146 receiving a TLS ClientHello. The server MAY retain these packets for 1147 later decryption in anticipation of receiving a ClientHello. 1149 6. Key Update 1151 Once the 1-RTT keys are established and the short header is in use, 1152 it is possible to update the keys. The KEY_PHASE bit in the short 1153 header is used to indicate whether key updates have occurred. The 1154 KEY_PHASE bit is initially set to 0 and then inverted with each key 1155 update. 1157 The KEY_PHASE bit allows a recipient to detect a change in keying 1158 material without necessarily needing to receive the first packet that 1159 triggered the change. An endpoint that notices a changed KEY_PHASE 1160 bit can update keys and decrypt the packet that contains the changed 1161 bit. 1163 This mechanism replaces the TLS KeyUpdate message. Endpoints MUST 1164 NOT send a TLS KeyUpdate message. Endpoints MUST treat the receipt 1165 of a TLS KeyUpdate message as a connection error of type 0x10a, 1166 equivalent to a fatal TLS alert of unexpected_message (see 1167 Section 4.8). 1169 An endpoint MUST NOT initiate more than one key update at a time. A 1170 new key cannot be used until the endpoint has received and 1171 successfully decrypted a packet with a matching KEY_PHASE. 1173 A receiving endpoint detects an update when the KEY_PHASE bit does 1174 not match what it is expecting. It creates a new secret (see 1175 Section 7.2 of [TLS13]) and the corresponding read key and IV using 1176 the KDF function provided by TLS. The header protection key is not 1177 updated. 1179 If the packet can be decrypted and authenticated using the updated 1180 key and IV, then the keys the endpoint uses for packet protection are 1181 also updated. The next packet sent by the endpoint will then use the 1182 new keys. 1184 An endpoint does not always need to send packets when it detects that 1185 its peer has updated keys. The next packet that it sends will simply 1186 use the new keys. If an endpoint detects a second update before it 1187 has sent any packets with updated keys, it indicates that its peer 1188 has updated keys twice without awaiting a reciprocal update. An 1189 endpoint MUST treat consecutive key updates as a fatal error and 1190 abort the connection. 1192 An endpoint SHOULD retain old keys for a period of no more than three 1193 times the Probe Timeout (PTO, see [QUIC-RECOVERY]). After this 1194 period, old keys and their corresponding secrets SHOULD be discarded. 1195 Retaining keys allow endpoints to process packets that were sent with 1196 old keys and delayed in the network. Packets with higher packet 1197 numbers always use the updated keys and MUST NOT be decrypted with 1198 old keys. 1200 This ensures that once the handshake is complete, packets with the 1201 same KEY_PHASE will have the same packet protection keys, unless 1202 there are multiple key updates in a short time frame succession and 1203 significant packet reordering. 1205 Initiating Peer Responding Peer 1207 @M QUIC Frames 1208 New Keys -> @N 1209 @N QUIC Frames 1210 --------> 1211 QUIC Frames @M 1212 New Keys -> @N 1213 QUIC Frames @N 1214 <-------- 1216 Figure 6: Key Update 1218 A packet that triggers a key update could arrive after successfully 1219 processing a packet with a higher packet number. This is only 1220 possible if there is a key compromise and an attack, or if the peer 1221 is incorrectly reverting to use of old keys. Because the latter 1222 cannot be differentiated from an attack, an endpoint MUST immediately 1223 terminate the connection if it detects this condition. 1225 In deciding when to update keys, endpoints MUST NOT exceed the limits 1226 for use of specific keys, as described in Section 5.5 of [TLS13]. 1228 7. Security of Initial Messages 1230 Initial packets are not protected with a secret key, so they are 1231 subject to potential tampering by an attacker. QUIC provides 1232 protection against attackers that cannot read packets, but does not 1233 attempt to provide additional protection against attacks where the 1234 attacker can observe and inject packets. Some forms of tampering - 1235 such as modifying the TLS messages themselves - are detectable, but 1236 some - such as modifying ACKs - are not. 1238 For example, an attacker could inject a packet containing an ACK 1239 frame that makes it appear that a packet had not been received or to 1240 create a false impression of the state of the connection (e.g., by 1241 modifying the ACK Delay). Note that such a packet could cause a 1242 legitimate packet to be dropped as a duplicate. Implementations 1243 SHOULD use caution in relying on any data which is contained in 1244 Initial packets that is not otherwise authenticated. 1246 It is also possible for the attacker to tamper with data that is 1247 carried in Handshake packets, but because that tampering requires 1248 modifying TLS handshake messages, that tampering will cause the TLS 1249 handshake to fail. 1251 8. QUIC-Specific Additions to the TLS Handshake 1253 QUIC uses the TLS handshake for more than just negotiation of 1254 cryptographic parameters. The TLS handshake validates protocol 1255 version selection, provides preliminary values for QUIC transport 1256 parameters, and allows a server to perform return routeability checks 1257 on clients. 1259 8.1. Protocol and Version Negotiation 1261 The QUIC version negotiation mechanism is used to negotiate the 1262 version of QUIC that is used prior to the completion of the 1263 handshake. However, this packet is not authenticated, enabling an 1264 active attacker to force a version downgrade. 1266 To ensure that a QUIC version downgrade is not forced by an attacker, 1267 version information is copied into the TLS handshake, which provides 1268 integrity protection for the QUIC negotiation. This does not prevent 1269 version downgrade prior to the completion of the handshake, though it 1270 means that a downgrade causes a handshake failure. 1272 QUIC requires that the cryptographic handshake provide authenticated 1273 protocol negotiation. TLS uses Application Layer Protocol 1274 Negotiation (ALPN) [RFC7301] to select an application protocol. 1275 Unless another mechanism is used for agreeing on an application 1276 protocol, endpoints MUST use ALPN for this purpose. When using ALPN, 1277 endpoints MUST abort a connection if an application protocol is not 1278 negotiated. 1280 An application-layer protocol MAY restrict the QUIC versions that it 1281 can operate over. Servers MUST select an application protocol 1282 compatible with the QUIC version that the client has selected. If 1283 the server cannot select a compatible combination of application 1284 protocol and QUIC version, it MUST abort the connection. A client 1285 MUST abort a connection if the server picks an incompatible 1286 combination of QUIC version and ALPN identifier. 1288 8.2. QUIC Transport Parameters Extension 1290 QUIC transport parameters are carried in a TLS extension. Different 1291 versions of QUIC might define a different format for this struct. 1293 Including transport parameters in the TLS handshake provides 1294 integrity protection for these values. 1296 enum { 1297 quic_transport_parameters(0xffa5), (65535) 1298 } ExtensionType; 1300 The "extension_data" field of the quic_transport_parameters extension 1301 contains a value that is defined by the version of QUIC that is in 1302 use. The quic_transport_parameters extension carries a 1303 TransportParameters when the version of QUIC defined in 1304 [QUIC-TRANSPORT] is used. 1306 The quic_transport_parameters extension is carried in the ClientHello 1307 and the EncryptedExtensions messages during the handshake. 1309 While the transport parameters are technically available prior to the 1310 completion of the handshake, they cannot be fully trusted until the 1311 handshake completes, and reliance on them should be minimized. 1312 However, any tampering with the parameters will cause the handshake 1313 to fail. 1315 Endpoints MUST NOT send this extension in a TLS connection that does 1316 not use QUIC (such as the use of TLS with TCP defined in [TLS13]). A 1317 fatal unsupported_extension alert MUST be sent if this extension is 1318 received when the transport is not QUIC. 1320 8.3. Removing the EndOfEarlyData Message 1322 The TLS EndOfEarlyData message is not used with QUIC. QUIC does not 1323 rely on this message to mark the end of 0-RTT data or to signal the 1324 change to Handshake keys. 1326 Clients MUST NOT send the EndOfEarlyData message. A server MUST 1327 treat receipt of a CRYPTO frame in a 0-RTT packet as a connection 1328 error of type PROTOCOL_VIOLATION. 1330 As a result, EndOfEarlyData does not appear in the TLS handshake 1331 transcript. 1333 9. Security Considerations 1335 There are likely to be some real clangers here eventually, but the 1336 current set of issues is well captured in the relevant sections of 1337 the main text. 1339 Never assume that because it isn't in the security considerations 1340 section it doesn't affect security. Most of this document does. 1342 9.1. Packet Reflection Attack Mitigation 1344 A small ClientHello that results in a large block of handshake 1345 messages from a server can be used in packet reflection attacks to 1346 amplify the traffic generated by an attacker. 1348 QUIC includes three defenses against this attack. First, the packet 1349 containing a ClientHello MUST be padded to a minimum size. Second, 1350 if responding to an unverified source address, the server is 1351 forbidden to send more than three UDP datagrams in its first flight 1352 (see Section 8.1 of [QUIC-TRANSPORT]). Finally, because 1353 acknowledgements of Handshake packets are authenticated, a blind 1354 attacker cannot forge them. Put together, these defenses limit the 1355 level of amplification. 1357 9.2. Peer Denial of Service 1359 QUIC, TLS, and HTTP/2 all contain messages that have legitimate uses 1360 in some contexts, but that can be abused to cause a peer to expend 1361 processing resources without having any observable impact on the 1362 state of the connection. If processing is disproportionately large 1363 in comparison to the observable effects on bandwidth or state, then 1364 this could allow a malicious peer to exhaust processing capacity 1365 without consequence. 1367 QUIC prohibits the sending of empty "STREAM" frames unless they are 1368 marked with the FIN bit. This prevents "STREAM" frames from being 1369 sent that only waste effort. 1371 While there are legitimate uses for some redundant packets, 1372 implementations SHOULD track redundant packets and treat excessive 1373 volumes of any non-productive packets as indicative of an attack. 1375 9.3. Header Protection Analysis 1377 Header protection relies on the packet protection AEAD being a 1378 pseudorandom function (PRF), which is not a property that AEAD 1379 algorithms guarantee. Therefore, no strong assurances about the 1380 general security of this mechanism can be shown in the general case. 1381 The AEAD algorithms described in this document are assumed to be 1382 PRFs. 1384 The header protection algorithms defined in this document take the 1385 form: 1387 protected_field = field XOR PRF(hp_key, sample) 1389 This construction is secure against chosen plaintext attacks (IND- 1390 CPA) [IMC]. 1392 Use of the same key and ciphertext sample more than once risks 1393 compromising header protection. Protecting two different headers 1394 with the same key and ciphertext sample reveals the exclusive OR of 1395 the protected fields. Assuming that the AEAD acts as a PRF, if L 1396 bits are sampled, the odds of two ciphertext samples being identical 1397 approach 2^(-L/2), that is, the birthday bound. For the algorithms 1398 described in this document, that probability is one in 2^64. 1400 Note: In some cases, inputs shorter than the full size required by 1401 the packet protection algorithm might be used. 1403 To prevent an attacker from modifying packet headers, the header is 1404 transitively authenticated using packet protection; the entire packet 1405 header is part of the authenticated additional data. Protected 1406 fields that are falsified or modified can only be detected once the 1407 packet protection is removed. 1409 An attacker could guess values for packet numbers and have an 1410 endpoint confirm guesses through timing side channels. Similarly, 1411 guesses for the packet number length can be trialed and exposed. If 1412 the recipient of a packet discards packets with duplicate packet 1413 numbers without attempting to remove packet protection they could 1414 reveal through timing side-channels that the packet number matches a 1415 received packet. For authentication to be free from side-channels, 1416 the entire process of header protection removal, packet number 1417 recovery, and packet protection removal MUST be applied together 1418 without timing and other side-channels. 1420 For the sending of packets, construction and protection of packet 1421 payloads and packet numbers MUST be free from side-channels that 1422 would reveal the packet number or its encoded size. 1424 9.4. Key Diversity 1426 In using TLS, the central key schedule of TLS is used. As a result 1427 of the TLS handshake messages being integrated into the calculation 1428 of secrets, the inclusion of the QUIC transport parameters extension 1429 ensures that handshake and 1-RTT keys are not the same as those that 1430 might be produced by a server running TLS over TCP. However, 0-RTT 1431 keys only include the ClientHello message and might therefore use the 1432 same secrets. To avoid the possibility of cross-protocol key 1433 synchronization, additional measures are provided to improve key 1434 separation. 1436 The QUIC packet protection keys and IVs are derived using a different 1437 label than the equivalent keys in TLS. 1439 To preserve this separation, a new version of QUIC SHOULD define new 1440 labels for key derivation for packet protection key and IV, plus the 1441 header protection keys. 1443 The initial secrets also use a key that is specific to the negotiated 1444 QUIC version. New QUIC versions SHOULD define a new salt value used 1445 in calculating initial secrets. 1447 10. IANA Considerations 1449 This document does not create any new IANA registries, but it 1450 registers the values in the following registries: 1452 o TLS ExtensionsType Registry [TLS-REGISTRIES] - IANA is to register 1453 the quic_transport_parameters extension found in Section 8.2. The 1454 Recommended column is to be marked Yes. The TLS 1.3 Column is to 1455 include CH and EE. 1457 11. References 1459 11.1. Normative References 1461 [AEAD] McGrew, D., "An Interface and Algorithms for Authenticated 1462 Encryption", RFC 5116, DOI 10.17487/RFC5116, January 2008, 1463 . 1465 [AES] "Advanced encryption standard (AES)", National Institute 1466 of Standards and Technology report, 1467 DOI 10.6028/nist.fips.197, November 2001. 1469 [CHACHA] Nir, Y. and A. Langley, "ChaCha20 and Poly1305 for IETF 1470 Protocols", RFC 8439, DOI 10.17487/RFC8439, June 2018, 1471 . 1473 [QUIC-RECOVERY] 1474 Iyengar, J., Ed. and I. Swett, Ed., "QUIC Loss Detection 1475 and Congestion Control", draft-ietf-quic-recovery-18 (work 1476 in progress), January 2019. 1478 [QUIC-TRANSPORT] 1479 Iyengar, J., Ed. and M. Thomson, Ed., "QUIC: A UDP-Based 1480 Multiplexed and Secure Transport", draft-ietf-quic- 1481 transport-18 (work in progress), January 2019. 1483 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1484 Requirement Levels", BCP 14, RFC 2119, 1485 DOI 10.17487/RFC2119, March 1997, 1486 . 1488 [RFC7301] Friedl, S., Popov, A., Langley, A., and E. Stephan, 1489 "Transport Layer Security (TLS) Application-Layer Protocol 1490 Negotiation Extension", RFC 7301, DOI 10.17487/RFC7301, 1491 July 2014, . 1493 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 1494 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 1495 May 2017, . 1497 [SHA] Dang, Q., "Secure Hash Standard", National Institute of 1498 Standards and Technology report, 1499 DOI 10.6028/nist.fips.180-4, July 2015. 1501 [TLS-REGISTRIES] 1502 Salowey, J. and S. Turner, "IANA Registry Updates for TLS 1503 and DTLS", RFC 8447, DOI 10.17487/RFC8447, August 2018, 1504 . 1506 [TLS13] Rescorla, E., "The Transport Layer Security (TLS) Protocol 1507 Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, 1508 . 1510 11.2. Informative References 1512 [AEBounds] 1513 Luykx, A. and K. Paterson, "Limits on Authenticated 1514 Encryption Use in TLS", March 2016, 1515 . 1517 [CCM] McGrew, D. and D. Bailey, "AES-CCM Cipher Suites for 1518 Transport Layer Security (TLS)", RFC 6655, 1519 DOI 10.17487/RFC6655, July 2012, 1520 . 1522 [IMC] Katz, J. and Y. Lindell, "Introduction to Modern 1523 Cryptography, Second Edition", ISBN 978-1466570269, 1524 November 2014. 1526 [QUIC-HTTP] 1527 Bishop, M., Ed., "Hypertext Transfer Protocol (HTTP) over 1528 QUIC", draft-ietf-quic-http-18 (work in progress), January 1529 2019. 1531 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, 1532 DOI 10.17487/RFC2818, May 2000, 1533 . 1535 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 1536 Housley, R., and W. Polk, "Internet X.509 Public Key 1537 Infrastructure Certificate and Certificate Revocation List 1538 (CRL) Profile", RFC 5280, DOI 10.17487/RFC5280, May 2008, 1539 . 1541 11.3. URIs 1543 [1] https://mailarchive.ietf.org/arch/search/?email_list=quic 1545 [2] https://github.com/quicwg 1547 [3] https://github.com/quicwg/base-drafts/labels/-tls 1549 Appendix A. Sample Initial Packet Protection 1551 This section shows examples of packet protection for Initial packets 1552 so that implementations can be verified incrementally. These packets 1553 use an 8-byte client-chosen Destination Connection ID of 1554 0x8394c8f03e515708. Values for both server and client packet 1555 protection are shown together with values in hexadecimal. 1557 A.1. Keys 1559 The labels generated by the HKDF-Expand-Label function are: 1561 client in: 00200f746c73313320636c69656e7420696e00 1563 server in: 00200f746c7331332073657276657220696e00 1565 quic key: 00100e746c7331332071756963206b657900 1567 quic iv: 000c0d746c733133207175696320697600 1569 quic hp: 00100d746c733133207175696320687000 1571 The initial secret is common: 1573 initial_secret = HKDF-Extract(initial_salt, cid) 1574 = 4496d3903d3f97cc5e45ac5790ddc686 1575 683c7c0067012bb09d900cc21832d596 1577 The secrets for protecting client packets are: 1579 client_initial_secret 1580 = HKDF-Expand-Label(initial_secret, "client in", _, 32) 1581 = 8a3515a14ae3c31b9c2d6d5bc58538ca 1582 5cd2baa119087143e60887428dcb52f6 1584 key = HKDF-Expand-Label(client_initial_secret, "quic key", _, 16) 1585 = 98b0d7e5e7a402c67c33f350fa65ea54 1587 iv = HKDF-Expand-Label(client_initial_secret, "quic iv", _, 12) 1588 = 19e94387805eb0b46c03a788 1590 hp = HKDF-Expand-Label(client_initial_secret, "quic hp", _, 16) 1591 = 0edd982a6ac527f2eddcbb7348dea5d7 1593 The secrets for protecting server packets are: 1595 server_initial_secret 1596 = HKDF-Expand-Label(initial_secret, "server in", _, 32) 1597 = 47b2eaea6c266e32c0697a9e2a898bdf 1598 5c4fb3e5ac34f0e549bf2c58581a3811 1600 key = HKDF-Expand-Label(server_initial_secret, "quic key", _, 16) 1601 = 9a8be902a9bdd91d16064ca118045fb4 1603 iv = HKDF-Expand-Label(server_initial_secret, "quic iv", _, 12) 1604 = 0a82086d32205ba22241d8dc 1606 hp = HKDF-Expand-Label(server_initial_secret, "quic hp", _, 16) 1607 = 94b9452d2b3c7c7f6da7fdd8593537fd 1609 A.2. Client Initial 1611 The client sends an Initial packet. The unprotected payload of this 1612 packet contains the following CRYPTO frame, plus enough PADDING 1613 frames to make an 1163 byte payload: 1615 060040c4010000c003036660261ff947 cea49cce6cfad687f457cf1b14531ba1 1616 4131a0e8f309a1d0b9c4000006130113 031302010000910000000b0009000006 1617 736572766572ff01000100000a001400 12001d00170018001901000101010201 1618 03010400230000003300260024001d00 204cfdfcd178b784bf328cae793b136f 1619 2aedce005ff183d7bb14952072366470 37002b0003020304000d0020001e0403 1620 05030603020308040805080604010501 060102010402050206020202002d0002 1621 0101001c00024001 1623 The unprotected header includes the connection ID and a 4 byte packet 1624 number encoding for a packet number of 2: 1626 c3ff000012508394c8f03e51570800449f00000002 1627 Protecting the payload produces output that is sampled for header 1628 protection. Because the header uses a 4 byte packet number encoding, 1629 the first 16 bytes of the protected payload is sampled, then applied 1630 to the header: 1632 sample = 0000f3a694c75775b4e546172ce9e047 1634 mask = AES-ECB(hp, sample)[0..4] 1635 = 020dbc1958 1637 header[0] ^= mask[0] & 0x0f 1638 = c1 1639 header[17..20] ^= mask[1..4] 1640 = 0dbc195a 1641 header = c1ff000012508394c8f03e51570800449f0dbc195a 1643 The resulting protected packet is: 1645 c1ff000012508394c8f03e5157080044 9f0dbc195a0000f3a694c75775b4e546 1646 172ce9e047cd0b5bee5181648c727adc 87f7eae54473ec6cba6bdad4f5982317 1647 4b769f12358abd292d4f3286934484fb 8b239c38732e1f3bbbc6a003056487eb 1648 8b5c88b9fd9279ffff3b0f4ecf95c462 4db6d65d4113329ee9b0bf8cdd7c8a8d 1649 72806d55df25ecb66488bc119d7c9a29 abaf99bb33c56b08ad8c26995f838bb3 1650 b7a3d5c1858b8ec06b839db2dcf918d5 ea9317f1acd6b663cc8925868e2f6a1b 1651 da546695f3c3f33175944db4a11a346a fb07e78489e509b02add51b7b203eda5 1652 c330b03641179a31fbba9b56ce00f3d5 b5e3d7d9c5429aebb9576f2f7eacbe27 1653 bc1b8082aaf68fb69c921aa5d33ec0c8 510410865a178d86d7e54122d55ef2c2 1654 bbc040be46d7fece73fe8a1b24495ec1 60df2da9b20a7ba2f26dfa2a44366dbc 1655 63de5cd7d7c94c57172fe6d79c901f02 5c0010b02c89b395402c009f62dc053b 1656 8067a1e0ed0a1e0cf5087d7f78cbd94a fe0c3dd55d2d4b1a5cfe2b68b86264e3 1657 51d1dcd858783a240f893f008ceed743 d969b8f735a1677ead960b1fb1ecc5ac 1658 83c273b49288d02d7286207e663c45e1 a7baf50640c91e762941cf380ce8d79f 1659 3e86767fbbcd25b42ef70ec334835a3a 6d792e170a432ce0cb7bde9aaa1e7563 1660 7c1c34ae5fef4338f53db8b13a4d2df5 94efbfa08784543815c9c0d487bddfa1 1661 539bc252cf43ec3686e9802d651cfd2a 829a06a9f332a733a4a8aed80efe3478 1662 093fbc69c8608146b3f16f1a5c4eac93 20da49f1afa5f538ddecbbe7888f4355 1663 12d0dd74fd9b8c99e3145ba84410d8ca 9a36dd884109e76e5fb8222a52e1473d 1664 a168519ce7a8a3c32e9149671b16724c 6c5c51bb5cd64fb591e567fb78b10f9f 1665 6fee62c276f282a7df6bcf7c17747bc9 a81e6c9c3b032fdd0e1c3ac9eaa5077d 1666 e3ded18b2ed4faf328f49875af2e36ad 5ce5f6cc99ef4b60e57b3b5b9c9fcbcd 1667 4cfb3975e70ce4c2506bcd71fef0e535 92461504e3d42c885caab21b782e2629 1668 4c6a9d61118cc40a26f378441ceb48f3 1a362bf8502a723a36c63502229a462c 1669 c2a3796279a5e3a7f81a68c7f81312c3 81cc16a4ab03513a51ad5b54306ec1d7 1670 8a5e47e2b15e5b7a1438e5b8b2882dbd ad13d6a4a8c3558cae043501b68eb3b0 1671 40067152337c051c40b5af809aca2856 986fd1c86a4ade17d254b6262ac1bc07 1672 7343b52bf89fa27d73e3c6f3118c9961 f0bebe68a5c323c2d84b8c29a2807df6 1673 63635223242a2ce9828d4429ac270aab 5f1841e8e49cf433b1547989f419caa3 1674 c758fff96ded40cf3427f0761b678daa 1a9e5554465d46b7a917493fc70f9ec5 1675 e4e5d786ca501730898aaa1151dcd318 29641e29428d90e6065511c24d3109f7 1676 cba32225d4accfc54fec42b733f95852 52ee36fa5ea0c656934385b468eee245 1677 315146b8c047ed27c519b2c0a52d33ef e72c186ffe0a230f505676c5324baa6a 1678 e006a73e13aa8c39ab173ad2b2778eea 0b34c46f2b3beae2c62a2c8db238bf58 1679 fc7c27bdceb96c56d29deec87c12351b fd5962497418716a4b915d334ffb5b92 1680 ca94ffe1e4f78967042638639a9de325 357f5f08f6435061e5a274703936c06f 1681 c56af92c420797499ca431a7abaa4618 63bca656facfad564e6274d4a741033a 1682 ca1e31bf63200df41cdf41c10b912bec 1684 A.3. Server Initial 1686 The server sends the following payload in response, including an ACK 1687 frame, a CRYPTO frame, and no PADDING frames: 1689 0d0000000018410a020000560303eefc e7f7b37ba1d1632e96677825ddf73988 1690 cfc79825df566dc5430b9a045a120013 0100002e00330024001d00209d3c940d 1691 89690b84d08a60993c144eca684d1081 287c834d5311bcf32bb9da1a002b0002 1692 0304 1693 The header from the server includes a new connection ID and a 2-byte 1694 packet number encoding for a packet number of 1: 1696 c1ff00001205f067a5502a4262b50040740001 1698 As a result, after protection, the header protection sample is taken 1699 starting from the third protected octet: 1701 sample = c4c2a2303d297e3c519bf6b22386e3d0 1702 mask = 75f7ec8b62 1703 header = c4ff00001205f067a5502a4262b5004074f7ed 1705 The final protected packet is then: 1707 c4ff00001205f067a5502a4262b50040 74f7ed5f01c4c2a2303d297e3c519bf6 1708 b22386e3d0bd6dfc6612167729803104 1bb9a79c9f0f9d4c5877270a660f5da3 1709 6207d98b73839b2fdf2ef8e7df5a51b1 7b8c68d864fd3e708c6c1b71a98a3318 1710 15599ef5014ea38c44bdfd387c03b527 5c35e009b6238f831420047c7271281c 1711 cb54df7884 1713 Appendix B. Change Log 1715 *RFC Editor's Note:* Please remove this section prior to 1716 publication of a final version of this document. 1718 Issue and pull request numbers are listed with a leading octothorp. 1720 B.1. Since draft-ietf-quic-tls-17 1722 o Endpoints discard initial keys as soon as handshake keys are 1723 available (#1951, #2045) 1725 o Use of ALPN or equivalent is mandatory (#2263, #2284) 1727 B.2. Since draft-ietf-quic-tls-14 1729 o Update the salt used for Initial secrets (#1970) 1731 o Clarify that TLS_AES_128_CCM_8_SHA256 isn't supported (#2019) 1733 o Change header protection 1735 * Sample from a fixed offset (#1575, #2030) 1737 * Cover part of the first byte, including the key phase (#1322, 1738 #2006) 1740 o TLS provides an AEAD and KDF function (#2046) 1741 * Clarify that the TLS KDF is used with TLS (#1997) 1743 * Change the labels for calculation of QUIC keys (#1845, #1971, 1744 #1991) 1746 o Initial keys are discarded once Handshake are avaialble (#1951, 1747 #2045) 1749 B.3. Since draft-ietf-quic-tls-13 1751 o Updated to TLS 1.3 final (#1660) 1753 B.4. Since draft-ietf-quic-tls-12 1755 o Changes to integration of the TLS handshake (#829, #1018, #1094, 1756 #1165, #1190, #1233, #1242, #1252, #1450) 1758 * The cryptographic handshake uses CRYPTO frames, not stream 0 1760 * QUIC packet protection is used in place of TLS record 1761 protection 1763 * Separate QUIC packet number spaces are used for the handshake 1765 * Changed Retry to be independent of the cryptographic handshake 1767 * Limit the use of HelloRetryRequest to address TLS needs (like 1768 key shares) 1770 o Changed codepoint of TLS extension (#1395, #1402) 1772 B.5. Since draft-ietf-quic-tls-11 1774 o Encrypted packet numbers. 1776 B.6. Since draft-ietf-quic-tls-10 1778 o No significant changes. 1780 B.7. Since draft-ietf-quic-tls-09 1782 o Cleaned up key schedule and updated the salt used for handshake 1783 packet protection (#1077) 1785 B.8. Since draft-ietf-quic-tls-08 1787 o Specify value for max_early_data_size to enable 0-RTT (#942) 1789 o Update key derivation function (#1003, #1004) 1791 B.9. Since draft-ietf-quic-tls-07 1793 o Handshake errors can be reported with CONNECTION_CLOSE (#608, 1794 #891) 1796 B.10. Since draft-ietf-quic-tls-05 1798 No significant changes. 1800 B.11. Since draft-ietf-quic-tls-04 1802 o Update labels used in HKDF-Expand-Label to match TLS 1.3 (#642) 1804 B.12. Since draft-ietf-quic-tls-03 1806 No significant changes. 1808 B.13. Since draft-ietf-quic-tls-02 1810 o Updates to match changes in transport draft 1812 B.14. Since draft-ietf-quic-tls-01 1814 o Use TLS alerts to signal TLS errors (#272, #374) 1816 o Require ClientHello to fit in a single packet (#338) 1818 o The second client handshake flight is now sent in the clear (#262, 1819 #337) 1821 o The QUIC header is included as AEAD Associated Data (#226, #243, 1822 #302) 1824 o Add interface necessary for client address validation (#275) 1826 o Define peer authentication (#140) 1828 o Require at least TLS 1.3 (#138) 1830 o Define transport parameters as a TLS extension (#122) 1831 o Define handling for protected packets before the handshake 1832 completes (#39) 1834 o Decouple QUIC version and ALPN (#12) 1836 B.15. Since draft-ietf-quic-tls-00 1838 o Changed bit used to signal key phase 1840 o Updated key phase markings during the handshake 1842 o Added TLS interface requirements section 1844 o Moved to use of TLS exporters for key derivation 1846 o Moved TLS error code definitions into this document 1848 B.16. Since draft-thomson-quic-tls-01 1850 o Adopted as base for draft-ietf-quic-tls 1852 o Updated authors/editors list 1854 o Added status note 1856 Acknowledgments 1858 This document has benefited from input from Dragana Damjanovic, 1859 Christian Huitema, Jana Iyengar, Adam Langley, Roberto Peon, Eric 1860 Rescorla, Ian Swett, and many others. 1862 Contributors 1864 Ryan Hamilton was originally an author of this specification. 1866 Authors' Addresses 1868 Martin Thomson (editor) 1869 Mozilla 1871 Email: mt@lowentropy.net 1873 Sean Turner (editor) 1874 sn3rd 1876 Email: sean@sn3rd.com