idnits 2.17.1 draft-ietf-quic-tls-25.txt: -(2333): Line appears to be too long, but this could be caused by non-ascii characters in UTF-8 encoding 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: ---------------------------------------------------------------------------- == There are 3 instances of lines with non-ascii characters in the document. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. 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: * 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 (22 January 2020) is 1550 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: '0' on line 2063 -- Looks like a reference, but probably isn't: '1' on line 1407 -- 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-25 == Outdated reference: A later version (-34) exists of draft-ietf-quic-transport-25 -- Possible downref: Non-RFC (?) normative reference: ref. 'SHA' == Outdated reference: A later version (-34) exists of draft-ietf-quic-http-25 -- Obsolete informational reference (is this intentional?): RFC 2818 (Obsoleted by RFC 9110) Summary: 1 error (**), 0 flaws (~~), 6 warnings (==), 7 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: 25 July 2020 sn3rd 6 22 January 2020 8 Using TLS to Secure QUIC 9 draft-ietf-quic-tls-25 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 21 (https://mailarchive.ietf.org/arch/search/?email_list=quic). 23 Working Group information can be found at https://github.com/quicwg 24 (https://github.com/quicwg); source code and issues list for this 25 draft can be found at https://github.com/quicwg/base-drafts/labels/- 26 tls (https://github.com/quicwg/base-drafts/labels/-tls). 28 Status of This Memo 30 This Internet-Draft is submitted in full conformance with the 31 provisions of BCP 78 and BCP 79. 33 Internet-Drafts are working documents of the Internet Engineering 34 Task Force (IETF). Note that other groups may also distribute 35 working documents as Internet-Drafts. The list of current Internet- 36 Drafts is at https://datatracker.ietf.org/drafts/current/. 38 Internet-Drafts are draft documents valid for a maximum of six months 39 and may be updated, replaced, or obsoleted by other documents at any 40 time. It is inappropriate to use Internet-Drafts as reference 41 material or to cite them other than as "work in progress." 43 This Internet-Draft will expire on 25 July 2020. 45 Copyright Notice 47 Copyright (c) 2020 IETF Trust and the persons identified as the 48 document authors. All rights reserved. 50 This document is subject to BCP 78 and the IETF Trust's Legal 51 Provisions Relating to IETF Documents (https://trustee.ietf.org/ 52 license-info) in effect on the date of publication of this document. 53 Please review these documents carefully, as they describe your rights 54 and restrictions with respect to this document. Code Components 55 extracted from this document must include Simplified BSD License text 56 as described in Section 4.e of the Trust Legal Provisions and are 57 provided without warranty as described in the Simplified BSD License. 59 Table of Contents 61 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 62 2. Notational Conventions . . . . . . . . . . . . . . . . . . . 4 63 2.1. TLS Overview . . . . . . . . . . . . . . . . . . . . . . 4 64 3. Protocol Overview . . . . . . . . . . . . . . . . . . . . . . 7 65 4. Carrying TLS Messages . . . . . . . . . . . . . . . . . . . . 8 66 4.1. Interface to TLS . . . . . . . . . . . . . . . . . . . . 10 67 4.1.1. Handshake Complete . . . . . . . . . . . . . . . . . 10 68 4.1.2. Handshake Confirmed . . . . . . . . . . . . . . . . . 10 69 4.1.3. Sending and Receiving Handshake Messages . . . . . . 10 70 4.1.4. Encryption Level Changes . . . . . . . . . . . . . . 12 71 4.1.5. TLS Interface Summary . . . . . . . . . . . . . . . . 13 72 4.2. TLS Version . . . . . . . . . . . . . . . . . . . . . . . 14 73 4.3. ClientHello Size . . . . . . . . . . . . . . . . . . . . 15 74 4.4. Peer Authentication . . . . . . . . . . . . . . . . . . . 15 75 4.5. Enabling 0-RTT . . . . . . . . . . . . . . . . . . . . . 16 76 4.6. Accepting and Rejecting 0-RTT . . . . . . . . . . . . . . 16 77 4.7. Validating 0-RTT Configuration . . . . . . . . . . . . . 17 78 4.8. HelloRetryRequest . . . . . . . . . . . . . . . . . . . . 17 79 4.9. TLS Errors . . . . . . . . . . . . . . . . . . . . . . . 18 80 4.10. Discarding Unused Keys . . . . . . . . . . . . . . . . . 18 81 4.10.1. Discarding Initial Keys . . . . . . . . . . . . . . 19 82 4.10.2. Discarding Handshake Keys . . . . . . . . . . . . . 19 83 4.10.3. Discarding 0-RTT Keys . . . . . . . . . . . . . . . 19 84 5. Packet Protection . . . . . . . . . . . . . . . . . . . . . . 20 85 5.1. Packet Protection Keys . . . . . . . . . . . . . . . . . 20 86 5.2. Initial Secrets . . . . . . . . . . . . . . . . . . . . . 20 87 5.3. AEAD Usage . . . . . . . . . . . . . . . . . . . . . . . 21 88 5.4. Header Protection . . . . . . . . . . . . . . . . . . . . 23 89 5.4.1. Header Protection Application . . . . . . . . . . . . 23 90 5.4.2. Header Protection Sample . . . . . . . . . . . . . . 25 91 5.4.3. AES-Based Header Protection . . . . . . . . . . . . . 26 92 5.4.4. ChaCha20-Based Header Protection . . . . . . . . . . 26 93 5.5. Receiving Protected Packets . . . . . . . . . . . . . . . 27 94 5.6. Use of 0-RTT Keys . . . . . . . . . . . . . . . . . . . . 27 95 5.7. Receiving Out-of-Order Protected Frames . . . . . . . . . 28 96 5.8. Retry Packet Integrity . . . . . . . . . . . . . . . . . 29 97 6. Key Update . . . . . . . . . . . . . . . . . . . . . . . . . 30 98 6.1. Initiating a Key Update . . . . . . . . . . . . . . . . . 31 99 6.2. Responding to a Key Update . . . . . . . . . . . . . . . 32 100 6.3. Timing of Receive Key Generation . . . . . . . . . . . . 33 101 6.4. Sending with Updated Keys . . . . . . . . . . . . . . . . 33 102 6.5. Receiving with Different Keys . . . . . . . . . . . . . . 34 103 6.6. Key Update Frequency . . . . . . . . . . . . . . . . . . 35 104 6.7. Key Update Error Code . . . . . . . . . . . . . . . . . . 35 105 7. Security of Initial Messages . . . . . . . . . . . . . . . . 35 106 8. QUIC-Specific Additions to the TLS Handshake . . . . . . . . 35 107 8.1. Protocol Negotiation . . . . . . . . . . . . . . . . . . 36 108 8.2. QUIC Transport Parameters Extension . . . . . . . . . . . 36 109 8.3. Removing the EndOfEarlyData Message . . . . . . . . . . . 37 110 9. Security Considerations . . . . . . . . . . . . . . . . . . . 37 111 9.1. Replay Attacks with 0-RTT . . . . . . . . . . . . . . . . 37 112 9.2. Packet Reflection Attack Mitigation . . . . . . . . . . . 38 113 9.3. Header Protection Analysis . . . . . . . . . . . . . . . 39 114 9.4. Header Protection Timing Side-Channels . . . . . . . . . 39 115 9.5. Key Diversity . . . . . . . . . . . . . . . . . . . . . . 40 116 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 41 117 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 41 118 11.1. Normative References . . . . . . . . . . . . . . . . . . 41 119 11.2. Informative References . . . . . . . . . . . . . . . . . 42 120 Appendix A. Sample Initial Packet Protection . . . . . . . . . . 43 121 A.1. Keys . . . . . . . . . . . . . . . . . . . . . . . . . . 43 122 A.2. Client Initial . . . . . . . . . . . . . . . . . . . . . 44 123 A.3. Server Initial . . . . . . . . . . . . . . . . . . . . . 46 124 Appendix B. Change Log . . . . . . . . . . . . . . . . . . . . . 47 125 B.1. Since draft-ietf-quic-tls-24 . . . . . . . . . . . . . . 47 126 B.2. Since draft-ietf-quic-tls-23 . . . . . . . . . . . . . . 47 127 B.3. Since draft-ietf-quic-tls-22 . . . . . . . . . . . . . . 48 128 B.4. Since draft-ietf-quic-tls-21 . . . . . . . . . . . . . . 48 129 B.5. Since draft-ietf-quic-tls-20 . . . . . . . . . . . . . . 48 130 B.6. Since draft-ietf-quic-tls-18 . . . . . . . . . . . . . . 48 131 B.7. Since draft-ietf-quic-tls-17 . . . . . . . . . . . . . . 48 132 B.8. Since draft-ietf-quic-tls-14 . . . . . . . . . . . . . . 48 133 B.9. Since draft-ietf-quic-tls-13 . . . . . . . . . . . . . . 49 134 B.10. Since draft-ietf-quic-tls-12 . . . . . . . . . . . . . . 49 135 B.11. Since draft-ietf-quic-tls-11 . . . . . . . . . . . . . . 49 136 B.12. Since draft-ietf-quic-tls-10 . . . . . . . . . . . . . . 49 137 B.13. Since draft-ietf-quic-tls-09 . . . . . . . . . . . . . . 49 138 B.14. Since draft-ietf-quic-tls-08 . . . . . . . . . . . . . . 49 139 B.15. Since draft-ietf-quic-tls-07 . . . . . . . . . . . . . . 50 140 B.16. Since draft-ietf-quic-tls-05 . . . . . . . . . . . . . . 50 141 B.17. Since draft-ietf-quic-tls-04 . . . . . . . . . . . . . . 50 142 B.18. Since draft-ietf-quic-tls-03 . . . . . . . . . . . . . . 50 143 B.19. Since draft-ietf-quic-tls-02 . . . . . . . . . . . . . . 50 144 B.20. Since draft-ietf-quic-tls-01 . . . . . . . . . . . . . . 50 145 B.21. Since draft-ietf-quic-tls-00 . . . . . . . . . . . . . . 50 146 B.22. Since draft-thomson-quic-tls-01 . . . . . . . . . . . . . 51 147 Contributors . . . . . . . . . . . . . . . . . . . . . . . . . . 51 148 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 51 150 1. Introduction 152 This document describes how QUIC [QUIC-TRANSPORT] is secured using 153 TLS [TLS13]. 155 TLS 1.3 provides critical latency improvements for connection 156 establishment over previous versions. Absent packet loss, most new 157 connections can be established and secured within a single round 158 trip; on subsequent connections between the same client and server, 159 the client can often send application data immediately, that is, 160 using a zero round trip setup. 162 This document describes how TLS acts as a security component of QUIC. 164 2. Notational Conventions 166 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 167 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 168 "OPTIONAL" in this document are to be interpreted as described in BCP 169 14 [RFC2119] [RFC8174] when, and only when, they appear in all 170 capitals, as shown here. 172 This document uses the terminology established in [QUIC-TRANSPORT]. 174 For brevity, the acronym TLS is used to refer to TLS 1.3, though a 175 newer version could be used (see Section 4.2). 177 2.1. TLS Overview 179 TLS provides two endpoints with a way to establish a means of 180 communication over an untrusted medium (that is, the Internet) that 181 ensures that messages they exchange cannot be observed, modified, or 182 forged. 184 Internally, TLS is a layered protocol, with the structure shown in 185 Figure 1. 187 +-------------+------------+--------------+---------+ 188 Handshake | | | Application | | 189 Layer | Handshake | Alerts | Data | ... | 190 | | | | | 191 +-------------+------------+--------------+---------+ 192 Record | | 193 Layer | Records | 194 | | 195 +---------------------------------------------------+ 197 Figure 1: TLS Layers 199 Each Handshake layer message (e.g., Handshake, Alerts, and 200 Application Data) is carried as a series of typed TLS records by the 201 Record layer. Records are individually cryptographically protected 202 and then transmitted over a reliable transport (typically TCP) which 203 provides sequencing and guaranteed delivery. 205 The TLS authenticated key exchange occurs between two endpoints: 206 client and server. The client initiates the exchange and the server 207 responds. If the key exchange completes successfully, both client 208 and server will agree on a secret. TLS supports both pre-shared key 209 (PSK) and Diffie-Hellman over either finite fields or elliptic curves 210 ((EC)DHE) key exchanges. PSK is the basis for 0-RTT; the latter 211 provides perfect forward secrecy (PFS) when the (EC)DHE keys are 212 destroyed. 214 After completing the TLS handshake, the client will have learned and 215 authenticated an identity for the server and the server is optionally 216 able to learn and authenticate an identity for the client. TLS 217 supports X.509 [RFC5280] certificate-based authentication for both 218 server and client. 220 The TLS key exchange is resistant to tampering by attackers and it 221 produces shared secrets that cannot be controlled by either 222 participating peer. 224 TLS provides two basic handshake modes of interest to QUIC: 226 * A full 1-RTT handshake in which the client is able to send 227 Application Data after one round trip and the server immediately 228 responds after receiving the first handshake message from the 229 client. 231 * A 0-RTT handshake in which the client uses information it has 232 previously learned about the server to send Application Data 233 immediately. This Application Data can be replayed by an attacker 234 so it MUST NOT carry a self-contained trigger for any non- 235 idempotent action. 237 A simplified TLS handshake with 0-RTT application data is shown in 238 Figure 2. Note that this omits the EndOfEarlyData message, which is 239 not used in QUIC (see Section 8.3). Likewise, neither 240 ChangeCipherSpec nor KeyUpdate messages are used by QUIC; 241 ChangeCipherSpec is redundant in TLS 1.3 and QUIC has defined its own 242 key update mechanism Section 6. 244 Client Server 246 ClientHello 247 (0-RTT Application Data) --------> 248 ServerHello 249 {EncryptedExtensions} 250 {Finished} 251 <-------- [Application Data] 252 {Finished} --------> 254 [Application Data] <-------> [Application Data] 256 () Indicates messages protected by Early Data (0-RTT) Keys 257 {} Indicates messages protected using Handshake Keys 258 [] Indicates messages protected using Application Data 259 (1-RTT) Keys 261 Figure 2: TLS Handshake with 0-RTT 263 Data is protected using a number of encryption levels: 265 * Initial Keys 267 * Early Data (0-RTT) Keys 269 * Handshake Keys 271 * Application Data (1-RTT) Keys 273 Application Data may appear only in the Early Data and Application 274 Data levels. Handshake and Alert messages may appear in any level. 276 The 0-RTT handshake is only possible if the client and server have 277 previously communicated. In the 1-RTT handshake, the client is 278 unable to send protected Application Data until it has received all 279 of the Handshake messages sent by the server. 281 3. Protocol Overview 283 QUIC [QUIC-TRANSPORT] assumes responsibility for the confidentiality 284 and integrity protection of packets. For this it uses keys derived 285 from a TLS handshake [TLS13], but instead of carrying TLS records 286 over QUIC (as with TCP), TLS Handshake and Alert messages are carried 287 directly over the QUIC transport, which takes over the 288 responsibilities of the TLS record layer, as shown in Figure 3. 290 +--------------+--------------+ +-------------+ 291 | TLS | TLS | | QUIC | 292 | Handshake | Alerts | | Applications| 293 | | | | (h3, etc.) | 294 +--------------+--------------+-+-------------+ 295 | | 296 | QUIC Transport | 297 | (streams, reliability, congestion, etc.) | 298 | | 299 +---------------------------------------------+ 300 | | 301 | QUIC Packet Protection | 302 | | 303 +---------------------------------------------+ 305 Figure 3: QUIC Layers 307 QUIC also relies on TLS for authentication and negotiation of 308 parameters that are critical to security and performance. 310 Rather than a strict layering, these two protocols cooperate: QUIC 311 uses the TLS handshake; TLS uses the reliability, ordered delivery, 312 and record layer provided by QUIC. 314 At a high level, there are two main interactions between the TLS and 315 QUIC components: 317 * The TLS component sends and receives messages via the QUIC 318 component, with QUIC providing a reliable stream abstraction to 319 TLS. 321 * The TLS component provides a series of updates to the QUIC 322 component, including (a) new packet protection keys to install (b) 323 state changes such as handshake completion, the server 324 certificate, etc. 326 Figure 4 shows these interactions in more detail, with the QUIC 327 packet protection being called out specially. 329 +------------+ +------------+ 330 | |<---- Handshake Messages ----->| | 331 | |<- Validate 0-RTT parameters ->| | 332 | |<--------- 0-RTT Keys ---------| | 333 | QUIC |<------- Handshake Keys -------| TLS | 334 | |<--------- 1-RTT Keys ---------| | 335 | |<------- Handshake Done -------| | 336 +------------+ +------------+ 337 | ^ 338 | Protect | Protected 339 v | Packet 340 +------------+ 341 | QUIC | 342 | Packet | 343 | Protection | 344 +------------+ 346 Figure 4: QUIC and TLS Interactions 348 Unlike TLS over TCP, QUIC applications which want to send data do not 349 send it through TLS "application_data" records. Rather, they send it 350 as QUIC STREAM frames or other frame types which are then carried in 351 QUIC packets. 353 4. Carrying TLS Messages 355 QUIC carries TLS handshake data in CRYPTO frames, each of which 356 consists of a contiguous block of handshake data identified by an 357 offset and length. Those frames are packaged into QUIC packets and 358 encrypted under the current TLS encryption level. As with TLS over 359 TCP, once TLS handshake data has been delivered to QUIC, it is QUIC's 360 responsibility to deliver it reliably. Each chunk of data that is 361 produced by TLS is associated with the set of keys that TLS is 362 currently using. If QUIC needs to retransmit that data, it MUST use 363 the same keys even if TLS has already updated to newer keys. 365 One important difference between TLS records (used with TCP) and QUIC 366 CRYPTO frames is that in QUIC multiple frames may appear in the same 367 QUIC packet as long as they are associated with the same encryption 368 level. For instance, an implementation might bundle a Handshake 369 message and an ACK for some Handshake data into the same packet. 371 Some frames are prohibited in different encryption levels, others 372 cannot be sent. The rules here generalize those of TLS, in that 373 frames associated with establishing the connection can usually appear 374 at any encryption level, whereas those associated with transferring 375 data can only appear in the 0-RTT and 1-RTT encryption levels: 377 * PADDING and PING frames MAY appear in packets of any encryption 378 level. 380 * CRYPTO frames and CONNECTION_CLOSE frames signaling errors at the 381 QUIC layer (type 0x1c) MAY appear in packets of any encryption 382 level except 0-RTT. 384 * CONNECTION_CLOSE frames signaling application errors (type 0x1d) 385 MUST only be sent in packets at the 1-RTT encryption level. 387 * ACK frames MAY appear in packets of any encryption level other 388 than 0-RTT, but can only acknowledge packets which appeared in 389 that packet number space. 391 * All other frame types MUST only be sent in the 0-RTT and 1-RTT 392 levels. 394 Note that it is not possible to send the following frames in 0-RTT 395 for various reasons: ACK, CRYPTO, NEW_TOKEN, PATH_RESPONSE, and 396 RETIRE_CONNECTION_ID. 398 Because packets could be reordered on the wire, QUIC uses the packet 399 type to indicate which level a given packet was encrypted under, as 400 shown in Table 1. When multiple packets of different encryption 401 levels need to be sent, endpoints SHOULD use coalesced packets to 402 send them in the same UDP datagram. 404 +---------------------+------------------+-----------+ 405 | Packet Type | Encryption Level | PN Space | 406 +=====================+==================+===========+ 407 | Initial | Initial secrets | Initial | 408 +---------------------+------------------+-----------+ 409 | 0-RTT Protected | 0-RTT | 0/1-RTT | 410 +---------------------+------------------+-----------+ 411 | Handshake | Handshake | Handshake | 412 +---------------------+------------------+-----------+ 413 | Retry | N/A | N/A | 414 +---------------------+------------------+-----------+ 415 | Version Negotiation | N/A | N/A | 416 +---------------------+------------------+-----------+ 417 | Short Header | 1-RTT | 0/1-RTT | 418 +---------------------+------------------+-----------+ 420 Table 1: Encryption Levels by Packet Type 422 Section 17 of [QUIC-TRANSPORT] shows how packets at the various 423 encryption levels fit into the handshake process. 425 4.1. Interface to TLS 427 As shown in Figure 4, the interface from QUIC to TLS consists of four 428 primary functions: 430 * Sending and receiving handshake messages 432 * Processing stored transport and application state from a resumed 433 session and determining if it is valid to accept early data 435 * Rekeying (both transmit and receive) 437 * Handshake state updates 439 Additional functions might be needed to configure TLS. 441 4.1.1. Handshake Complete 443 In this document, the TLS handshake is considered complete when the 444 TLS stack has reported that the handshake is complete. This happens 445 when the TLS stack has both sent a Finished message and verified the 446 peer's Finished message. Verifying the peer's Finished provides the 447 endpoints with an assurance that previous handshake messages have not 448 been modified. Note that the handshake does not complete at both 449 endpoints simultaneously. Consequently, any requirement that is 450 based on the completion of the handshake depends on the perspective 451 of the endpoint in question. 453 4.1.2. Handshake Confirmed 455 In this document, the TLS handshake is considered confirmed at the 456 server when the handshake completes. At the client, the handshake is 457 considered confirmed when a HANDSHAKE_DONE frame is received. 459 A client MAY consider the handshake to be confirmed when it receives 460 an acknowledgement for a 1-RTT packet. This can be implemented by 461 recording the lowest packet number sent with 1-RTT keys, and 462 comparing it to the Largest Acknowledged field in any received 1-RTT 463 ACK frame: once the latter is greater than or equal to the former, 464 the handshake is confirmed. 466 4.1.3. Sending and Receiving Handshake Messages 468 In order to drive the handshake, TLS depends on being able to send 469 and receive handshake messages. There are two basic functions on 470 this interface: one where QUIC requests handshake messages and one 471 where QUIC provides handshake packets. 473 Before starting the handshake QUIC provides TLS with the transport 474 parameters (see Section 8.2) that it wishes to carry. 476 A QUIC client starts TLS by requesting TLS handshake bytes from TLS. 477 The client acquires handshake bytes before sending its first packet. 478 A QUIC server starts the process by providing TLS with the client's 479 handshake bytes. 481 At any time, the TLS stack at an endpoint will have a current sending 482 encryption level and receiving encryption level. Each encryption 483 level is associated with a different flow of bytes, which is reliably 484 transmitted to the peer in CRYPTO frames. When TLS provides 485 handshake bytes to be sent, they are appended to the current flow and 486 any packet that includes the CRYPTO frame is protected using keys 487 from the corresponding encryption level. 489 QUIC takes the unprotected content of TLS handshake records as the 490 content of CRYPTO frames. TLS record protection is not used by QUIC. 491 QUIC assembles CRYPTO frames into QUIC packets, which are protected 492 using QUIC packet protection. 494 QUIC is only capable of conveying TLS handshake records in CRYPTO 495 frames. TLS alerts are turned into QUIC CONNECTION_CLOSE error 496 codes; see Section 4.9. TLS application data and other message types 497 cannot be carried by QUIC at any encryption level and is an error if 498 they are received from the TLS stack. 500 When an endpoint receives a QUIC packet containing a CRYPTO frame 501 from the network, it proceeds as follows: 503 * If the packet was in the TLS receiving encryption level, sequence 504 the data into the input flow as usual. As with STREAM frames, the 505 offset is used to find the proper location in the data sequence. 506 If the result of this process is that new data is available, then 507 it is delivered to TLS in order. 509 * If the packet is from a previously installed encryption level, it 510 MUST not contain data which extends past the end of previously 511 received data in that flow. Implementations MUST treat any 512 violations of this requirement as a connection error of type 513 PROTOCOL_VIOLATION. 515 * If the packet is from a new encryption level, it is saved for 516 later processing by TLS. Once TLS moves to receiving from this 517 encryption level, saved data can be provided. When providing data 518 from any new encryption level to TLS, if there is data from a 519 previous encryption level that TLS has not consumed, this MUST be 520 treated as a connection error of type PROTOCOL_VIOLATION. 522 Each time that TLS is provided with new data, new handshake bytes are 523 requested from TLS. TLS might not provide any bytes if the handshake 524 messages it has received are incomplete or it has no data to send. 526 Once the TLS handshake is complete, this is indicated to QUIC along 527 with any final handshake bytes that TLS needs to send. TLS also 528 provides QUIC with the transport parameters that the peer advertised 529 during the handshake. 531 Once the handshake is complete, TLS becomes passive. TLS can still 532 receive data from its peer and respond in kind, but it will not need 533 to send more data unless specifically requested - either by an 534 application or QUIC. One reason to send data is that the server 535 might wish to provide additional or updated session tickets to a 536 client. 538 When the handshake is complete, QUIC only needs to provide TLS with 539 any data that arrives in CRYPTO streams. In the same way that is 540 done during the handshake, new data is requested from TLS after 541 providing received data. 543 4.1.4. Encryption Level Changes 545 As keys for new encryption levels become available, TLS provides QUIC 546 with those keys. Separately, as keys at a given encryption level 547 become available to TLS, TLS indicates to QUIC that reading or 548 writing keys at that encryption level are available. These events 549 are not asynchronous; they always occur immediately after TLS is 550 provided with new handshake bytes, or after TLS produces handshake 551 bytes. 553 TLS provides QUIC with three items as a new encryption level becomes 554 available: 556 * A secret 558 * An Authenticated Encryption with Associated Data (AEAD) function 560 * A Key Derivation Function (KDF) 562 These values are based on the values that TLS negotiates and are used 563 by QUIC to generate packet and header protection keys (see Section 5 564 and Section 5.4). 566 If 0-RTT is possible, it is ready after the client sends a TLS 567 ClientHello message or the server receives that message. After 568 providing a QUIC client with the first handshake bytes, the TLS stack 569 might signal the change to 0-RTT keys. On the server, after 570 receiving handshake bytes that contain a ClientHello message, a TLS 571 server might signal that 0-RTT keys are available. 573 Although TLS only uses one encryption level at a time, QUIC may use 574 more than one level. For instance, after sending its Finished 575 message (using a CRYPTO frame at the Handshake encryption level) an 576 endpoint can send STREAM data (in 1-RTT encryption). If the Finished 577 message is lost, the endpoint uses the Handshake encryption level to 578 retransmit the lost message. Reordering or loss of packets can mean 579 that QUIC will need to handle packets at multiple encryption levels. 580 During the handshake, this means potentially handling packets at 581 higher and lower encryption levels than the current encryption level 582 used by TLS. 584 In particular, server implementations need to be able to read packets 585 at the Handshake encryption level at the same time as the 0-RTT 586 encryption level. A client could interleave ACK frames that are 587 protected with Handshake keys with 0-RTT data and the server needs to 588 process those acknowledgments in order to detect lost Handshake 589 packets. 591 QUIC also needs access to keys that might not ordinarily be available 592 to a TLS implementation. For instance, a client might need to 593 acknowledge Handshake packets before it is ready to send CRYPTO 594 frames at that encryption level. TLS therefore needs to provide keys 595 to QUIC before it might produce them for its own use. 597 4.1.5. TLS Interface Summary 599 Figure 5 summarizes the exchange between QUIC and TLS for both client 600 and server. Each arrow is tagged with the encryption level used for 601 that transmission. 603 Client Server 605 Get Handshake 606 Initial -------------> 607 Handshake Received 608 Install tx 0-RTT Keys 609 0-RTT ---------------> 610 Get Handshake 611 <------------- Initial 612 Handshake Received 613 Install Handshake keys 614 Install rx 0-RTT keys 615 Install Handshake keys 616 Get Handshake 617 <----------- Handshake 618 Handshake Received 619 Install tx 1-RTT keys 620 <--------------- 1-RTT 621 Get Handshake 622 Handshake Complete 623 Handshake -----------> 624 Handshake Received 625 Install rx 1-RTT keys 626 Handshake Complete 627 Install 1-RTT keys 628 1-RTT ---------------> 629 Get Handshake 630 <--------------- 1-RTT 631 Handshake Received 633 Figure 5: Interaction Summary between QUIC and TLS 635 Figure 5 shows the multiple packets that form a single "flight" of 636 messages being processed individually, to show what incoming messages 637 trigger different actions. New handshake messages are requested 638 after all incoming packets have been processed. This process might 639 vary depending on how QUIC implementations and the packets they 640 receive are structured. 642 4.2. TLS Version 644 This document describes how TLS 1.3 [TLS13] is used with QUIC. 646 In practice, the TLS handshake will negotiate a version of TLS to 647 use. This could result in a newer version of TLS than 1.3 being 648 negotiated if both endpoints support that version. This is 649 acceptable provided that the features of TLS 1.3 that are used by 650 QUIC are supported by the newer version. 652 A badly configured TLS implementation could negotiate TLS 1.2 or 653 another older version of TLS. An endpoint MUST terminate the 654 connection if a version of TLS older than 1.3 is negotiated. 656 4.3. ClientHello Size 658 The first Initial packet from a client contains the start or all of 659 its first cryptographic handshake message, which for TLS is the 660 ClientHello. Servers might need to parse the entire ClientHello 661 (e.g., to access extensions such as Server Name Identification (SNI) 662 or Application Layer Protocol Negotiation (ALPN)) in order to decide 663 whether to accept the new incoming QUIC connection. If the 664 ClientHello spans multiple Initial packets, such servers would need 665 to buffer the first received fragments, which could consume excessive 666 resources if the client's address has not yet been validated. To 667 avoid this, servers MAY use the Retry feature (see Section 8.1 of 668 [QUIC-TRANSPORT]) to only buffer partial ClientHello messages from 669 clients with a validated address. 671 QUIC packet and framing add at least 36 bytes of overhead to the 672 ClientHello message. That overhead increases if the client chooses a 673 connection ID without zero length. Overheads also do not include the 674 token or a connection ID longer than 8 bytes, both of which might be 675 required if a server sends a Retry packet. 677 A typical TLS ClientHello can easily fit into a 1200 byte packet. 678 However, in addition to the overheads added by QUIC, there are 679 several variables that could cause this limit to be exceeded. Large 680 session tickets, multiple or large key shares, and long lists of 681 supported ciphers, signature algorithms, versions, QUIC transport 682 parameters, and other negotiable parameters and extensions could 683 cause this message to grow. 685 For servers, in addition to connection IDs and tokens, the size of 686 TLS session tickets can have an effect on a client's ability to 687 connect efficiently. Minimizing the size of these values increases 688 the probability that clients can use them and still fit their 689 ClientHello message in their first Initial packet. 691 The TLS implementation does not need to ensure that the ClientHello 692 is sufficiently large. QUIC PADDING frames are added to increase the 693 size of the packet as necessary. 695 4.4. Peer Authentication 697 The requirements for authentication depend on the application 698 protocol that is in use. TLS provides server authentication and 699 permits the server to request client authentication. 701 A client MUST authenticate the identity of the server. This 702 typically involves verification that the identity of the server is 703 included in a certificate and that the certificate is issued by a 704 trusted entity (see for example [RFC2818]). 706 A server MAY request that the client authenticate during the 707 handshake. A server MAY refuse a connection if the client is unable 708 to authenticate when requested. The requirements for client 709 authentication vary based on application protocol and deployment. 711 A server MUST NOT use post-handshake client authentication (as 712 defined in Section 4.6.2 of [TLS13]), because the multiplexing 713 offered by QUIC prevents clients from correlating the certificate 714 request with the application-level event that triggered it (see 715 [HTTP2-TLS13]). More specifically, servers MUST NOT send post- 716 handshake TLS CertificateRequest messages and clients MUST treat 717 receipt of such messages as a connection error of type 718 PROTOCOL_VIOLATION. 720 4.5. Enabling 0-RTT 722 To communicate their willingness to process 0-RTT data, servers send 723 a NewSessionTicket message that contains the "early_data" extension 724 with a max_early_data_size of 0xffffffff; the amount of data which 725 the client can send in 0-RTT is controlled by the "initial_max_data" 726 transport parameter supplied by the server. Servers MUST NOT send 727 the "early_data" extension with a max_early_data_size set to any 728 value other than 0xffffffff. A client MUST treat receipt of a 729 NewSessionTicket that contains an "early_data" extension with any 730 other value as a connection error of type PROTOCOL_VIOLATION. 732 A client that wishes to send 0-RTT packets uses the "early_data" 733 extension in the ClientHello message of a subsequent handshake (see 734 Section 4.2.10 of [TLS13]). It then sends the application data in 735 0-RTT packets. 737 4.6. Accepting and Rejecting 0-RTT 739 A server accepts 0-RTT by sending an early_data extension in the 740 EncryptedExtensions (see Section 4.2.10 of [TLS13]). The server then 741 processes and acknowledges the 0-RTT packets that it receives. 743 A server rejects 0-RTT by sending the EncryptedExtensions without an 744 early_data extension. A server will always reject 0-RTT if it sends 745 a TLS HelloRetryRequest. When rejecting 0-RTT, a server MUST NOT 746 process any 0-RTT packets, even if it could. When 0-RTT was 747 rejected, a client SHOULD treat receipt of an acknowledgement for a 748 0-RTT packet as a connection error of type PROTOCOL_VIOLATION, if it 749 is able to detect the condition. 751 When 0-RTT is rejected, all connection characteristics that the 752 client assumed might be incorrect. This includes the choice of 753 application protocol, transport parameters, and any application 754 configuration. The client therefore MUST reset the state of all 755 streams, including application state bound to those streams. 757 A client MAY attempt to send 0-RTT again if it receives a Retry or 758 Version Negotiation packet. These packets do not signify rejection 759 of 0-RTT. 761 4.7. Validating 0-RTT Configuration 763 When a server receives a ClientHello with the "early_data" extension, 764 it has to decide whether to accept or reject early data from the 765 client. Some of this decision is made by the TLS stack (e.g., 766 checking that the cipher suite being resumed was included in the 767 ClientHello; see Section 4.2.10 of [TLS13]). Even when the TLS stack 768 has no reason to reject early data, the QUIC stack or the application 769 protocol using QUIC might reject early data because the configuration 770 of the transport or application associated with the resumed session 771 is not compatible with the server's current configuration. 773 QUIC requires additional transport state to be associated with a 774 0-RTT session ticket. One common way to implement this is using 775 stateless session tickets and storing this state in the session 776 ticket. Application protocols that use QUIC might have similar 777 requirements regarding associating or storing state. This associated 778 state is used for deciding whether early data must be rejected. For 779 example, HTTP/3 ([QUIC-HTTP]) settings determine how early data from 780 the client is interpreted. Other applications using QUIC could have 781 different requirements for determining whether to accept or reject 782 early data. 784 4.8. HelloRetryRequest 786 In TLS over TCP, the HelloRetryRequest feature (see Section 4.1.4 of 787 [TLS13]) can be used to correct a client's incorrect KeyShare 788 extension as well as for a stateless round-trip check. From the 789 perspective of QUIC, this just looks like additional messages carried 790 in the Initial encryption level. Although it is in principle 791 possible to use this feature for address verification in QUIC, QUIC 792 implementations SHOULD instead use the Retry feature (see Section 8.1 793 of [QUIC-TRANSPORT]). HelloRetryRequest is still used to request key 794 shares. 796 4.9. TLS Errors 798 If TLS experiences an error, it generates an appropriate alert as 799 defined in Section 6 of [TLS13]. 801 A TLS alert is turned into a QUIC connection error by converting the 802 one-byte alert description into a QUIC error code. The alert 803 description is added to 0x100 to produce a QUIC error code from the 804 range reserved for CRYPTO_ERROR. The resulting value is sent in a 805 QUIC CONNECTION_CLOSE frame. 807 The alert level of all TLS alerts is "fatal"; a TLS stack MUST NOT 808 generate alerts at the "warning" level. 810 4.10. Discarding Unused Keys 812 After QUIC moves to a new encryption level, packet protection keys 813 for previous encryption levels can be discarded. This occurs several 814 times during the handshake, as well as when keys are updated; see 815 Section 6. 817 Packet protection keys are not discarded immediately when new keys 818 are available. If packets from a lower encryption level contain 819 CRYPTO frames, frames that retransmit that data MUST be sent at the 820 same encryption level. Similarly, an endpoint generates 821 acknowledgements for packets at the same encryption level as the 822 packet being acknowledged. Thus, it is possible that keys for a 823 lower encryption level are needed for a short time after keys for a 824 newer encryption level are available. 826 An endpoint cannot discard keys for a given encryption level unless 827 it has both received and acknowledged all CRYPTO frames for that 828 encryption level and when all CRYPTO frames for that encryption level 829 have been acknowledged by its peer. However, this does not guarantee 830 that no further packets will need to be received or sent at that 831 encryption level because a peer might not have received all the 832 acknowledgements necessary to reach the same state. 834 Though an endpoint might retain older keys, new data MUST be sent at 835 the highest currently-available encryption level. Only ACK frames 836 and retransmissions of data in CRYPTO frames are sent at a previous 837 encryption level. These packets MAY also include PADDING frames. 839 4.10.1. Discarding Initial Keys 841 Packets protected with Initial secrets (Section 5.2) are not 842 authenticated, meaning that an attacker could spoof packets with the 843 intent to disrupt a connection. To limit these attacks, Initial 844 packet protection keys can be discarded more aggressively than other 845 keys. 847 The successful use of Handshake packets indicates that no more 848 Initial packets need to be exchanged, as these keys can only be 849 produced after receiving all CRYPTO frames from Initial packets. 850 Thus, a client MUST discard Initial keys when it first sends a 851 Handshake packet and a server MUST discard Initial keys when it first 852 successfully processes a Handshake packet. Endpoints MUST NOT send 853 Initial packets after this point. 855 This results in abandoning loss recovery state for the Initial 856 encryption level and ignoring any outstanding Initial packets. 858 4.10.2. Discarding Handshake Keys 860 An endpoint MUST discard its handshake keys when the TLS handshake is 861 confirmed (Section 4.1.2). The server MUST send a HANDSHAKE_DONE 862 frame as soon as it completes the handshake. 864 4.10.3. Discarding 0-RTT Keys 866 0-RTT and 1-RTT packets share the same packet number space, and 867 clients do not send 0-RTT packets after sending a 1-RTT packet 868 (Section 5.6). 870 Therefore, a client SHOULD discard 0-RTT keys as soon as it installs 871 1-RTT keys, since they have no use after that moment. 873 Additionally, a server MAY discard 0-RTT keys as soon as it receives 874 a 1-RTT packet. However, due to packet reordering, a 0-RTT packet 875 could arrive after a 1-RTT packet. Servers MAY temporarily retain 876 0-RTT keys to allow decrypting reordered packets without requiring 877 their contents to be retransmitted with 1-RTT keys. After receiving 878 a 1-RTT packet, servers MUST discard 0-RTT keys within a short time; 879 the RECOMMENDED time period is three times the Probe Timeout (PTO, 880 see [QUIC-RECOVERY]). A server MAY discard 0-RTT keys earlier if it 881 determines that it has received all 0-RTT packets, which can be done 882 by keeping track of missing packet numbers. 884 5. Packet Protection 886 As with TLS over TCP, QUIC protects packets with keys derived from 887 the TLS handshake, using the AEAD algorithm negotiated by TLS. 889 5.1. Packet Protection Keys 891 QUIC derives packet protection keys in the same way that TLS derives 892 record protection keys. 894 Each encryption level has separate secret values for protection of 895 packets sent in each direction. These traffic secrets are derived by 896 TLS (see Section 7.1 of [TLS13]) and are used by QUIC for all 897 encryption levels except the Initial encryption level. The secrets 898 for the Initial encryption level are computed based on the client's 899 initial Destination Connection ID, as described in Section 5.2. 901 The keys used for packet protection are computed from the TLS secrets 902 using the KDF provided by TLS. In TLS 1.3, the HKDF-Expand-Label 903 function described in Section 7.1 of [TLS13] is used, using the hash 904 function from the negotiated cipher suite. Other versions of TLS 905 MUST provide a similar function in order to be used with QUIC. 907 The current encryption level secret and the label "quic key" are 908 input to the KDF to produce the AEAD key; the label "quic iv" is used 909 to derive the IV; see Section 5.3. The header protection key uses 910 the "quic hp" label; see Section 5.4. Using these labels provides 911 key separation between QUIC and TLS; see Section 9.5. 913 The KDF used for initial secrets is always the HKDF-Expand-Label 914 function from TLS 1.3 (see Section 5.2). 916 5.2. Initial Secrets 918 Initial packets are protected with a secret derived from the 919 Destination Connection ID field from the client's Initial packet. 920 Specifically: 922 initial_salt = 0xc3eef712c72ebb5a11a7d2432bb46365bef9f502 923 initial_secret = HKDF-Extract(initial_salt, 924 client_dst_connection_id) 926 client_initial_secret = HKDF-Expand-Label(initial_secret, 927 "client in", "", 928 Hash.length) 929 server_initial_secret = HKDF-Expand-Label(initial_secret, 930 "server in", "", 931 Hash.length) 933 The hash function for HKDF when deriving initial secrets and keys is 934 SHA-256 [SHA]. 936 The connection ID used with HKDF-Expand-Label is the Destination 937 Connection ID in the Initial packet sent by the client. This will be 938 a randomly-selected value unless the client creates the Initial 939 packet after receiving a Retry packet, where the Destination 940 Connection ID is selected by the server. 942 The value of initial_salt is a 20 byte sequence shown in the figure 943 in hexadecimal notation. Future versions of QUIC SHOULD generate a 944 new salt value, thus ensuring that the keys are different for each 945 version of QUIC. This prevents a middlebox that only recognizes one 946 version of QUIC from seeing or modifying the contents of packets from 947 future versions. 949 The HKDF-Expand-Label function defined in TLS 1.3 MUST be used for 950 Initial packets even where the TLS versions offered do not include 951 TLS 1.3. 953 The secrets used for protecting Initial packets change when a server 954 sends a Retry packet to use the connection ID value selected by the 955 server. The secrets do not change when a client changes the 956 Destination Connection ID it uses in response to an Initial packet 957 from the server. 959 Note: The Destination Connection ID is of arbitrary length, and it 960 could be zero length if the server sends a Retry packet with a 961 zero-length Source Connection ID field. In this case, the Initial 962 keys provide no assurance to the client that the server received 963 its packet; the client has to rely on the exchange that included 964 the Retry packet for that property. 966 Appendix A contains test vectors for the initial packet encryption. 968 5.3. AEAD Usage 970 The Authentication Encryption with Associated Data (AEAD) [AEAD] 971 function used for QUIC packet protection is the AEAD that is 972 negotiated for use with the TLS connection. For example, if TLS is 973 using the TLS_AES_128_GCM_SHA256, the AEAD_AES_128_GCM function is 974 used. 976 Packets are protected prior to applying header protection 977 (Section 5.4). The unprotected packet header is part of the 978 associated data (A). When removing packet protection, an endpoint 979 first removes the header protection. 981 All QUIC packets other than Version Negotiation and Retry packets are 982 protected with an AEAD algorithm [AEAD]. Prior to establishing a 983 shared secret, packets are protected with AEAD_AES_128_GCM and a key 984 derived from the Destination Connection ID in the client's first 985 Initial packet (see Section 5.2). This provides protection against 986 off-path attackers and robustness against QUIC version unaware 987 middleboxes, but not against on-path attackers. 989 QUIC can use any of the ciphersuites defined in [TLS13] with the 990 exception of TLS_AES_128_CCM_8_SHA256. A ciphersuite MUST NOT be 991 negotiated unless a header protection scheme is defined for the 992 ciphersuite. This document defines a header protection scheme for 993 all ciphersuites defined in [TLS13] aside from 994 TLS_AES_128_CCM_8_SHA256. These ciphersuites have a 16-byte 995 authentication tag and produce an output 16 bytes larger than their 996 input. 998 Note: An endpoint MUST NOT reject a ClientHello that offers a 999 ciphersuite that it does not support, or it would be impossible to 1000 deploy a new ciphersuite. This also applies to 1001 TLS_AES_128_CCM_8_SHA256. 1003 The key and IV for the packet are computed as described in 1004 Section 5.1. The nonce, N, is formed by combining the packet 1005 protection IV with the packet number. The 62 bits of the 1006 reconstructed QUIC packet number in network byte order are left- 1007 padded with zeros to the size of the IV. The exclusive OR of the 1008 padded packet number and the IV forms the AEAD nonce. 1010 The associated data, A, for the AEAD is the contents of the QUIC 1011 header, starting from the flags byte in either the short or long 1012 header, up to and including the unprotected packet number. 1014 The input plaintext, P, for the AEAD is the payload of the QUIC 1015 packet, as described in [QUIC-TRANSPORT]. 1017 The output ciphertext, C, of the AEAD is transmitted in place of P. 1019 Some AEAD functions have limits for how many packets can be encrypted 1020 under the same key and IV (see for example [AEBounds]). This might 1021 be lower than the packet number limit. An endpoint MUST initiate a 1022 key update (Section 6) prior to exceeding any limit set for the AEAD 1023 that is in use. 1025 5.4. Header Protection 1027 Parts of QUIC packet headers, in particular the Packet Number field, 1028 are protected using a key that is derived separate to the packet 1029 protection key and IV. The key derived using the "quic hp" label is 1030 used to provide confidentiality protection for those fields that are 1031 not exposed to on-path elements. 1033 This protection applies to the least-significant bits of the first 1034 byte, plus the Packet Number field. The four least-significant bits 1035 of the first byte are protected for packets with long headers; the 1036 five least significant bits of the first byte are protected for 1037 packets with short headers. For both header forms, this covers the 1038 reserved bits and the Packet Number Length field; the Key Phase bit 1039 is also protected for packets with a short header. 1041 The same header protection key is used for the duration of the 1042 connection, with the value not changing after a key update (see 1043 Section 6). This allows header protection to be used to protect the 1044 key phase. 1046 This process does not apply to Retry or Version Negotiation packets, 1047 which do not contain a protected payload or any of the fields that 1048 are protected by this process. 1050 5.4.1. Header Protection Application 1052 Header protection is applied after packet protection is applied (see 1053 Section 5.3). The ciphertext of the packet is sampled and used as 1054 input to an encryption algorithm. The algorithm used depends on the 1055 negotiated AEAD. 1057 The output of this algorithm is a 5 byte mask which is applied to the 1058 protected header fields using exclusive OR. The least significant 1059 bits of the first byte of the packet are masked by the least 1060 significant bits of the first mask byte, and the packet number is 1061 masked with the remaining bytes. Any unused bytes of mask that might 1062 result from a shorter packet number encoding are unused. 1064 Figure 6 shows a sample algorithm for applying header protection. 1065 Removing header protection only differs in the order in which the 1066 packet number length (pn_length) is determined. 1068 mask = header_protection(hp_key, sample) 1070 pn_length = (packet[0] & 0x03) + 1 1071 if (packet[0] & 0x80) == 0x80: 1072 # Long header: 4 bits masked 1073 packet[0] ^= mask[0] & 0x0f 1074 else: 1075 # Short header: 5 bits masked 1076 packet[0] ^= mask[0] & 0x1f 1078 # pn_offset is the start of the Packet Number field. 1079 packet[pn_offset:pn_offset+pn_length] ^= mask[1:1+pn_length] 1081 Figure 6: Header Protection Pseudocode 1083 Figure 7 shows the protected fields of long and short headers marked 1084 with an E. Figure 7 also shows the sampled fields. 1086 Long Header: 1087 +-+-+-+-+-+-+-+-+ 1088 |1|1|T T|E E E E| 1089 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1090 | Version -> Length Fields ... 1091 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1093 Short Header: 1094 +-+-+-+-+-+-+-+-+ 1095 |0|1|S|E E E E E| 1096 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1097 | Destination Connection ID (0/32..144) ... 1098 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1100 Common Fields: 1101 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1102 |E E E E E E E E E Packet Number (8/16/24/32) E E E E E E E E... 1103 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1104 | [Protected Payload (8/16/24)] ... 1105 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1106 | Sampled part of Protected Payload (128) ... 1107 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1108 | Protected Payload Remainder (*) ... 1109 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1111 Figure 7: Header Protection and Ciphertext Sample 1113 Before a TLS ciphersuite can be used with QUIC, a header protection 1114 algorithm MUST be specified for the AEAD used with that ciphersuite. 1115 This document defines algorithms for AEAD_AES_128_GCM, 1116 AEAD_AES_128_CCM, AEAD_AES_256_GCM (all AES AEADs are defined in 1117 [AEAD]), and AEAD_CHACHA20_POLY1305 [CHACHA]. Prior to TLS selecting 1118 a ciphersuite, AES header protection is used (Section 5.4.3), 1119 matching the AEAD_AES_128_GCM packet protection. 1121 5.4.2. Header Protection Sample 1123 The header protection algorithm uses both the header protection key 1124 and a sample of the ciphertext from the packet Payload field. 1126 The same number of bytes are always sampled, but an allowance needs 1127 to be made for the endpoint removing protection, which will not know 1128 the length of the Packet Number field. In sampling the packet 1129 ciphertext, the Packet Number field is assumed to be 4 bytes long 1130 (its maximum possible encoded length). 1132 An endpoint MUST discard packets that are not long enough to contain 1133 a complete sample. 1135 To ensure that sufficient data is available for sampling, packets are 1136 padded so that the combined lengths of the encoded packet number and 1137 protected payload is at least 4 bytes longer than the sample required 1138 for header protection. The ciphersuites defined in [TLS13] - other 1139 than TLS_AES_128_CCM_8_SHA256, for which a header protection scheme 1140 is not defined in this document - have 16-byte expansions and 16-byte 1141 header protection samples. This results in needing at least 3 bytes 1142 of frames in the unprotected payload if the packet number is encoded 1143 on a single byte, or 2 bytes of frames for a 2-byte packet number 1144 encoding. 1146 The sampled ciphertext for a packet with a short header can be 1147 determined by the following pseudocode: 1149 sample_offset = 1 + len(connection_id) + 4 1151 sample = packet[sample_offset..sample_offset+sample_length] 1153 For example, for a packet with a short header, an 8 byte connection 1154 ID, and protected with AEAD_AES_128_GCM, the sample takes bytes 13 to 1155 28 inclusive (using zero-based indexing). 1157 A packet with a long header is sampled in the same way, noting that 1158 multiple QUIC packets might be included in the same UDP datagram and 1159 that each one is handled separately. 1161 sample_offset = 7 + len(destination_connection_id) + 1162 len(source_connection_id) + 1163 len(payload_length) + 4 1164 if packet_type == Initial: 1165 sample_offset += len(token_length) + 1166 len(token) 1168 sample = packet[sample_offset..sample_offset+sample_length] 1170 5.4.3. AES-Based Header Protection 1172 This section defines the packet protection algorithm for 1173 AEAD_AES_128_GCM, AEAD_AES_128_CCM, and AEAD_AES_256_GCM. 1174 AEAD_AES_128_GCM and AEAD_AES_128_CCM use 128-bit AES [AES] in 1175 electronic code-book (ECB) mode. AEAD_AES_256_GCM uses 256-bit AES 1176 in ECB mode. 1178 This algorithm samples 16 bytes from the packet ciphertext. This 1179 value is used as the input to AES-ECB. In pseudocode: 1181 mask = AES-ECB(hp_key, sample) 1183 5.4.4. ChaCha20-Based Header Protection 1185 When AEAD_CHACHA20_POLY1305 is in use, header protection uses the raw 1186 ChaCha20 function as defined in Section 2.4 of [CHACHA]. This uses a 1187 256-bit key and 16 bytes sampled from the packet protection output. 1189 The first 4 bytes of the sampled ciphertext are the block counter. A 1190 ChaCha20 implementation could take a 32-bit integer in place of a 1191 byte sequence, in which case the byte sequence is interpreted as a 1192 little-endian value. 1194 The remaining 12 bytes are used as the nonce. A ChaCha20 1195 implementation might take an array of three 32-bit integers in place 1196 of a byte sequence, in which case the nonce bytes are interpreted as 1197 a sequence of 32-bit little-endian integers. 1199 The encryption mask is produced by invoking ChaCha20 to protect 5 1200 zero bytes. In pseudocode: 1202 counter = sample[0..3] 1203 nonce = sample[4..15] 1204 mask = ChaCha20(hp_key, counter, nonce, {0,0,0,0,0}) 1206 5.5. Receiving Protected Packets 1208 Once an endpoint successfully receives a packet with a given packet 1209 number, it MUST discard all packets in the same packet number space 1210 with higher packet numbers if they cannot be successfully unprotected 1211 with either the same key, or - if there is a key update - the next 1212 packet protection key (see Section 6). Similarly, a packet that 1213 appears to trigger a key update, but cannot be unprotected 1214 successfully MUST be discarded. 1216 Failure to unprotect a packet does not necessarily indicate the 1217 existence of a protocol error in a peer or an attack. The truncated 1218 packet number encoding used in QUIC can cause packet numbers to be 1219 decoded incorrectly if they are delayed significantly. 1221 5.6. Use of 0-RTT Keys 1223 If 0-RTT keys are available (see Section 4.5), the lack of replay 1224 protection means that restrictions on their use are necessary to 1225 avoid replay attacks on the protocol. 1227 A client MUST only use 0-RTT keys to protect data that is idempotent. 1228 A client MAY wish to apply additional restrictions on what data it 1229 sends prior to the completion of the TLS handshake. A client 1230 otherwise treats 0-RTT keys as equivalent to 1-RTT keys, except that 1231 it MUST NOT send ACKs with 0-RTT keys. 1233 A client that receives an indication that its 0-RTT data has been 1234 accepted by a server can send 0-RTT data until it receives all of the 1235 server's handshake messages. A client SHOULD stop sending 0-RTT data 1236 if it receives an indication that 0-RTT data has been rejected. 1238 A server MUST NOT use 0-RTT keys to protect packets; it uses 1-RTT 1239 keys to protect acknowledgements of 0-RTT packets. A client MUST NOT 1240 attempt to decrypt 0-RTT packets it receives and instead MUST discard 1241 them. 1243 Once a client has installed 1-RTT keys, it MUST NOT send any more 1244 0-RTT packets. 1246 Note: 0-RTT data can be acknowledged by the server as it receives 1247 it, but any packets containing acknowledgments of 0-RTT data 1248 cannot have packet protection removed by the client until the TLS 1249 handshake is complete. The 1-RTT keys necessary to remove packet 1250 protection cannot be derived until the client receives all server 1251 handshake messages. 1253 5.7. Receiving Out-of-Order Protected Frames 1255 Due to reordering and loss, protected packets might be received by an 1256 endpoint before the final TLS handshake messages are received. A 1257 client will be unable to decrypt 1-RTT packets from the server, 1258 whereas a server will be able to decrypt 1-RTT packets from the 1259 client. Endpoints in either role MUST NOT decrypt 1-RTT packets from 1260 their peer prior to completing the handshake. 1262 Even though 1-RTT keys are available to a server after receiving the 1263 first handshake messages from a client, it is missing assurances on 1264 the client state: 1266 * The client is not authenticated, unless the server has chosen to 1267 use a pre-shared key and validated the client's pre-shared key 1268 binder; see Section 4.2.11 of [TLS13]. 1270 * The client has not demonstrated liveness, unless a RETRY packet 1271 was used. 1273 * Any received 0-RTT data that the server responds to might be due 1274 to a replay attack. 1276 Therefore, the server's use of 1-RTT keys MUST be limited to sending 1277 data before the handshake is complete. A server MUST NOT process 1278 incoming 1-RTT protected packets before the TLS handshake is 1279 complete. Because sending acknowledgments indicates that all frames 1280 in a packet have been processed, a server cannot send acknowledgments 1281 for 1-RTT packets until the TLS handshake is complete. Received 1282 packets protected with 1-RTT keys MAY be stored and later decrypted 1283 and used once the handshake is complete. 1285 Note: TLS implementations might provide all 1-RTT secrets prior to 1286 handshake completion. Even where QUIC implementations have 1-RTT 1287 read keys, those keys cannot be used prior to completing the 1288 handshake. 1290 The requirement for the server to wait for the client Finished 1291 message creates a dependency on that message being delivered. A 1292 client can avoid the potential for head-of-line blocking that this 1293 implies by sending its 1-RTT packets coalesced with a handshake 1294 packet containing a copy of the CRYPTO frame that carries the 1295 Finished message, until one of the handshake packets is acknowledged. 1296 This enables immediate server processing for those packets. 1298 A server could receive packets protected with 0-RTT keys prior to 1299 receiving a TLS ClientHello. The server MAY retain these packets for 1300 later decryption in anticipation of receiving a ClientHello. 1302 5.8. Retry Packet Integrity 1304 Retry packets (see the Retry Packet section of [QUIC-TRANSPORT]) 1305 carry a Retry Integrity Tag that provides two properties: it allows 1306 discarding packets that have accidentally been corrupted by the 1307 network, and it diminishes off-path attackers' ability to send valid 1308 Retry packets. 1310 The Retry Integrity Tag is a 128-bit field that is computed as the 1311 output of AEAD_AES_128_GCM [AEAD] used with the following inputs: 1313 * The secret key, K, is 128 bits equal to 1314 0x4d32ecdb2a2133c841e4043df27d4430. 1316 * The nonce, N, is 96 bits equal to 0x4d1611d05513a552c587d575. 1318 * The plaintext, P, is empty. 1320 * The associated data, A, is the contents of the Retry Pseudo- 1321 Packet, as illustrated in Figure 8: 1323 The secret key and the nonce are values derived by calling HKDF- 1324 Expand-Label using 1325 0x656e61e336ae9417f7f0edd8d78d461e2aa7084aba7a14c1e9f726d55709169a as 1326 the secret, with labels being "quic key" and "quic iv" (Section 5.1). 1328 0 1 2 3 1329 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1330 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1331 | ODCID Len (8) | 1332 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1333 | Original Destination Connection ID (0..160) ... 1334 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1335 |1|1| 3 | Unused| 1336 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1337 | Version (32) | 1338 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1339 | DCID Len (8) | 1340 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1341 | Destination Connection ID (0..160) ... 1342 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1343 | SCID Len (8) | 1344 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1345 | Source Connection ID (0..160) ... 1346 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1347 | Retry Token (*) ... 1348 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1349 Figure 8: Retry Pseudo-Packet 1351 The Retry Pseudo-Packet is not sent over the wire. It is computed by 1352 taking the transmitted Retry packet, removing the Retry Integrity Tag 1353 and prepending the two following fields: 1355 ODCID Len: The ODCID Len contains the length in bytes of the 1356 Original Destination Connection ID field that follows it, encoded 1357 as an 8-bit unsigned integer. 1359 Original Destination Connection ID: The Original Destination 1360 Connection ID contains the value of the Destination Connection ID 1361 from the Initial packet that this Retry is in response to. The 1362 length of this field is given in ODCID Len. The presence of this 1363 field mitigates an off-path attacker's ability to inject a Retry 1364 packet. 1366 6. Key Update 1368 Once the handshake is confirmed (see Section 4.1.2), an endpoint MAY 1369 initiate a key update. 1371 The Key Phase bit indicates which packet protection keys are used to 1372 protect the packet. The Key Phase bit is initially set to 0 for the 1373 first set of 1-RTT packets and toggled to signal each subsequent key 1374 update. 1376 The Key Phase bit allows a recipient to detect a change in keying 1377 material without needing to receive the first packet that triggered 1378 the change. An endpoint that notices a changed Key Phase bit updates 1379 keys and decrypts the packet that contains the changed value. 1381 This mechanism replaces the TLS KeyUpdate message. Endpoints MUST 1382 NOT send a TLS KeyUpdate message. Endpoints MUST treat the receipt 1383 of a TLS KeyUpdate message as a connection error of type 0x10a, 1384 equivalent to a fatal TLS alert of unexpected_message (see 1385 Section 4.9). 1387 Figure 9 shows a key update process, where the initial set of keys 1388 used (identified with @M) are replaced by updated keys (identified 1389 with @N). The value of the Key Phase bit is indicated in brackets 1390 []. 1392 Initiating Peer Responding Peer 1394 @M [0] QUIC Packets 1396 ... Update to @N 1397 @N [1] QUIC Packets 1398 --------> 1399 Update to @N ... 1400 QUIC Packets [1] @N 1401 <-------- 1402 QUIC Packets [1] @N 1403 containing ACK 1404 <-------- 1405 ... Key Update Permitted 1407 @N [1] QUIC Packets 1408 containing ACK for @N packets 1409 --------> 1410 Key Update Permitted ... 1412 Figure 9: Key Update 1414 6.1. Initiating a Key Update 1416 Endpoints maintain separate read and write secrets for packet 1417 protection. An endpoint initiates a key update by updating its 1418 packet protection write secret and using that to protect new packets. 1419 The endpoint creates a new write secret from the existing write 1420 secret as performed in Section 7.2 of [TLS13]. This uses the KDF 1421 function provided by TLS with a label of "quic ku". The 1422 corresponding key and IV are created from that secret as defined in 1423 Section 5.1. The header protection key is not updated. 1425 For example, to update write keys with TLS 1.3, HKDF-Expand-Label is 1426 used as: 1428 secret_ = HKDF-Expand-Label(secret_, "quic ku", 1429 "", Hash.length) 1431 The endpoint toggles the value of the Key Phase bit and uses the 1432 updated key and IV to protect all subsequent packets. 1434 An endpoint MUST NOT initiate a key update prior to having confirmed 1435 the handshake (Section 4.1.2). An endpoint MUST NOT initiate a 1436 subsequent key update prior unless it has received an acknowledgment 1437 for a packet that was sent protected with keys from the current key 1438 phase. This ensures that keys are available to both peers before 1439 another key update can be initiated. This can be implemented by 1440 tracking the lowest packet number sent with each key phase, and the 1441 highest acknowledged packet number in the 1-RTT space: once the 1442 latter is higher than or equal to the former, another key update can 1443 be initiated. 1445 Note: Keys of packets other than the 1-RTT packets are never 1446 updated; their keys are derived solely from the TLS handshake 1447 state. 1449 The endpoint that initiates a key update also updates the keys that 1450 it uses for receiving packets. These keys will be needed to process 1451 packets the peer sends after updating. 1453 An endpoint SHOULD retain old keys so that packets sent by its peer 1454 prior to receiving the key update can be processed. Discarding old 1455 keys too early can cause delayed packets to be discarded. Discarding 1456 packets will be interpreted as packet loss by the peer and could 1457 adversely affect performance. 1459 6.2. Responding to a Key Update 1461 A peer is permitted to initiate a key update after receiving an 1462 acknowledgement of a packet in the current key phase. An endpoint 1463 detects a key update when processing a packet with a key phase that 1464 differs from the value last used to protect the last packet it sent. 1465 To process this packet, the endpoint uses the next packet protection 1466 key and IV. See Section 6.3 for considerations about generating 1467 these keys. 1469 If a packet is successfully processed using the next key and IV, then 1470 the peer has initiated a key update. The endpoint MUST update its 1471 send keys to the corresponding key phase in response, as described in 1472 Section 6.1. Sending keys MUST be updated before sending an 1473 acknowledgement for the packet that was received with updated keys. 1474 By acknowledging the packet that triggered the key update in a packet 1475 protected with the updated keys, the endpoint signals that the key 1476 update is complete. 1478 An endpoint can defer sending the packet or acknowledgement according 1479 to its normal packet sending behaviour; it is not necessary to 1480 immediately generate a packet in response to a key update. The next 1481 packet sent by the endpoint will use the updated keys. The next 1482 packet that contains an acknowledgement will cause the key update to 1483 be completed. If an endpoint detects a second update before it has 1484 sent any packets with updated keys containing an acknowledgement for 1485 the packet that initiated the key update, it indicates that its peer 1486 has updated keys twice without awaiting confirmation. An endpoint 1487 MAY treat consecutive key updates as a connection error of type 1488 KEY_UPDATE_ERROR. 1490 An endpoint that receives an acknowledgement that is carried in a 1491 packet protected with old keys where any acknowledged packet was 1492 protected with newer keys MAY treat that as a connection error of 1493 type KEY_UPDATE_ERROR. This indicates that a peer has received and 1494 acknowledged a packet that initiates a key update, but has not 1495 updated keys in response. 1497 6.3. Timing of Receive Key Generation 1499 Endpoints responding to an apparent key update MUST NOT generate a 1500 timing side-channel signal that might indicate that the Key Phase bit 1501 was invalid (see Section 9.3). Endpoints can use dummy packet 1502 protection keys in place of discarded keys when key updates are not 1503 yet permitted. Using dummy keys will generate no variation in the 1504 timing signal produced by attempting to remove packet protection, and 1505 results in all packets with an invalid Key Phase bit being rejected. 1507 The process of creating new packet protection keys for receiving 1508 packets could reveal that a key update has occurred. An endpoint MAY 1509 perform this process as part of packet processing, but this creates a 1510 timing signal that can be used by an attacker to learn when key 1511 updates happen and thus the value of the Key Phase bit in certain 1512 packets. Endpoints MAY instead defer the creation of the next set of 1513 receive packet protection keys until some time after a key update 1514 completes, up to three times the PTO; see Section 6.5. 1516 Once generated, the next set of packet protection keys SHOULD be 1517 retained, even if the packet that was received was subsequently 1518 discarded. Packets containing apparent key updates are easy to forge 1519 and - while the process of key update does not require significant 1520 effort - triggering this process could be used by an attacker for 1521 DoS. 1523 For this reason, endpoints MUST be able to retain two sets of packet 1524 protection keys for receiving packets: the current and the next. 1525 Retaining the previous keys in addition to these might improve 1526 performance, but this is not essential. 1528 6.4. Sending with Updated Keys 1530 An endpoint always sends packets that are protected with the newest 1531 keys. Keys used for packet protection can be discarded immediately 1532 after switching to newer keys. 1534 Packets with higher packet numbers MUST be protected with either the 1535 same or newer packet protection keys than packets with lower packet 1536 numbers. An endpoint that successfully removes protection with old 1537 keys when newer keys were used for packets with lower packet numbers 1538 MUST treat this as a connection error of type KEY_UPDATE_ERROR. 1540 6.5. Receiving with Different Keys 1542 For receiving packets during a key update, packets protected with 1543 older keys might arrive if they were delayed by the network. 1544 Retaining old packet protection keys allows these packets to be 1545 successfully processed. 1547 As packets protected with keys from the next key phase use the same 1548 Key Phase value as those protected with keys from the previous key 1549 phase, it can be necessary to distinguish between the two. This can 1550 be done using packet numbers. A recovered packet number that is 1551 lower than any packet number from the current key phase uses the 1552 previous packet protection keys; a recovered packet number that is 1553 higher than any packet number from the current key phase requires the 1554 use of the next packet protection keys. 1556 Some care is necessary to ensure that any process for selecting 1557 between previous, current, and next packet protection keys does not 1558 expose a timing side channel that might reveal which keys were used 1559 to remove packet protection. See Section 9.4 for more information. 1561 Alternatively, endpoints can retain only two sets of packet 1562 protection keys, swapping previous for next after enough time has 1563 passed to allow for reordering in the network. In this case, the Key 1564 Phase bit alone can be used to select keys. 1566 An endpoint MAY allow a period of approximately the Probe Timeout 1567 (PTO; see [QUIC-RECOVERY]) after a key update before it creates the 1568 next set of packet protection keys. These updated keys MAY replace 1569 the previous keys at that time. With the caveat that PTO is a 1570 subjective measure - that is, a peer could have a different view of 1571 the RTT - this time is expected to be long enough that any reordered 1572 packets would be declared lost by a peer even if they were 1573 acknowledged and short enough to allow for subsequent key updates. 1575 Endpoints need to allow for the possibility that a peer might not be 1576 able to decrypt packets that initiate a key update during the period 1577 when it retains old keys. Endpoints SHOULD wait three times the PTO 1578 before initiating a key update after receiving an acknowledgment that 1579 confirms that the previous key update was received. Failing to allow 1580 sufficient time could lead to packets being discarded. 1582 An endpoint SHOULD retain old read keys for no more than three times 1583 the PTO. After this period, old read keys and their corresponding 1584 secrets SHOULD be discarded. 1586 6.6. Key Update Frequency 1588 Key updates MUST be initiated before usage limits on packet 1589 protection keys are exceeded. For the cipher suites mentioned in 1590 this document, the limits in Section 5.5 of [TLS13] apply. Other 1591 cipher suites MUST define usage limits in order to be used with QUIC. 1593 6.7. Key Update Error Code 1595 The KEY_UPDATE_ERROR error code (0xE) is used to signal errors 1596 related to key updates. 1598 7. Security of Initial Messages 1600 Initial packets are not protected with a secret key, so they are 1601 subject to potential tampering by an attacker. QUIC provides 1602 protection against attackers that cannot read packets, but does not 1603 attempt to provide additional protection against attacks where the 1604 attacker can observe and inject packets. Some forms of tampering - 1605 such as modifying the TLS messages themselves - are detectable, but 1606 some - such as modifying ACKs - are not. 1608 For example, an attacker could inject a packet containing an ACK 1609 frame that makes it appear that a packet had not been received or to 1610 create a false impression of the state of the connection (e.g., by 1611 modifying the ACK Delay). Note that such a packet could cause a 1612 legitimate packet to be dropped as a duplicate. Implementations 1613 SHOULD use caution in relying on any data which is contained in 1614 Initial packets that is not otherwise authenticated. 1616 It is also possible for the attacker to tamper with data that is 1617 carried in Handshake packets, but because that tampering requires 1618 modifying TLS handshake messages, that tampering will cause the TLS 1619 handshake to fail. 1621 8. QUIC-Specific Additions to the TLS Handshake 1623 QUIC uses the TLS handshake for more than just negotiation of 1624 cryptographic parameters. The TLS handshake provides preliminary 1625 values for QUIC transport parameters and allows a server to perform 1626 return routability checks on clients. 1628 8.1. Protocol Negotiation 1630 QUIC requires that the cryptographic handshake provide authenticated 1631 protocol negotiation. TLS uses Application Layer Protocol 1632 Negotiation (ALPN) [ALPN] to select an application protocol. Unless 1633 another mechanism is used for agreeing on an application protocol, 1634 endpoints MUST use ALPN for this purpose. When using ALPN, endpoints 1635 MUST immediately close a connection (see Section 10.3 in 1636 [QUIC-TRANSPORT]) if an application protocol is not negotiated with a 1637 no_application_protocol TLS alert (QUIC error code 0x178, see 1638 Section 4.9). While [ALPN] only specifies that servers use this 1639 alert, QUIC clients MUST also use it to terminate a connection when 1640 ALPN negotiation fails. 1642 An application protocol MAY restrict the QUIC versions that it can 1643 operate over. Servers MUST select an application protocol compatible 1644 with the QUIC version that the client has selected. The server MUST 1645 treat the inability to select a compatible application protocol as a 1646 connection error of type 0x178 (no_application_protocol). Similarly, 1647 a client MUST treat the selection of an incompatible application 1648 protocol by a server as a connection error of type 0x178. 1650 8.2. QUIC Transport Parameters Extension 1652 QUIC transport parameters are carried in a TLS extension. Different 1653 versions of QUIC might define a different method for negotiating 1654 transport configuration. 1656 Including transport parameters in the TLS handshake provides 1657 integrity protection for these values. 1659 enum { 1660 quic_transport_parameters(0xffa5), (65535) 1661 } ExtensionType; 1663 The "extension_data" field of the quic_transport_parameters extension 1664 contains a value that is defined by the version of QUIC that is in 1665 use. 1667 The quic_transport_parameters extension is carried in the ClientHello 1668 and the EncryptedExtensions messages during the handshake. Endpoints 1669 MUST send the quic_transport_parameters extension; endpoints that 1670 receive ClientHello or EncryptedExtensions messages without the 1671 quic_transport_parameters extension MUST close the connection with an 1672 error of type 0x16d (equivalent to a fatal TLS missing_extension 1673 alert, see Section 4.9). 1675 While the transport parameters are technically available prior to the 1676 completion of the handshake, they cannot be fully trusted until the 1677 handshake completes, and reliance on them should be minimized. 1678 However, any tampering with the parameters will cause the handshake 1679 to fail. 1681 Endpoints MUST NOT send this extension in a TLS connection that does 1682 not use QUIC (such as the use of TLS with TCP defined in [TLS13]). A 1683 fatal unsupported_extension alert MUST be sent by an implementation 1684 that supports this extension if the extension is received when the 1685 transport is not QUIC. 1687 8.3. Removing the EndOfEarlyData Message 1689 The TLS EndOfEarlyData message is not used with QUIC. QUIC does not 1690 rely on this message to mark the end of 0-RTT data or to signal the 1691 change to Handshake keys. 1693 Clients MUST NOT send the EndOfEarlyData message. A server MUST 1694 treat receipt of a CRYPTO frame in a 0-RTT packet as a connection 1695 error of type PROTOCOL_VIOLATION. 1697 As a result, EndOfEarlyData does not appear in the TLS handshake 1698 transcript. 1700 9. Security Considerations 1702 There are likely to be some real clangers here eventually, but the 1703 current set of issues is well captured in the relevant sections of 1704 the main text. 1706 Never assume that because it isn't in the security considerations 1707 section it doesn't affect security. Most of this document does. 1709 9.1. Replay Attacks with 0-RTT 1711 As described in Section 8 of [TLS13], use of TLS early data comes 1712 with an exposure to replay attack. The use of 0-RTT in QUIC is 1713 similarly vulnerable to replay attack. 1715 Endpoints MUST implement and use the replay protections described in 1716 [TLS13], however it is recognized that these protections are 1717 imperfect. Therefore, additional consideration of the risk of replay 1718 is needed. 1720 QUIC is not vulnerable to replay attack, except via the application 1721 protocol information it might carry. The management of QUIC protocol 1722 state based on the frame types defined in [QUIC-TRANSPORT] is not 1723 vulnerable to replay. Processing of QUIC frames is idempotent and 1724 cannot result in invalid connection states if frames are replayed, 1725 reordered or lost. QUIC connections do not produce effects that last 1726 beyond the lifetime of the connection, except for those produced by 1727 the application protocol that QUIC serves. 1729 Note: TLS session tickets and address validation tokens are used to 1730 carry QUIC configuration information between connections. These 1731 MUST NOT be used to carry application semantics. The potential 1732 for reuse of these tokens means that they require stronger 1733 protections against replay. 1735 A server that accepts 0-RTT on a connection incurs a higher cost than 1736 accepting a connection without 0-RTT. This includes higher 1737 processing and computation costs. Servers need to consider the 1738 probability of replay and all associated costs when accepting 0-RTT. 1740 Ultimately, the responsibility for managing the risks of replay 1741 attacks with 0-RTT lies with an application protocol. An application 1742 protocol that uses QUIC MUST describe how the protocol uses 0-RTT and 1743 the measures that are employed to protect against replay attack. An 1744 analysis of replay risk needs to consider all QUIC protocol features 1745 that carry application semantics. 1747 Disabling 0-RTT entirely is the most effective defense against replay 1748 attack. 1750 QUIC extensions MUST describe how replay attacks affect their 1751 operation, or prohibit their use in 0-RTT. Application protocols 1752 MUST either prohibit the use of extensions that carry application 1753 semantics in 0-RTT or provide replay mitigation strategies. 1755 9.2. Packet Reflection Attack Mitigation 1757 A small ClientHello that results in a large block of handshake 1758 messages from a server can be used in packet reflection attacks to 1759 amplify the traffic generated by an attacker. 1761 QUIC includes three defenses against this attack. First, the packet 1762 containing a ClientHello MUST be padded to a minimum size. Second, 1763 if responding to an unverified source address, the server is 1764 forbidden to send more than three UDP datagrams in its first flight 1765 (see Section 8.1 of [QUIC-TRANSPORT]). Finally, because 1766 acknowledgements of Handshake packets are authenticated, a blind 1767 attacker cannot forge them. Put together, these defenses limit the 1768 level of amplification. 1770 9.3. Header Protection Analysis 1772 [NAN] analyzes authenticated encryption algorithms which provide 1773 nonce privacy, referred to as "Hide Nonce" (HN) transforms. The 1774 general header protection construction in this document is one of 1775 those algorithms (HN1). Header protection uses the output of the 1776 packet protection AEAD to derive "sample", and then encrypts the 1777 header field using a pseudorandom function (PRF) as follows: 1779 protected_field = field XOR PRF(hp_key, sample) 1781 The header protection variants in this document use a pseudorandom 1782 permutation (PRP) in place of a generic PRF. However, since all PRPs 1783 are also PRFs [IMC], these variants do not deviate from the HN1 1784 construction. 1786 As "hp_key" is distinct from the packet protection key, it follows 1787 that header protection achieves AE2 security as defined in [NAN] and 1788 therefore guarantees privacy of "field", the protected packet header. 1789 Future header protection variants based on this construction MUST use 1790 a PRF to ensure equivalent security guarantees. 1792 Use of the same key and ciphertext sample more than once risks 1793 compromising header protection. Protecting two different headers 1794 with the same key and ciphertext sample reveals the exclusive OR of 1795 the protected fields. Assuming that the AEAD acts as a PRF, if L 1796 bits are sampled, the odds of two ciphertext samples being identical 1797 approach 2^(-L/2), that is, the birthday bound. For the algorithms 1798 described in this document, that probability is one in 2^64. 1800 Note: In some cases, inputs shorter than the full size required by 1801 the packet protection algorithm might be used. 1803 To prevent an attacker from modifying packet headers, the header is 1804 transitively authenticated using packet protection; the entire packet 1805 header is part of the authenticated additional data. Protected 1806 fields that are falsified or modified can only be detected once the 1807 packet protection is removed. 1809 9.4. Header Protection Timing Side-Channels 1811 An attacker could guess values for packet numbers or Key Phase and 1812 have an endpoint confirm guesses through timing side channels. 1813 Similarly, guesses for the packet number length can be trialed and 1814 exposed. If the recipient of a packet discards packets with 1815 duplicate packet numbers without attempting to remove packet 1816 protection they could reveal through timing side-channels that the 1817 packet number matches a received packet. For authentication to be 1818 free from side-channels, the entire process of header protection 1819 removal, packet number recovery, and packet protection removal MUST 1820 be applied together without timing and other side-channels. 1822 For the sending of packets, construction and protection of packet 1823 payloads and packet numbers MUST be free from side-channels that 1824 would reveal the packet number or its encoded size. 1826 During a key update, the time taken to generate new keys could reveal 1827 through timing side-channels that a key update has occurred. 1828 Alternatively, where an attacker injects packets this side-channel 1829 could reveal the value of the Key Phase on injected packets. After 1830 receiving a key update, an endpoint SHOULD generate and save the next 1831 set of receive packet protection keys, as described in Section 6.3. 1832 By generating new keys before a key update is received, receipt of 1833 packets will not create timing signals that leak the value of the Key 1834 Phase. 1836 This depends on not doing this key generation during packet 1837 processing and it can require that endpoints maintain three sets of 1838 packet protection keys for receiving: for the previous key phase, for 1839 the current key phase, and for the next key phase. Endpoints can 1840 instead choose to defer generation of the next receive packet 1841 protection keys until they discard old keys so that only two sets of 1842 receive keys need to be retained at any point in time. 1844 9.5. Key Diversity 1846 In using TLS, the central key schedule of TLS is used. As a result 1847 of the TLS handshake messages being integrated into the calculation 1848 of secrets, the inclusion of the QUIC transport parameters extension 1849 ensures that handshake and 1-RTT keys are not the same as those that 1850 might be produced by a server running TLS over TCP. To avoid the 1851 possibility of cross-protocol key synchronization, additional 1852 measures are provided to improve key separation. 1854 The QUIC packet protection keys and IVs are derived using a different 1855 label than the equivalent keys in TLS. 1857 To preserve this separation, a new version of QUIC SHOULD define new 1858 labels for key derivation for packet protection key and IV, plus the 1859 header protection keys. This version of QUIC uses the string "quic". 1860 Other versions can use a version-specific label in place of that 1861 string. 1863 The initial secrets use a key that is specific to the negotiated QUIC 1864 version. New QUIC versions SHOULD define a new salt value used in 1865 calculating initial secrets. 1867 10. IANA Considerations 1869 This document does not create any new IANA registries, but it 1870 registers the values in the following registries: 1872 * TLS ExtensionType Values Registry [TLS-REGISTRIES] - IANA is to 1873 register the quic_transport_parameters extension found in 1874 Section 8.2. The Recommended column is to be marked Yes. The TLS 1875 1.3 Column is to include CH and EE. 1877 * QUIC Transport Error Codes Registry [QUIC-TRANSPORT] - IANA is to 1878 register the KEY_UPDATE_ERROR (0xE), as described in Section 6.7. 1880 11. References 1882 11.1. Normative References 1884 [AEAD] McGrew, D., "An Interface and Algorithms for Authenticated 1885 Encryption", RFC 5116, DOI 10.17487/RFC5116, January 2008, 1886 . 1888 [AES] "Advanced encryption standard (AES)", 1889 DOI 10.6028/nist.fips.197, National Institute of Standards 1890 and Technology report, November 2001, 1891 . 1893 [ALPN] Friedl, S., Popov, A., Langley, A., and E. Stephan, 1894 "Transport Layer Security (TLS) Application-Layer Protocol 1895 Negotiation Extension", RFC 7301, DOI 10.17487/RFC7301, 1896 July 2014, . 1898 [CHACHA] Nir, Y. and A. Langley, "ChaCha20 and Poly1305 for IETF 1899 Protocols", RFC 8439, DOI 10.17487/RFC8439, June 2018, 1900 . 1902 [QUIC-RECOVERY] 1903 Iyengar, J., Ed. and I. Swett, Ed., "QUIC Loss Detection 1904 and Congestion Control", Work in Progress, Internet-Draft, 1905 draft-ietf-quic-recovery-25, 22 January 2020, 1906 . 1908 [QUIC-TRANSPORT] 1909 Iyengar, J., Ed. and M. Thomson, Ed., "QUIC: A UDP-Based 1910 Multiplexed and Secure Transport", Work in Progress, 1911 Internet-Draft, draft-ietf-quic-transport-25, 22 January 1912 2020, . 1915 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1916 Requirement Levels", BCP 14, RFC 2119, 1917 DOI 10.17487/RFC2119, March 1997, 1918 . 1920 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 1921 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 1922 May 2017, . 1924 [SHA] Dang, Q., "Secure Hash Standard", 1925 DOI 10.6028/nist.fips.180-4, National Institute of 1926 Standards and Technology report, July 2015, 1927 . 1929 [TLS-REGISTRIES] 1930 Salowey, J. and S. Turner, "IANA Registry Updates for TLS 1931 and DTLS", RFC 8447, DOI 10.17487/RFC8447, August 2018, 1932 . 1934 [TLS13] Rescorla, E., "The Transport Layer Security (TLS) Protocol 1935 Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, 1936 . 1938 11.2. Informative References 1940 [AEBounds] Luykx, A. and K. Paterson, "Limits on Authenticated 1941 Encryption Use in TLS", 8 March 2016, 1942 . 1944 [HTTP2-TLS13] 1945 Benjamin, D., "Using TLS 1.3 with HTTP/2", Work in 1946 Progress, Internet-Draft, draft-ietf-httpbis- 1947 http2-tls13-03, 17 October 2019, . 1950 [IMC] Katz, J. and Y. Lindell, "Introduction to Modern 1951 Cryptography, Second Edition", ISBN 978-1466570269, 6 1952 November 2014. 1954 [NAN] Bellare, M., Ng, R., and B. Tackmann, "Nonces Are Noticed: 1955 AEAD Revisited", DOI 10.1007/978-3-030-26948-7_9, Advances 1956 in Cryptology - CRYPTO 2019 pp. 235-265, 2019, 1957 . 1959 [QUIC-HTTP] 1960 Bishop, M., Ed., "Hypertext Transfer Protocol Version 3 1961 (HTTP/3)", Work in Progress, Internet-Draft, draft-ietf- 1962 quic-http-25, 22 January 2020, 1963 . 1965 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, 1966 DOI 10.17487/RFC2818, May 2000, 1967 . 1969 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 1970 Housley, R., and W. Polk, "Internet X.509 Public Key 1971 Infrastructure Certificate and Certificate Revocation List 1972 (CRL) Profile", RFC 5280, DOI 10.17487/RFC5280, May 2008, 1973 . 1975 Appendix A. Sample Initial Packet Protection 1977 This section shows examples of packet protection for Initial packets 1978 so that implementations can be verified incrementally. These packets 1979 use an 8-byte client-chosen Destination Connection ID of 1980 0x8394c8f03e515708. Values for both server and client packet 1981 protection are shown together with values in hexadecimal. 1983 A.1. Keys 1985 The labels generated by the HKDF-Expand-Label function are: 1987 client in: 00200f746c73313320636c69656e7420696e00 1989 server in: 00200f746c7331332073657276657220696e00 1991 quic key: 00100e746c7331332071756963206b657900 1993 quic iv: 000c0d746c733133207175696320697600 1995 quic hp: 00100d746c733133207175696320687000 1997 The initial secret is common: 1999 initial_secret = HKDF-Extract(initial_salt, cid) 2000 = 524e374c6da8cf8b496f4bcb69678350 2001 7aafee6198b202b4bc823ebf7514a423 2003 The secrets for protecting client packets are: 2005 client_initial_secret 2006 = HKDF-Expand-Label(initial_secret, "client in", _, 32) 2007 = fda3953aecc040e48b34e27ef87de3a6 2008 098ecf0e38b7e032c5c57bcbd5975b84 2010 key = HKDF-Expand-Label(client_initial_secret, "quic key", _, 16) 2011 = af7fd7efebd21878ff66811248983694 2013 iv = HKDF-Expand-Label(client_initial_secret, "quic iv", _, 12) 2014 = 8681359410a70bb9c92f0420 2016 hp = HKDF-Expand-Label(client_initial_secret, "quic hp", _, 16) 2017 = a980b8b4fb7d9fbc13e814c23164253d 2019 The secrets for protecting server packets are: 2021 server_initial_secret 2022 = HKDF-Expand-Label(initial_secret, "server in", _, 32) 2023 = 554366b81912ff90be41f17e80222130 2024 90ab17d8149179bcadf222f29ff2ddd5 2026 key = HKDF-Expand-Label(server_initial_secret, "quic key", _, 16) 2027 = 5d51da9ee897a21b2659ccc7e5bfa577 2029 iv = HKDF-Expand-Label(server_initial_secret, "quic iv", _, 12) 2030 = 5e5ae651fd1e8495af13508b 2032 hp = HKDF-Expand-Label(server_initial_secret, "quic hp", _, 16) 2033 = a8ed82e6664f865aedf6106943f95fb8 2035 A.2. Client Initial 2037 The client sends an Initial packet. The unprotected payload of this 2038 packet contains the following CRYPTO frame, plus enough PADDING 2039 frames to make a 1162 byte payload: 2041 060040c4010000c003036660261ff947 cea49cce6cfad687f457cf1b14531ba1 2042 4131a0e8f309a1d0b9c4000006130113 031302010000910000000b0009000006 2043 736572766572ff01000100000a001400 12001d00170018001901000101010201 2044 03010400230000003300260024001d00 204cfdfcd178b784bf328cae793b136f 2045 2aedce005ff183d7bb14952072366470 37002b0003020304000d0020001e0403 2046 05030603020308040805080604010501 060102010402050206020202002d0002 2047 0101001c00024001 2049 The unprotected header includes the connection ID and a 4 byte packet 2050 number encoding for a packet number of 2: 2052 c3ff000019088394c8f03e5157080000449e00000002 2053 Protecting the payload produces output that is sampled for header 2054 protection. Because the header uses a 4 byte packet number encoding, 2055 the first 16 bytes of the protected payload is sampled, then applied 2056 to the header: 2058 sample = 535064a4268a0d9d7b1c9d250ae35516 2060 mask = AES-ECB(hp, sample)[0..4] 2061 = 833b343aaa 2063 header[0] ^= mask[0] & 0x0f 2064 = c0 2065 header[18..21] ^= mask[1..4] 2066 = 3b343aa8 2067 header = c0ff000019088394c8f03e5157080000449e3b343aa8 2069 The resulting protected packet is: 2071 c0ff000019088394c8f03e5157080000 449e3b343aa8535064a4268a0d9d7b1c 2072 9d250ae355162276e9b1e3011ef6bbc0 ab48ad5bcc2681e953857ca62becd752 2073 4daac473e68d7405fbba4e9ee616c870 38bdbe908c06d9605d9ac49030359eec 2074 b1d05a14e117db8cede2bb09d0dbbfee 271cb374d8f10abec82d0f59a1dee29f 2075 e95638ed8dd41da07487468791b719c5 5c46968eb3b54680037102a28e53dc1d 2076 12903db0af5821794b41c4a93357fa59 ce69cfe7f6bdfa629eef78616447e1d6 2077 11c4baf71bf33febcb03137c2c75d253 17d3e13b684370f668411c0f00304b50 2078 1c8fd422bd9b9ad81d643b20da89ca05 25d24d2b142041cae0af205092e43008 2079 0cd8559ea4c5c6e4fa3f66082b7d303e 52ce0162baa958532b0bbc2bc785681f 2080 cf37485dff6595e01e739c8ac9efba31 b985d5f656cc092432d781db95221724 2081 87641c4d3ab8ece01e39bc85b1543661 4775a98ba8fa12d46f9b35e2a55eb72d 2082 7f85181a366663387ddc20551807e007 673bd7e26bf9b29b5ab10a1ca87cbb7a 2083 d97e99eb66959c2a9bc3cbde4707ff77 20b110fa95354674e395812e47a0ae53 2084 b464dcb2d1f345df360dc227270c7506 76f6724eb479f0d2fbb6124429990457 2085 ac6c9167f40aab739998f38b9eccb24f d47c8410131bf65a52af841275d5b3d1 2086 880b197df2b5dea3e6de56ebce3ffb6e 9277a82082f8d9677a6767089b671ebd 2087 244c214f0bde95c2beb02cd1172d58bd f39dce56ff68eb35ab39b49b4eac7c81 2088 5ea60451d6e6ab82119118df02a58684 4a9ffe162ba006d0669ef57668cab38b 2089 62f71a2523a084852cd1d079b3658dc2 f3e87949b550bab3e177cfc49ed190df 2090 f0630e43077c30de8f6ae081537f1e83 da537da980afa668e7b7fb25301cf741 2091 524be3c49884b42821f17552fbd1931a 813017b6b6590a41ea18b6ba49cd48a4 2092 40bd9a3346a7623fb4ba34a3ee571e3c 731f35a7a3cf25b551a680fa68763507 2093 b7fde3aaf023c50b9d22da6876ba337e b5e9dd9ec3daf970242b6c5aab3aa4b2 2094 96ad8b9f6832f686ef70fa938b31b4e5 ddd7364442d3ea72e73d668fb0937796 2095 f462923a81a47e1cee7426ff6d922126 9b5a62ec03d6ec94d12606cb485560ba 2096 b574816009e96504249385bb61a819be 04f62c2066214d8360a2022beb316240 2097 b6c7d78bbe56c13082e0ca272661210a bf020bf3b5783f1426436cf9ff418405 2098 93a5d0638d32fc51c5c65ff291a3a7a5 2fd6775e623a4439cc08dd25582febc9 2099 44ef92d8dbd329c91de3e9c9582e41f1 7f3d186f104ad3f90995116c682a2a14 2100 a3b4b1f547c335f0be710fc9fc03e0e5 87b8cda31ce65b969878a4ad4283e6d5 2101 b0373f43da86e9e0ffe1ae0fddd35162 55bd74566f36a38703d5f34249ded1f6 2102 6b3d9b45b9af2ccfefe984e13376b1b2 c6404aa48c8026132343da3f3a33659e 2103 c1b3e95080540b28b7f3fcd35fa5d843 b579a84c089121a60d8c1754915c344e 2104 eaf45a9bf27dc0c1e784161691220913 13eb0e87555abd706626e557fc36a04f 2105 cd191a58829104d6075c5594f627ca50 6bf181daec940f4a4f3af0074eee89da 2106 acde6758312622d4fa675b39f728e062 d2bee680d8f41a597c262648bb18bcfc 2107 13c8b3d97b1a77b2ac3af745d61a34cc 4709865bac824a94bb19058015e4e42d 2108 aebe13f98ec51170a4aad0a8324bb768 2110 A.3. Server Initial 2112 The server sends the following payload in response, including an ACK 2113 frame, a CRYPTO frame, and no PADDING frames: 2115 0d0000000018410a020000560303eefc e7f7b37ba1d1632e96677825ddf73988 2116 cfc79825df566dc5430b9a045a120013 0100002e00330024001d00209d3c940d 2117 89690b84d08a60993c144eca684d1081 287c834d5311bcf32bb9da1a002b0002 2118 0304 2119 The header from the server includes a new connection ID and a 2-byte 2120 packet number encoding for a packet number of 1: 2122 c1ff0000190008f067a5502a4262b50040740001 2124 As a result, after protection, the header protection sample is taken 2125 starting from the third protected octet: 2127 sample = 7002596f99ae67abf65a5852f54f58c3 2128 mask = 38168a0c25 2129 header = c9ff0000190008f067a5502a4262b5004074168b 2131 The final protected packet is then: 2133 c9ff0000190008f067a5502a4262b500 4074168bf22b7002596f99ae67abf65a 2134 5852f54f58c37c808682e2e40492d8a3 899fb04fc0afe9aabc8767b18a0aa493 2135 537426373b48d502214dd856d63b78ce e37bc664b3fe86d487ac7a77c53038a3 2136 cd32f0b5004d9f5754c4f7f2d1f35cf3 f7116351c92b99c8ae5833225cb51855 2137 20d61e68cf5f 2139 Appendix B. Change Log 2141 *RFC Editor's Note:* Please remove this section prior to 2142 publication of a final version of this document. 2144 Issue and pull request numbers are listed with a leading octothorp. 2146 B.1. Since draft-ietf-quic-tls-24 2148 * Rewrite key updates (#3050) 2150 - Allow but don't recommend deferring key updates (#2792, #3263) 2152 - More completely define received behavior (#2791) 2154 - Define the label used with HKDF-Expand-Label (#3054) 2156 B.2. Since draft-ietf-quic-tls-23 2158 * Key update text update (#3050): 2160 - Recommend constant-time key replacement (#2792) 2162 - Provide explicit labels for key update key derivation (#3054) 2164 * Allow first Initial from a client to span multiple packets (#2928, 2165 #3045) 2167 * PING can be sent at any encryption level (#3034, #3035) 2169 B.3. Since draft-ietf-quic-tls-22 2171 * Update the salt used for Initial secrets (#2887, #2980) 2173 B.4. Since draft-ietf-quic-tls-21 2175 * No changes 2177 B.5. Since draft-ietf-quic-tls-20 2179 * Mandate the use of the QUIC transport parameters extension (#2528, 2180 #2560) 2182 * Define handshake completion and confirmation; define clearer rules 2183 when it encryption keys should be discarded (#2214, #2267, #2673) 2185 B.6. Since draft-ietf-quic-tls-18 2187 * Increased the set of permissible frames in 0-RTT (#2344, #2355) 2189 * Transport parameter extension is mandatory (#2528, #2560) 2191 B.7. Since draft-ietf-quic-tls-17 2193 * Endpoints discard initial keys as soon as handshake keys are 2194 available (#1951, #2045) 2196 * Use of ALPN or equivalent is mandatory (#2263, #2284) 2198 B.8. Since draft-ietf-quic-tls-14 2200 * Update the salt used for Initial secrets (#1970) 2202 * Clarify that TLS_AES_128_CCM_8_SHA256 isn't supported (#2019) 2204 * Change header protection 2206 - Sample from a fixed offset (#1575, #2030) 2208 - Cover part of the first byte, including the key phase (#1322, 2209 #2006) 2211 * TLS provides an AEAD and KDF function (#2046) 2213 - Clarify that the TLS KDF is used with TLS (#1997) 2214 - Change the labels for calculation of QUIC keys (#1845, #1971, 2215 #1991) 2217 * Initial keys are discarded once Handshake keys are available 2218 (#1951, #2045) 2220 B.9. Since draft-ietf-quic-tls-13 2222 * Updated to TLS 1.3 final (#1660) 2224 B.10. Since draft-ietf-quic-tls-12 2226 * Changes to integration of the TLS handshake (#829, #1018, #1094, 2227 #1165, #1190, #1233, #1242, #1252, #1450) 2229 - The cryptographic handshake uses CRYPTO frames, not stream 0 2231 - QUIC packet protection is used in place of TLS record 2232 protection 2234 - Separate QUIC packet number spaces are used for the handshake 2236 - Changed Retry to be independent of the cryptographic handshake 2238 - Limit the use of HelloRetryRequest to address TLS needs (like 2239 key shares) 2241 * Changed codepoint of TLS extension (#1395, #1402) 2243 B.11. Since draft-ietf-quic-tls-11 2245 * Encrypted packet numbers. 2247 B.12. Since draft-ietf-quic-tls-10 2249 * No significant changes. 2251 B.13. Since draft-ietf-quic-tls-09 2253 * Cleaned up key schedule and updated the salt used for handshake 2254 packet protection (#1077) 2256 B.14. Since draft-ietf-quic-tls-08 2258 * Specify value for max_early_data_size to enable 0-RTT (#942) 2260 * Update key derivation function (#1003, #1004) 2262 B.15. Since draft-ietf-quic-tls-07 2264 * Handshake errors can be reported with CONNECTION_CLOSE (#608, 2265 #891) 2267 B.16. Since draft-ietf-quic-tls-05 2269 No significant changes. 2271 B.17. Since draft-ietf-quic-tls-04 2273 * Update labels used in HKDF-Expand-Label to match TLS 1.3 (#642) 2275 B.18. Since draft-ietf-quic-tls-03 2277 No significant changes. 2279 B.19. Since draft-ietf-quic-tls-02 2281 * Updates to match changes in transport draft 2283 B.20. Since draft-ietf-quic-tls-01 2285 * Use TLS alerts to signal TLS errors (#272, #374) 2287 * Require ClientHello to fit in a single packet (#338) 2289 * The second client handshake flight is now sent in the clear (#262, 2290 #337) 2292 * The QUIC header is included as AEAD Associated Data (#226, #243, 2293 #302) 2295 * Add interface necessary for client address validation (#275) 2297 * Define peer authentication (#140) 2299 * Require at least TLS 1.3 (#138) 2301 * Define transport parameters as a TLS extension (#122) 2303 * Define handling for protected packets before the handshake 2304 completes (#39) 2306 * Decouple QUIC version and ALPN (#12) 2308 B.21. Since draft-ietf-quic-tls-00 2309 * Changed bit used to signal key phase 2311 * Updated key phase markings during the handshake 2313 * Added TLS interface requirements section 2315 * Moved to use of TLS exporters for key derivation 2317 * Moved TLS error code definitions into this document 2319 B.22. Since draft-thomson-quic-tls-01 2321 * Adopted as base for draft-ietf-quic-tls 2323 * Updated authors/editors list 2325 * Added status note 2327 Contributors 2329 The IETF QUIC Working Group received an enormous amount of support 2330 from many people. The following people provided substantive 2331 contributions to this document: Adam Langley, Alessandro Ghedini, 2332 Christian Huitema, Christopher Wood, David Schinazi, Dragana 2333 Damjanovic, Eric Rescorla, Ian Swett, Jana Iyengar, 奥 一穂 (Kazuho 2334 Oku), Marten Seemann, Martin Duke, Mike Bishop, Mikkel Fahnøe 2335 Jørgensen, Nick Banks, Nick Harper, Roberto Peon, Rui Paulo, Ryan 2336 Hamilton, and Victor Vasiliev. 2338 Authors' Addresses 2340 Martin Thomson (editor) 2341 Mozilla 2343 Email: mt@lowentropy.net 2345 Sean Turner (editor) 2346 sn3rd 2348 Email: sean@sn3rd.com