idnits 2.17.00 (12 Aug 2021) /tmp/idnits6793/draft-ietf-quic-tls-34.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- == 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 -- The document date (15 January 2021) is 484 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 2437 -- Looks like a reference, but probably isn't: '1' on line 1623 -- Possible downref: Non-RFC (?) normative reference: ref. 'AES' ** Downref: Normative reference to an Informational RFC: RFC 8439 (ref. 'CHACHA') ** Downref: Normative reference to an Informational RFC: RFC 5869 (ref. 'HKDF') == Outdated reference: draft-ietf-quic-recovery has been published as RFC 9002 == Outdated reference: draft-ietf-quic-transport has been published as RFC 9000 -- Possible downref: Non-RFC (?) normative reference: ref. 'SHA' == Outdated reference: draft-ietf-tls-certificate-compression has been published as RFC 8879 == Outdated reference: A later version (-34) exists of draft-ietf-quic-http-33 Summary: 2 errors (**), 0 flaws (~~), 6 warnings (==), 6 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: 19 July 2021 sn3rd 6 15 January 2021 8 Using TLS to Secure QUIC 9 draft-ietf-quic-tls-34 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. 22 Working Group information can be found at https://github.com/quicwg; 23 source code and issues list for this draft can be found at 24 https://github.com/quicwg/base-drafts/labels/-tls. 26 Status of This Memo 28 This Internet-Draft is submitted in full conformance with the 29 provisions of BCP 78 and BCP 79. 31 Internet-Drafts are working documents of the Internet Engineering 32 Task Force (IETF). Note that other groups may also distribute 33 working documents as Internet-Drafts. The list of current Internet- 34 Drafts is at https://datatracker.ietf.org/drafts/current/. 36 Internet-Drafts are draft documents valid for a maximum of six months 37 and may be updated, replaced, or obsoleted by other documents at any 38 time. It is inappropriate to use Internet-Drafts as reference 39 material or to cite them other than as "work in progress." 41 This Internet-Draft will expire on 19 July 2021. 43 Copyright Notice 45 Copyright (c) 2021 IETF Trust and the persons identified as the 46 document authors. All rights reserved. 48 This document is subject to BCP 78 and the IETF Trust's Legal 49 Provisions Relating to IETF Documents (https://trustee.ietf.org/ 50 license-info) in effect on the date of publication of this document. 51 Please review these documents carefully, as they describe your rights 52 and restrictions with respect to this document. Code Components 53 extracted from this document must include Simplified BSD License text 54 as described in Section 4.e of the Trust Legal Provisions and are 55 provided without warranty as described in the Simplified BSD License. 57 Table of Contents 59 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 60 2. Notational Conventions . . . . . . . . . . . . . . . . . . . 4 61 2.1. TLS Overview . . . . . . . . . . . . . . . . . . . . . . 5 62 3. Protocol Overview . . . . . . . . . . . . . . . . . . . . . . 7 63 4. Carrying TLS Messages . . . . . . . . . . . . . . . . . . . . 8 64 4.1. Interface to TLS . . . . . . . . . . . . . . . . . . . . 9 65 4.1.1. Handshake Complete . . . . . . . . . . . . . . . . . 10 66 4.1.2. Handshake Confirmed . . . . . . . . . . . . . . . . . 10 67 4.1.3. Sending and Receiving Handshake Messages . . . . . . 10 68 4.1.4. Encryption Level Changes . . . . . . . . . . . . . . 12 69 4.1.5. TLS Interface Summary . . . . . . . . . . . . . . . . 14 70 4.2. TLS Version . . . . . . . . . . . . . . . . . . . . . . . 15 71 4.3. ClientHello Size . . . . . . . . . . . . . . . . . . . . 15 72 4.4. Peer Authentication . . . . . . . . . . . . . . . . . . . 16 73 4.5. Session Resumption . . . . . . . . . . . . . . . . . . . 17 74 4.6. 0-RTT . . . . . . . . . . . . . . . . . . . . . . . . . . 18 75 4.6.1. Enabling 0-RTT . . . . . . . . . . . . . . . . . . . 18 76 4.6.2. Accepting and Rejecting 0-RTT . . . . . . . . . . . . 19 77 4.6.3. Validating 0-RTT Configuration . . . . . . . . . . . 19 78 4.7. HelloRetryRequest . . . . . . . . . . . . . . . . . . . . 20 79 4.8. TLS Errors . . . . . . . . . . . . . . . . . . . . . . . 20 80 4.9. Discarding Unused Keys . . . . . . . . . . . . . . . . . 20 81 4.9.1. Discarding Initial Keys . . . . . . . . . . . . . . . 21 82 4.9.2. Discarding Handshake Keys . . . . . . . . . . . . . . 21 83 4.9.3. Discarding 0-RTT Keys . . . . . . . . . . . . . . . . 22 84 5. Packet Protection . . . . . . . . . . . . . . . . . . . . . . 22 85 5.1. Packet Protection Keys . . . . . . . . . . . . . . . . . 23 86 5.2. Initial Secrets . . . . . . . . . . . . . . . . . . . . . 23 87 5.3. AEAD Usage . . . . . . . . . . . . . . . . . . . . . . . 25 88 5.4. Header Protection . . . . . . . . . . . . . . . . . . . . 26 89 5.4.1. Header Protection Application . . . . . . . . . . . . 26 90 5.4.2. Header Protection Sample . . . . . . . . . . . . . . 28 91 5.4.3. AES-Based Header Protection . . . . . . . . . . . . . 30 92 5.4.4. ChaCha20-Based Header Protection . . . . . . . . . . 30 93 5.5. Receiving Protected Packets . . . . . . . . . . . . . . . 31 94 5.6. Use of 0-RTT Keys . . . . . . . . . . . . . . . . . . . . 31 95 5.7. Receiving Out-of-Order Protected Packets . . . . . . . . 32 96 5.8. Retry Packet Integrity . . . . . . . . . . . . . . . . . 33 97 6. Key Update . . . . . . . . . . . . . . . . . . . . . . . . . 34 98 6.1. Initiating a Key Update . . . . . . . . . . . . . . . . . 36 99 6.2. Responding to a Key Update . . . . . . . . . . . . . . . 37 100 6.3. Timing of Receive Key Generation . . . . . . . . . . . . 37 101 6.4. Sending with Updated Keys . . . . . . . . . . . . . . . . 38 102 6.5. Receiving with Different Keys . . . . . . . . . . . . . . 38 103 6.6. Limits on AEAD Usage . . . . . . . . . . . . . . . . . . 39 104 6.7. Key Update Error Code . . . . . . . . . . . . . . . . . . 41 105 7. Security of Initial Messages . . . . . . . . . . . . . . . . 41 106 8. QUIC-Specific Adjustments to the TLS Handshake . . . . . . . 41 107 8.1. Protocol Negotiation . . . . . . . . . . . . . . . . . . 42 108 8.2. QUIC Transport Parameters Extension . . . . . . . . . . . 42 109 8.3. Removing the EndOfEarlyData Message . . . . . . . . . . . 43 110 8.4. Prohibit TLS Middlebox Compatibility Mode . . . . . . . . 43 111 9. Security Considerations . . . . . . . . . . . . . . . . . . . 44 112 9.1. Session Linkability . . . . . . . . . . . . . . . . . . . 44 113 9.2. Replay Attacks with 0-RTT . . . . . . . . . . . . . . . . 44 114 9.3. Packet Reflection Attack Mitigation . . . . . . . . . . . 45 115 9.4. Header Protection Analysis . . . . . . . . . . . . . . . 45 116 9.5. Header Protection Timing Side-Channels . . . . . . . . . 46 117 9.6. Key Diversity . . . . . . . . . . . . . . . . . . . . . . 47 118 9.7. Randomness . . . . . . . . . . . . . . . . . . . . . . . 47 119 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 47 120 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 48 121 11.1. Normative References . . . . . . . . . . . . . . . . . . 48 122 11.2. Informative References . . . . . . . . . . . . . . . . . 49 123 Appendix A. Sample Packet Protection . . . . . . . . . . . . . . 51 124 A.1. Keys . . . . . . . . . . . . . . . . . . . . . . . . . . 51 125 A.2. Client Initial . . . . . . . . . . . . . . . . . . . . . 52 126 A.3. Server Initial . . . . . . . . . . . . . . . . . . . . . 54 127 A.4. Retry . . . . . . . . . . . . . . . . . . . . . . . . . . 55 128 A.5. ChaCha20-Poly1305 Short Header Packet . . . . . . . . . . 55 129 Appendix B. AEAD Algorithm Analysis . . . . . . . . . . . . . . 57 130 B.1. Analysis of AEAD_AES_128_GCM and AEAD_AES_256_GCM Usage 131 Limits . . . . . . . . . . . . . . . . . . . . . . . . . 58 132 B.1.1. Confidentiality Limit . . . . . . . . . . . . . . . . 58 133 B.1.2. Integrity Limit . . . . . . . . . . . . . . . . . . . 58 134 B.2. Analysis of AEAD_AES_128_CCM Usage Limits . . . . . . . . 59 135 Appendix C. Change Log . . . . . . . . . . . . . . . . . . . . . 60 136 C.1. Since draft-ietf-quic-tls-32 . . . . . . . . . . . . . . 60 137 C.2. Since draft-ietf-quic-tls-31 . . . . . . . . . . . . . . 60 138 C.3. Since draft-ietf-quic-tls-30 . . . . . . . . . . . . . . 60 139 C.4. Since draft-ietf-quic-tls-29 . . . . . . . . . . . . . . 60 140 C.5. Since draft-ietf-quic-tls-28 . . . . . . . . . . . . . . 61 141 C.6. Since draft-ietf-quic-tls-27 . . . . . . . . . . . . . . 61 142 C.7. Since draft-ietf-quic-tls-26 . . . . . . . . . . . . . . 61 143 C.8. Since draft-ietf-quic-tls-25 . . . . . . . . . . . . . . 61 144 C.9. Since draft-ietf-quic-tls-24 . . . . . . . . . . . . . . 61 145 C.10. Since draft-ietf-quic-tls-23 . . . . . . . . . . . . . . 61 146 C.11. Since draft-ietf-quic-tls-22 . . . . . . . . . . . . . . 62 147 C.12. Since draft-ietf-quic-tls-21 . . . . . . . . . . . . . . 62 148 C.13. Since draft-ietf-quic-tls-20 . . . . . . . . . . . . . . 62 149 C.14. Since draft-ietf-quic-tls-18 . . . . . . . . . . . . . . 62 150 C.15. Since draft-ietf-quic-tls-17 . . . . . . . . . . . . . . 62 151 C.16. Since draft-ietf-quic-tls-14 . . . . . . . . . . . . . . 62 152 C.17. Since draft-ietf-quic-tls-13 . . . . . . . . . . . . . . 63 153 C.18. Since draft-ietf-quic-tls-12 . . . . . . . . . . . . . . 63 154 C.19. Since draft-ietf-quic-tls-11 . . . . . . . . . . . . . . 63 155 C.20. Since draft-ietf-quic-tls-10 . . . . . . . . . . . . . . 63 156 C.21. Since draft-ietf-quic-tls-09 . . . . . . . . . . . . . . 63 157 C.22. Since draft-ietf-quic-tls-08 . . . . . . . . . . . . . . 63 158 C.23. Since draft-ietf-quic-tls-07 . . . . . . . . . . . . . . 63 159 C.24. Since draft-ietf-quic-tls-05 . . . . . . . . . . . . . . 64 160 C.25. Since draft-ietf-quic-tls-04 . . . . . . . . . . . . . . 64 161 C.26. Since draft-ietf-quic-tls-03 . . . . . . . . . . . . . . 64 162 C.27. Since draft-ietf-quic-tls-02 . . . . . . . . . . . . . . 64 163 C.28. Since draft-ietf-quic-tls-01 . . . . . . . . . . . . . . 64 164 C.29. Since draft-ietf-quic-tls-00 . . . . . . . . . . . . . . 64 165 C.30. Since draft-thomson-quic-tls-01 . . . . . . . . . . . . . 65 166 Contributors . . . . . . . . . . . . . . . . . . . . . . . . . . 65 167 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 66 169 1. Introduction 171 This document describes how QUIC [QUIC-TRANSPORT] is secured using 172 TLS [TLS13]. 174 TLS 1.3 provides critical latency improvements for connection 175 establishment over previous versions. Absent packet loss, most new 176 connections can be established and secured within a single round 177 trip; on subsequent connections between the same client and server, 178 the client can often send application data immediately, that is, 179 using a zero round trip setup. 181 This document describes how TLS acts as a security component of QUIC. 183 2. Notational Conventions 185 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 186 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 187 "OPTIONAL" in this document are to be interpreted as described in 188 BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all 189 capitals, as shown here. 191 This document uses the terminology established in [QUIC-TRANSPORT]. 193 For brevity, the acronym TLS is used to refer to TLS 1.3, though a 194 newer version could be used; see Section 4.2. 196 2.1. TLS Overview 198 TLS provides two endpoints with a way to establish a means of 199 communication over an untrusted medium (for example, the Internet). 200 TLS enables authentication of peers and provides confidentiality and 201 integrity protection for messages that endpoints exchange. 203 Internally, TLS is a layered protocol, with the structure shown in 204 Figure 1. 206 +-------------+------------+--------------+---------+ 207 Content | | | Application | | 208 Layer | Handshake | Alerts | Data | ... | 209 | | | | | 210 +-------------+------------+--------------+---------+ 211 Record | | 212 Layer | Records | 213 | | 214 +---------------------------------------------------+ 216 Figure 1: TLS Layers 218 Each Content layer message (e.g., Handshake, Alerts, and Application 219 Data) is carried as a series of typed TLS records by the Record 220 layer. Records are individually cryptographically protected and then 221 transmitted over a reliable transport (typically TCP), which provides 222 sequencing and guaranteed delivery. 224 The TLS authenticated key exchange occurs between two endpoints: 225 client and server. The client initiates the exchange and the server 226 responds. If the key exchange completes successfully, both client 227 and server will agree on a secret. TLS supports both pre-shared key 228 (PSK) and Diffie-Hellman over either finite fields or elliptic curves 229 ((EC)DHE) key exchanges. PSK is the basis for Early Data (0-RTT); 230 the latter provides forward secrecy (FS) when the (EC)DHE keys are 231 destroyed. The two modes can also be combined, to provide forward 232 secrecy while using the PSK for authentication. 234 After completing the TLS handshake, the client will have learned and 235 authenticated an identity for the server and the server is optionally 236 able to learn and authenticate an identity for the client. TLS 237 supports X.509 [RFC5280] certificate-based authentication for both 238 server and client. When PSK key exchange is used (as in resumption), 239 knowledge of the PSK serves to authenticate the peer. 241 The TLS key exchange is resistant to tampering by attackers and it 242 produces shared secrets that cannot be controlled by either 243 participating peer. 245 TLS provides two basic handshake modes of interest to QUIC: 247 * A full 1-RTT handshake, in which the client is able to send 248 Application Data after one round trip and the server immediately 249 responds after receiving the first handshake message from the 250 client. 252 * A 0-RTT handshake, in which the client uses information it has 253 previously learned about the server to send Application Data 254 immediately. This Application Data can be replayed by an attacker 255 so 0-RTT is not suitable for carrying instructions that might 256 initiate any action that could cause unwanted effects if replayed. 258 A simplified TLS handshake with 0-RTT application data is shown in 259 Figure 2. 261 Client Server 263 ClientHello 264 (0-RTT Application Data) --------> 265 ServerHello 266 {EncryptedExtensions} 267 {Finished} 268 <-------- [Application Data] 269 {Finished} --------> 271 [Application Data] <-------> [Application Data] 273 () Indicates messages protected by Early Data (0-RTT) Keys 274 {} Indicates messages protected using Handshake Keys 275 [] Indicates messages protected using Application Data 276 (1-RTT) Keys 278 Figure 2: TLS Handshake with 0-RTT 280 Figure 2 omits the EndOfEarlyData message, which is not used in QUIC; 281 see Section 8.3. Likewise, neither ChangeCipherSpec nor KeyUpdate 282 messages are used by QUIC. ChangeCipherSpec is redundant in TLS 1.3; 283 see Section 8.4. QUIC has its own key update mechanism; see 284 Section 6. 286 Data is protected using a number of encryption levels: 288 * Initial Keys 289 * Early Data (0-RTT) Keys 291 * Handshake Keys 293 * Application Data (1-RTT) Keys 295 Application Data may appear only in the Early Data and Application 296 Data levels. Handshake and Alert messages may appear in any level. 298 The 0-RTT handshake can be used if the client and server have 299 previously communicated. In the 1-RTT handshake, the client is 300 unable to send protected Application Data until it has received all 301 of the Handshake messages sent by the server. 303 3. Protocol Overview 305 QUIC [QUIC-TRANSPORT] assumes responsibility for the confidentiality 306 and integrity protection of packets. For this it uses keys derived 307 from a TLS handshake [TLS13], but instead of carrying TLS records 308 over QUIC (as with TCP), TLS Handshake and Alert messages are carried 309 directly over the QUIC transport, which takes over the 310 responsibilities of the TLS record layer, as shown in Figure 3. 312 +--------------+--------------+ +-------------+ 313 | TLS | TLS | | QUIC | 314 | Handshake | Alerts | | Applications| 315 | | | | (h3, etc.) | 316 +--------------+--------------+-+-------------+ 317 | | 318 | QUIC Transport | 319 | (streams, reliability, congestion, etc.) | 320 | | 321 +---------------------------------------------+ 322 | | 323 | QUIC Packet Protection | 324 | | 325 +---------------------------------------------+ 327 Figure 3: QUIC Layers 329 QUIC also relies on TLS for authentication and negotiation of 330 parameters that are critical to security and performance. 332 Rather than a strict layering, these two protocols cooperate: QUIC 333 uses the TLS handshake; TLS uses the reliability, ordered delivery, 334 and record layer provided by QUIC. 336 At a high level, there are two main interactions between the TLS and 337 QUIC components: 339 * The TLS component sends and receives messages via the QUIC 340 component, with QUIC providing a reliable stream abstraction to 341 TLS. 343 * The TLS component provides a series of updates to the QUIC 344 component, including (a) new packet protection keys to install (b) 345 state changes such as handshake completion, the server 346 certificate, etc. 348 Figure 4 shows these interactions in more detail, with the QUIC 349 packet protection being called out specially. 351 +------------+ +------------+ 352 | |<---- Handshake Messages ----->| | 353 | |<- Validate 0-RTT parameters ->| | 354 | |<--------- 0-RTT Keys ---------| | 355 | QUIC |<------- Handshake Keys -------| TLS | 356 | |<--------- 1-RTT Keys ---------| | 357 | |<------- Handshake Done -------| | 358 +------------+ +------------+ 359 | ^ 360 | Protect | Protected 361 v | Packet 362 +------------+ 363 | QUIC | 364 | Packet | 365 | Protection | 366 +------------+ 368 Figure 4: QUIC and TLS Interactions 370 Unlike TLS over TCP, QUIC applications that want to send data do not 371 send it through TLS "application_data" records. Rather, they send it 372 as QUIC STREAM frames or other frame types, which are then carried in 373 QUIC packets. 375 4. Carrying TLS Messages 377 QUIC carries TLS handshake data in CRYPTO frames, each of which 378 consists of a contiguous block of handshake data identified by an 379 offset and length. Those frames are packaged into QUIC packets and 380 encrypted under the current encryption level. As with TLS over TCP, 381 once TLS handshake data has been delivered to QUIC, it is QUIC's 382 responsibility to deliver it reliably. Each chunk of data that is 383 produced by TLS is associated with the set of keys that TLS is 384 currently using. If QUIC needs to retransmit that data, it MUST use 385 the same keys even if TLS has already updated to newer keys. 387 Each encryption level corresponds to a packet number space. The 388 packet number space that is used determines the semantics of frames. 389 Some frames are prohibited in different packet number spaces; see 390 Section 12.5 of [QUIC-TRANSPORT]. 392 Because packets could be reordered on the wire, QUIC uses the packet 393 type to indicate which keys were used to protect a given packet, as 394 shown in Table 1. When packets of different types need to be sent, 395 endpoints SHOULD use coalesced packets to send them in the same UDP 396 datagram. 398 +=====================+=================+==================+ 399 | Packet Type | Encryption Keys | PN Space | 400 +=====================+=================+==================+ 401 | Initial | Initial secrets | Initial | 402 +---------------------+-----------------+------------------+ 403 | 0-RTT Protected | 0-RTT | Application data | 404 +---------------------+-----------------+------------------+ 405 | Handshake | Handshake | Handshake | 406 +---------------------+-----------------+------------------+ 407 | Retry | Retry | N/A | 408 +---------------------+-----------------+------------------+ 409 | Version Negotiation | N/A | N/A | 410 +---------------------+-----------------+------------------+ 411 | Short Header | 1-RTT | Application data | 412 +---------------------+-----------------+------------------+ 414 Table 1: Encryption Keys by Packet Type 416 Section 17 of [QUIC-TRANSPORT] shows how packets at the various 417 encryption levels fit into the handshake process. 419 4.1. Interface to TLS 421 As shown in Figure 4, the interface from QUIC to TLS consists of four 422 primary functions: 424 * Sending and receiving handshake messages 426 * Processing stored transport and application state from a resumed 427 session and determining if it is valid to generate or accept early 428 data 430 * Rekeying (both transmit and receive) 431 * Handshake state updates 433 Additional functions might be needed to configure TLS. In 434 particular, QUIC and TLS need to agree on which is responsible for 435 validation of peer credentials, such as certificate validation 436 ([RFC5280]). 438 4.1.1. Handshake Complete 440 In this document, the TLS handshake is considered complete when the 441 TLS stack has reported that the handshake is complete. This happens 442 when the TLS stack has both sent a Finished message and verified the 443 peer's Finished message. Verifying the peer's Finished provides the 444 endpoints with an assurance that previous handshake messages have not 445 been modified. Note that the handshake does not complete at both 446 endpoints simultaneously. Consequently, any requirement that is 447 based on the completion of the handshake depends on the perspective 448 of the endpoint in question. 450 4.1.2. Handshake Confirmed 452 In this document, the TLS handshake is considered confirmed at the 453 server when the handshake completes. The server MUST send a 454 HANDSHAKE_DONE frame as soon as the handshake is complete. At the 455 client, the handshake is considered confirmed when a HANDSHAKE_DONE 456 frame is received. 458 Additionally, a client MAY consider the handshake to be confirmed 459 when it receives an acknowledgment for a 1-RTT packet. This can be 460 implemented by recording the lowest packet number sent with 1-RTT 461 keys, and comparing it to the Largest Acknowledged field in any 462 received 1-RTT ACK frame: once the latter is greater than or equal to 463 the former, the handshake is confirmed. 465 4.1.3. Sending and Receiving Handshake Messages 467 In order to drive the handshake, TLS depends on being able to send 468 and receive handshake messages. There are two basic functions on 469 this interface: one where QUIC requests handshake messages and one 470 where QUIC provides bytes that comprise handshake messages. 472 Before starting the handshake QUIC provides TLS with the transport 473 parameters (see Section 8.2) that it wishes to carry. 475 A QUIC client starts TLS by requesting TLS handshake bytes from TLS. 476 The client acquires handshake bytes before sending its first packet. 477 A QUIC server starts the process by providing TLS with the client's 478 handshake bytes. 480 At any time, the TLS stack at an endpoint will have a current sending 481 encryption level and receiving encryption level. TLS encryption 482 levels determine the QUIC packet type and keys that are used for 483 protecting data. 485 Each encryption level is associated with a different sequence of 486 bytes, which is reliably transmitted to the peer in CRYPTO frames. 487 When TLS provides handshake bytes to be sent, they are appended to 488 the handshake bytes for the current encryption level. The encryption 489 level then determines the type of packet that the resulting CRYPTO 490 frame is carried in; see Table 1. 492 Four encryption levels are used, producing keys for Initial, 0-RTT, 493 Handshake, and 1-RTT packets. CRYPTO frames are carried in just 494 three of these levels, omitting the 0-RTT level. These four levels 495 correspond to three packet number spaces: Initial and Handshake 496 encrypted packets use their own separate spaces; 0-RTT and 1-RTT 497 packets use the application data packet number space. 499 QUIC takes the unprotected content of TLS handshake records as the 500 content of CRYPTO frames. TLS record protection is not used by QUIC. 501 QUIC assembles CRYPTO frames into QUIC packets, which are protected 502 using QUIC packet protection. 504 QUIC CRYPTO frames only carry TLS handshake messages. TLS alerts are 505 turned into QUIC CONNECTION_CLOSE error codes; see Section 4.8. TLS 506 application data and other content types cannot be carried by QUIC at 507 any encryption level; it is an error if they are received from the 508 TLS stack. 510 When an endpoint receives a QUIC packet containing a CRYPTO frame 511 from the network, it proceeds as follows: 513 * If the packet uses the current TLS receiving encryption level, 514 sequence the data into the input flow as usual. As with STREAM 515 frames, the offset is used to find the proper location in the data 516 sequence. If the result of this process is that new data is 517 available, then it is delivered to TLS in order. 519 * If the packet is from a previously installed encryption level, it 520 MUST NOT contain data that extends past the end of previously 521 received data in that flow. Implementations MUST treat any 522 violations of this requirement as a connection error of type 523 PROTOCOL_VIOLATION. 525 * If the packet is from a new encryption level, it is saved for 526 later processing by TLS. Once TLS moves to receiving from this 527 encryption level, saved data can be provided to TLS. When TLS 528 provides keys for a higher encryption level, if there is data from 529 a previous encryption level that TLS has not consumed, this MUST 530 be treated as a connection error of type PROTOCOL_VIOLATION. 532 Each time that TLS is provided with new data, new handshake bytes are 533 requested from TLS. TLS might not provide any bytes if the handshake 534 messages it has received are incomplete or it has no data to send. 536 The content of CRYPTO frames might either be processed incrementally 537 by TLS or buffered until complete messages or flights are available. 538 TLS is responsible for buffering handshake bytes that have arrived in 539 order. QUIC is responsible for buffering handshake bytes that arrive 540 out of order or for encryption levels that are not yet ready. QUIC 541 does not provide any means of flow control for CRYPTO frames; see 542 Section 7.5 of [QUIC-TRANSPORT]. 544 Once the TLS handshake is complete, this is indicated to QUIC along 545 with any final handshake bytes that TLS needs to send. At this 546 stage, the transport parameters that the peer advertised during the 547 handshake are authenticated; see Section 8.2. 549 Once the handshake is complete, TLS becomes passive. TLS can still 550 receive data from its peer and respond in kind, but it will not need 551 to send more data unless specifically requested - either by an 552 application or QUIC. One reason to send data is that the server 553 might wish to provide additional or updated session tickets to a 554 client. 556 When the handshake is complete, QUIC only needs to provide TLS with 557 any data that arrives in CRYPTO streams. In the same manner that is 558 used during the handshake, new data is requested from TLS after 559 providing received data. 561 4.1.4. Encryption Level Changes 563 As keys at a given encryption level become available to TLS, TLS 564 indicates to QUIC that reading or writing keys at that encryption 565 level are available. 567 The availability of new keys is always a result of providing inputs 568 to TLS. TLS only provides new keys after being initialized (by a 569 client) or when provided with new handshake data. 571 However, a TLS implementation could perform some of its processing 572 asynchronously. In particular, the process of validating a 573 certificate can take some time. While waiting for TLS processing to 574 complete, an endpoint SHOULD buffer received packets if they might be 575 processed using keys that aren't yet available. These packets can be 576 processed once keys are provided by TLS. An endpoint SHOULD continue 577 to respond to packets that can be processed during this time. 579 After processing inputs, TLS might produce handshake bytes, keys for 580 new encryption levels, or both. 582 TLS provides QUIC with three items as a new encryption level becomes 583 available: 585 * A secret 587 * An Authenticated Encryption with Associated Data (AEAD) function 589 * A Key Derivation Function (KDF) 591 These values are based on the values that TLS negotiates and are used 592 by QUIC to generate packet and header protection keys; see Section 5 593 and Section 5.4. 595 If 0-RTT is possible, it is ready after the client sends a TLS 596 ClientHello message or the server receives that message. After 597 providing a QUIC client with the first handshake bytes, the TLS stack 598 might signal the change to 0-RTT keys. On the server, after 599 receiving handshake bytes that contain a ClientHello message, a TLS 600 server might signal that 0-RTT keys are available. 602 Although TLS only uses one encryption level at a time, QUIC may use 603 more than one level. For instance, after sending its Finished 604 message (using a CRYPTO frame at the Handshake encryption level) an 605 endpoint can send STREAM data (in 1-RTT encryption). If the Finished 606 message is lost, the endpoint uses the Handshake encryption level to 607 retransmit the lost message. Reordering or loss of packets can mean 608 that QUIC will need to handle packets at multiple encryption levels. 609 During the handshake, this means potentially handling packets at 610 higher and lower encryption levels than the current encryption level 611 used by TLS. 613 In particular, server implementations need to be able to read packets 614 at the Handshake encryption level at the same time as the 0-RTT 615 encryption level. A client could interleave ACK frames that are 616 protected with Handshake keys with 0-RTT data and the server needs to 617 process those acknowledgments in order to detect lost Handshake 618 packets. 620 QUIC also needs access to keys that might not ordinarily be available 621 to a TLS implementation. For instance, a client might need to 622 acknowledge Handshake packets before it is ready to send CRYPTO 623 frames at that encryption level. TLS therefore needs to provide keys 624 to QUIC before it might produce them for its own use. 626 4.1.5. TLS Interface Summary 628 Figure 5 summarizes the exchange between QUIC and TLS for both client 629 and server. Solid arrows indicate packets that carry handshake data; 630 dashed arrows show where application data can be sent. Each arrow is 631 tagged with the encryption level used for that transmission. 633 Client Server 634 ====== ====== 636 Get Handshake 637 Initial -------------> 638 Install tx 0-RTT Keys 639 0-RTT - - - - - - - -> 641 Handshake Received 642 Get Handshake 643 <------------- Initial 644 Install rx 0-RTT keys 645 Install Handshake keys 646 Get Handshake 647 <----------- Handshake 648 Install tx 1-RTT keys 649 <- - - - - - - - 1-RTT 651 Handshake Received (Initial) 652 Install Handshake keys 653 Handshake Received (Handshake) 654 Get Handshake 655 Handshake -----------> 656 Handshake Complete 657 Install 1-RTT keys 658 1-RTT - - - - - - - -> 660 Handshake Received 661 Handshake Complete 662 Handshake Confirmed 663 Install rx 1-RTT keys 664 <--------------- 1-RTT 665 (HANDSHAKE_DONE) 666 Handshake Confirmed 667 Figure 5: Interaction Summary between QUIC and TLS 669 Figure 5 shows the multiple packets that form a single "flight" of 670 messages being processed individually, to show what incoming messages 671 trigger different actions. This shows multiple "Get Handshake" 672 invocations to retrieve handshake messages at different encryption 673 levels. New handshake messages are requested after incoming packets 674 have been processed. 676 Figure 5 shows one possible structure for a simple handshake 677 exchange. The exact process varies based on the structure of 678 endpoint implementations and the order in which packets arrive. 679 Implementations could use a different number of operations or execute 680 them in other orders. 682 4.2. TLS Version 684 This document describes how TLS 1.3 [TLS13] is used with QUIC. 686 In practice, the TLS handshake will negotiate a version of TLS to 687 use. This could result in a newer version of TLS than 1.3 being 688 negotiated if both endpoints support that version. This is 689 acceptable provided that the features of TLS 1.3 that are used by 690 QUIC are supported by the newer version. 692 Clients MUST NOT offer TLS versions older than 1.3. A badly 693 configured TLS implementation could negotiate TLS 1.2 or another 694 older version of TLS. An endpoint MUST terminate the connection if a 695 version of TLS older than 1.3 is negotiated. 697 4.3. ClientHello Size 699 The first Initial packet from a client contains the start or all of 700 its first cryptographic handshake message, which for TLS is the 701 ClientHello. Servers might need to parse the entire ClientHello 702 (e.g., to access extensions such as Server Name Identification (SNI) 703 or Application Layer Protocol Negotiation (ALPN)) in order to decide 704 whether to accept the new incoming QUIC connection. If the 705 ClientHello spans multiple Initial packets, such servers would need 706 to buffer the first received fragments, which could consume excessive 707 resources if the client's address has not yet been validated. To 708 avoid this, servers MAY use the Retry feature (see Section 8.1 of 709 [QUIC-TRANSPORT]) to only buffer partial ClientHello messages from 710 clients with a validated address. 712 QUIC packet and framing add at least 36 bytes of overhead to the 713 ClientHello message. That overhead increases if the client chooses a 714 source connection ID longer than zero bytes. Overheads also do not 715 include the token or a destination connection ID longer than 8 bytes, 716 both of which might be required if a server sends a Retry packet. 718 A typical TLS ClientHello can easily fit into a 1200-byte packet. 719 However, in addition to the overheads added by QUIC, there are 720 several variables that could cause this limit to be exceeded. Large 721 session tickets, multiple or large key shares, and long lists of 722 supported ciphers, signature algorithms, versions, QUIC transport 723 parameters, and other negotiable parameters and extensions could 724 cause this message to grow. 726 For servers, in addition to connection IDs and tokens, the size of 727 TLS session tickets can have an effect on a client's ability to 728 connect efficiently. Minimizing the size of these values increases 729 the probability that clients can use them and still fit their entire 730 ClientHello message in their first Initial packet. 732 The TLS implementation does not need to ensure that the ClientHello 733 is large enough to meet the requirements for QUIC packets. QUIC 734 PADDING frames are added to increase the size of the packet as 735 necessary; see Section 14.1 of [QUIC-TRANSPORT]. 737 4.4. Peer Authentication 739 The requirements for authentication depend on the application 740 protocol that is in use. TLS provides server authentication and 741 permits the server to request client authentication. 743 A client MUST authenticate the identity of the server. This 744 typically involves verification that the identity of the server is 745 included in a certificate and that the certificate is issued by a 746 trusted entity (see for example [RFC2818]). 748 Note: Where servers provide certificates for authentication, the 749 size of the certificate chain can consume a large number of bytes. 750 Controlling the size of certificate chains is critical to 751 performance in QUIC as servers are limited to sending 3 bytes for 752 every byte received prior to validating the client address; see 753 Section 8.1 of [QUIC-TRANSPORT]. The size of a certificate chain 754 can be managed by limiting the number of names or extensions; 755 using keys with small public key representations, like ECDSA; or 756 by using certificate compression [COMPRESS]. 758 A server MAY request that the client authenticate during the 759 handshake. A server MAY refuse a connection if the client is unable 760 to authenticate when requested. The requirements for client 761 authentication vary based on application protocol and deployment. 763 A server MUST NOT use post-handshake client authentication (as 764 defined in Section 4.6.2 of [TLS13]), because the multiplexing 765 offered by QUIC prevents clients from correlating the certificate 766 request with the application-level event that triggered it (see 767 [HTTP2-TLS13]). More specifically, servers MUST NOT send post- 768 handshake TLS CertificateRequest messages and clients MUST treat 769 receipt of such messages as a connection error of type 770 PROTOCOL_VIOLATION. 772 4.5. Session Resumption 774 QUIC can use the session resumption feature of TLS 1.3. It does this 775 by carrying NewSessionTicket messages in CRYPTO frames after the 776 handshake is complete. Session resumption can be used to provide 777 0-RTT, and can also be used when 0-RTT is disabled. 779 Endpoints that use session resumption might need to remember some 780 information about the current connection when creating a resumed 781 connection. TLS requires that some information be retained; see 782 Section 4.6.1 of [TLS13]. QUIC itself does not depend on any state 783 being retained when resuming a connection, unless 0-RTT is also used; 784 see Section 7.4.1 of [QUIC-TRANSPORT] and Section 4.6.1. Application 785 protocols could depend on state that is retained between resumed 786 connections. 788 Clients can store any state required for resumption along with the 789 session ticket. Servers can use the session ticket to help carry 790 state. 792 Session resumption allows servers to link activity on the original 793 connection with the resumed connection, which might be a privacy 794 issue for clients. Clients can choose not to enable resumption to 795 avoid creating this correlation. Clients SHOULD NOT reuse tickets as 796 that allows entities other than the server to correlate connections; 797 see Section C.4 of [TLS13]. 799 4.6. 0-RTT 801 The 0-RTT feature in QUIC allows a client to send application data 802 before the handshake is complete. This is made possible by reusing 803 negotiated parameters from a previous connection. To enable this, 804 0-RTT depends on the client remembering critical parameters and 805 providing the server with a TLS session ticket that allows the server 806 to recover the same information. 808 This information includes parameters that determine TLS state, as 809 governed by [TLS13], QUIC transport parameters, the chosen 810 application protocol, and any information the application protocol 811 might need; see Section 4.6.3. This information determines how 0-RTT 812 packets and their contents are formed. 814 To ensure that the same information is available to both endpoints, 815 all information used to establish 0-RTT comes from the same 816 connection. Endpoints cannot selectively disregard information that 817 might alter the sending or processing of 0-RTT. 819 [TLS13] sets a limit of 7 days on the time between the original 820 connection and any attempt to use 0-RTT. There are other constraints 821 on 0-RTT usage, notably those caused by the potential exposure to 822 replay attack; see Section 9.2. 824 4.6.1. Enabling 0-RTT 826 The TLS "early_data" extension in the NewSessionTicket message is 827 defined to convey (in the "max_early_data_size" parameter) the amount 828 of TLS 0-RTT data the server is willing to accept. QUIC does not use 829 TLS 0-RTT data. QUIC uses 0-RTT packets to carry early data. 830 Accordingly, the "max_early_data_size" parameter is repurposed to 831 hold a sentinel value 0xffffffff to indicate that the server is 832 willing to accept QUIC 0-RTT data; to indicate that the server does 833 not accept 0-RTT data, the "early_data" extension is omitted from the 834 NewSessionTicket. The amount of data that the client can send in 835 QUIC 0-RTT is controlled by the initial_max_data transport parameter 836 supplied by the server. 838 Servers MUST NOT send the early_data extension with a 839 max_early_data_size field set to any value other than 0xffffffff. A 840 client MUST treat receipt of a NewSessionTicket that contains an 841 early_data extension with any other value as a connection error of 842 type PROTOCOL_VIOLATION. 844 A client that wishes to send 0-RTT packets uses the early_data 845 extension in the ClientHello message of a subsequent handshake; see 846 Section 4.2.10 of [TLS13]. It then sends application data in 0-RTT 847 packets. 849 A client that attempts 0-RTT might also provide an address validation 850 token if the server has sent a NEW_TOKEN frame; see Section 8.1 of 851 [QUIC-TRANSPORT]. 853 4.6.2. Accepting and Rejecting 0-RTT 855 A server accepts 0-RTT by sending an early_data extension in the 856 EncryptedExtensions; see Section 4.2.10 of [TLS13]. The server then 857 processes and acknowledges the 0-RTT packets that it receives. 859 A server rejects 0-RTT by sending the EncryptedExtensions without an 860 early_data extension. A server will always reject 0-RTT if it sends 861 a TLS HelloRetryRequest. When rejecting 0-RTT, a server MUST NOT 862 process any 0-RTT packets, even if it could. When 0-RTT was 863 rejected, a client SHOULD treat receipt of an acknowledgment for a 864 0-RTT packet as a connection error of type PROTOCOL_VIOLATION, if it 865 is able to detect the condition. 867 When 0-RTT is rejected, all connection characteristics that the 868 client assumed might be incorrect. This includes the choice of 869 application protocol, transport parameters, and any application 870 configuration. The client therefore MUST reset the state of all 871 streams, including application state bound to those streams. 873 A client MAY reattempt 0-RTT if it receives a Retry or Version 874 Negotiation packet. These packets do not signify rejection of 0-RTT. 876 4.6.3. Validating 0-RTT Configuration 878 When a server receives a ClientHello with the early_data extension, 879 it has to decide whether to accept or reject early data from the 880 client. Some of this decision is made by the TLS stack (e.g., 881 checking that the cipher suite being resumed was included in the 882 ClientHello; see Section 4.2.10 of [TLS13]). Even when the TLS stack 883 has no reason to reject early data, the QUIC stack or the application 884 protocol using QUIC might reject early data because the configuration 885 of the transport or application associated with the resumed session 886 is not compatible with the server's current configuration. 888 QUIC requires additional transport state to be associated with a 889 0-RTT session ticket. One common way to implement this is using 890 stateless session tickets and storing this state in the session 891 ticket. Application protocols that use QUIC might have similar 892 requirements regarding associating or storing state. This associated 893 state is used for deciding whether early data must be rejected. For 894 example, HTTP/3 ([QUIC-HTTP]) settings determine how early data from 895 the client is interpreted. Other applications using QUIC could have 896 different requirements for determining whether to accept or reject 897 early data. 899 4.7. HelloRetryRequest 901 The HelloRetryRequest message (see Section 4.1.4 of [TLS13]) can be 902 used to request that a client provide new information, such as a key 903 share, or to validate some characteristic of the client. From the 904 perspective of QUIC, HelloRetryRequest is not differentiated from 905 other cryptographic handshake messages that are carried in Initial 906 packets. Although it is in principle possible to use this feature 907 for address verification, QUIC implementations SHOULD instead use the 908 Retry feature; see Section 8.1 of [QUIC-TRANSPORT]. 910 4.8. TLS Errors 912 If TLS experiences an error, it generates an appropriate alert as 913 defined in Section 6 of [TLS13]. 915 A TLS alert is converted into a QUIC connection error. The 916 AlertDescription value is added to 0x100 to produce a QUIC error code 917 from the range reserved for CRYPTO_ERROR. The resulting value is 918 sent in a QUIC CONNECTION_CLOSE frame of type 0x1c. 920 QUIC is only able to convey an alert level of "fatal". In TLS 1.3, 921 the only existing uses for the "warning" level are to signal 922 connection close; see Section 6.1 of [TLS13]. As QUIC provides 923 alternative mechanisms for connection termination and the TLS 924 connection is only closed if an error is encountered, a QUIC endpoint 925 MUST treat any alert from TLS as if it were at the "fatal" level. 927 QUIC permits the use of a generic code in place of a specific error 928 code; see Section 11 of [QUIC-TRANSPORT]. For TLS alerts, this 929 includes replacing any alert with a generic alert, such as 930 handshake_failure (0x128 in QUIC). Endpoints MAY use a generic error 931 code to avoid possibly exposing confidential information. 933 4.9. Discarding Unused Keys 935 After QUIC has completed a move to a new encryption level, packet 936 protection keys for previous encryption levels can be discarded. 937 This occurs several times during the handshake, as well as when keys 938 are updated; see Section 6. 940 Packet protection keys are not discarded immediately when new keys 941 are available. If packets from a lower encryption level contain 942 CRYPTO frames, frames that retransmit that data MUST be sent at the 943 same encryption level. Similarly, an endpoint generates 944 acknowledgments for packets at the same encryption level as the 945 packet being acknowledged. Thus, it is possible that keys for a 946 lower encryption level are needed for a short time after keys for a 947 newer encryption level are available. 949 An endpoint cannot discard keys for a given encryption level unless 950 it has received all the cryptographic handshake messages from its 951 peer at that encryption level and its peer has done the same. 952 Different methods for determining this are provided for Initial keys 953 (Section 4.9.1) and Handshake keys (Section 4.9.2). These methods do 954 not prevent packets from being received or sent at that encryption 955 level because a peer might not have received all the acknowledgments 956 necessary. 958 Though an endpoint might retain older keys, new data MUST be sent at 959 the highest currently-available encryption level. Only ACK frames 960 and retransmissions of data in CRYPTO frames are sent at a previous 961 encryption level. These packets MAY also include PADDING frames. 963 4.9.1. Discarding Initial Keys 965 Packets protected with Initial secrets (Section 5.2) are not 966 authenticated, meaning that an attacker could spoof packets with the 967 intent to disrupt a connection. To limit these attacks, Initial 968 packet protection keys are discarded more aggressively than other 969 keys. 971 The successful use of Handshake packets indicates that no more 972 Initial packets need to be exchanged, as these keys can only be 973 produced after receiving all CRYPTO frames from Initial packets. 974 Thus, a client MUST discard Initial keys when it first sends a 975 Handshake packet and a server MUST discard Initial keys when it first 976 successfully processes a Handshake packet. Endpoints MUST NOT send 977 Initial packets after this point. 979 This results in abandoning loss recovery state for the Initial 980 encryption level and ignoring any outstanding Initial packets. 982 4.9.2. Discarding Handshake Keys 984 An endpoint MUST discard its handshake keys when the TLS handshake is 985 confirmed (Section 4.1.2). 987 4.9.3. Discarding 0-RTT Keys 989 0-RTT and 1-RTT packets share the same packet number space, and 990 clients do not send 0-RTT packets after sending a 1-RTT packet 991 (Section 5.6). 993 Therefore, a client SHOULD discard 0-RTT keys as soon as it installs 994 1-RTT keys, since they have no use after that moment. 996 Additionally, a server MAY discard 0-RTT keys as soon as it receives 997 a 1-RTT packet. However, due to packet reordering, a 0-RTT packet 998 could arrive after a 1-RTT packet. Servers MAY temporarily retain 999 0-RTT keys to allow decrypting reordered packets without requiring 1000 their contents to be retransmitted with 1-RTT keys. After receiving 1001 a 1-RTT packet, servers MUST discard 0-RTT keys within a short time; 1002 the RECOMMENDED time period is three times the Probe Timeout (PTO, 1003 see [QUIC-RECOVERY]). A server MAY discard 0-RTT keys earlier if it 1004 determines that it has received all 0-RTT packets, which can be done 1005 by keeping track of missing packet numbers. 1007 5. Packet Protection 1009 As with TLS over TCP, QUIC protects packets with keys derived from 1010 the TLS handshake, using the AEAD algorithm [AEAD] negotiated by TLS. 1012 QUIC packets have varying protections depending on their type: 1014 * Version Negotiation packets have no cryptographic protection. 1016 * Retry packets use AEAD_AES_128_GCM to provide protection against 1017 accidental modification and to limit the entities that can produce 1018 a valid Retry; see Section 5.8. 1020 * Initial packets use AEAD_AES_128_GCM with keys derived from the 1021 Destination Connection ID field of the first Initial packet sent 1022 by the client; see Section 5.2. 1024 * All other packets have strong cryptographic protections for 1025 confidentiality and integrity, using keys and algorithms 1026 negotiated by TLS. 1028 This section describes how packet protection is applied to Handshake 1029 packets, 0-RTT packets, and 1-RTT packets. The same packet 1030 protection process is applied to Initial packets. However, as it is 1031 trivial to determine the keys used for Initial packets, these packets 1032 are not considered to have confidentiality or integrity protection. 1033 Retry packets use a fixed key and so similarly lack confidentiality 1034 and integrity protection. 1036 5.1. Packet Protection Keys 1038 QUIC derives packet protection keys in the same way that TLS derives 1039 record protection keys. 1041 Each encryption level has separate secret values for protection of 1042 packets sent in each direction. These traffic secrets are derived by 1043 TLS (see Section 7.1 of [TLS13]) and are used by QUIC for all 1044 encryption levels except the Initial encryption level. The secrets 1045 for the Initial encryption level are computed based on the client's 1046 initial Destination Connection ID, as described in Section 5.2. 1048 The keys used for packet protection are computed from the TLS secrets 1049 using the KDF provided by TLS. In TLS 1.3, the HKDF-Expand-Label 1050 function described in Section 7.1 of [TLS13] is used, using the hash 1051 function from the negotiated cipher suite. All uses of HKDF-Expand- 1052 Label in QUIC use a zero-length Context. 1054 Note that labels, which are described using strings, are encoded as 1055 bytes using ASCII [ASCII] without quotes or any trailing NUL byte. 1057 Other versions of TLS MUST provide a similar function in order to be 1058 used with QUIC. 1060 The current encryption level secret and the label "quic key" are 1061 input to the KDF to produce the AEAD key; the label "quic iv" is used 1062 to derive the Initialization Vector (IV); see Section 5.3. The 1063 header protection key uses the "quic hp" label; see Section 5.4. 1064 Using these labels provides key separation between QUIC and TLS; see 1065 Section 9.6. 1067 Both "quic key" and "quic hp" are used to produce keys, so the Length 1068 provided to HKDF-Expand-Label along with these labels is determined 1069 by the size of keys in the AEAD or header protection algorithm. The 1070 Length provided with "quic iv" is the minimum length of the AEAD 1071 nonce, or 8 bytes if that is larger; see [AEAD]. 1073 The KDF used for initial secrets is always the HKDF-Expand-Label 1074 function from TLS 1.3; see Section 5.2. 1076 5.2. Initial Secrets 1078 Initial packets apply the packet protection process, but use a secret 1079 derived from the Destination Connection ID field from the client's 1080 first Initial packet. 1082 This secret is determined by using HKDF-Extract (see Section 2.2 of 1083 [HKDF]) with a salt of 0x38762cf7f55934b34d179ae6a4c80cadccbb7f0a and 1084 a IKM of the Destination Connection ID field. This produces an 1085 intermediate pseudorandom key (PRK) that is used to derive two 1086 separate secrets for sending and receiving. 1088 The secret used by clients to construct Initial packets uses the PRK 1089 and the label "client in" as input to the HKDF-Expand-Label function 1090 from TLS [TLS13] to produce a 32-byte secret. Packets constructed by 1091 the server use the same process with the label "server in". The hash 1092 function for HKDF when deriving initial secrets and keys is SHA-256 1093 [SHA]. 1095 This process in pseudocode is: 1097 initial_salt = 0x38762cf7f55934b34d179ae6a4c80cadccbb7f0a 1098 initial_secret = HKDF-Extract(initial_salt, 1099 client_dst_connection_id) 1101 client_initial_secret = HKDF-Expand-Label(initial_secret, 1102 "client in", "", 1103 Hash.length) 1104 server_initial_secret = HKDF-Expand-Label(initial_secret, 1105 "server in", "", 1106 Hash.length) 1108 The connection ID used with HKDF-Expand-Label is the Destination 1109 Connection ID in the Initial packet sent by the client. This will be 1110 a randomly-selected value unless the client creates the Initial 1111 packet after receiving a Retry packet, where the Destination 1112 Connection ID is selected by the server. 1114 Future versions of QUIC SHOULD generate a new salt value, thus 1115 ensuring that the keys are different for each version of QUIC. This 1116 prevents a middlebox that recognizes only one version of QUIC from 1117 seeing or modifying the contents of packets from future versions. 1119 The HKDF-Expand-Label function defined in TLS 1.3 MUST be used for 1120 Initial packets even where the TLS versions offered do not include 1121 TLS 1.3. 1123 The secrets used for constructing subsequent Initial packets change 1124 when a server sends a Retry packet, to use the connection ID value 1125 selected by the server. The secrets do not change when a client 1126 changes the Destination Connection ID it uses in response to an 1127 Initial packet from the server. 1129 Note: The Destination Connection ID field could be any length up to 1130 20 bytes, including zero length if the server sends a Retry packet 1131 with a zero-length Source Connection ID field. After a Retry, the 1132 Initial keys provide the client no assurance that the server 1133 received its packet, so the client has to rely on the exchange 1134 that included the Retry packet to validate the server address; see 1135 Section 8.1 of [QUIC-TRANSPORT]. 1137 Appendix A contains sample Initial packets. 1139 5.3. AEAD Usage 1141 The Authenticated Encryption with Associated Data (AEAD; see [AEAD]) 1142 function used for QUIC packet protection is the AEAD that is 1143 negotiated for use with the TLS connection. For example, if TLS is 1144 using the TLS_AES_128_GCM_SHA256 cipher suite, the AEAD_AES_128_GCM 1145 function is used. 1147 QUIC can use any of the cipher suites defined in [TLS13] with the 1148 exception of TLS_AES_128_CCM_8_SHA256. A cipher suite MUST NOT be 1149 negotiated unless a header protection scheme is defined for the 1150 cipher suite. This document defines a header protection scheme for 1151 all cipher suites defined in [TLS13] aside from 1152 TLS_AES_128_CCM_8_SHA256. These cipher suites have a 16-byte 1153 authentication tag and produce an output 16 bytes larger than their 1154 input. 1156 Note: An endpoint MUST NOT reject a ClientHello that offers a cipher 1157 suite that it does not support, or it would be impossible to 1158 deploy a new cipher suite. This also applies to 1159 TLS_AES_128_CCM_8_SHA256. 1161 When constructing packets, the AEAD function is applied prior to 1162 applying header protection; see Section 5.4. The unprotected packet 1163 header is part of the associated data (A). When processing packets, 1164 an endpoint first removes the header protection. 1166 The key and IV for the packet are computed as described in 1167 Section 5.1. The nonce, N, is formed by combining the packet 1168 protection IV with the packet number. The 62 bits of the 1169 reconstructed QUIC packet number in network byte order are left- 1170 padded with zeros to the size of the IV. The exclusive OR of the 1171 padded packet number and the IV forms the AEAD nonce. 1173 The associated data, A, for the AEAD is the contents of the QUIC 1174 header, starting from the first byte of either the short or long 1175 header, up to and including the unprotected packet number. 1177 The input plaintext, P, for the AEAD is the payload of the QUIC 1178 packet, as described in [QUIC-TRANSPORT]. 1180 The output ciphertext, C, of the AEAD is transmitted in place of P. 1182 Some AEAD functions have limits for how many packets can be encrypted 1183 under the same key and IV; see Section 6.6. This might be lower than 1184 the packet number limit. An endpoint MUST initiate a key update 1185 (Section 6) prior to exceeding any limit set for the AEAD that is in 1186 use. 1188 5.4. Header Protection 1190 Parts of QUIC packet headers, in particular the Packet Number field, 1191 are protected using a key that is derived separately from the packet 1192 protection key and IV. The key derived using the "quic hp" label is 1193 used to provide confidentiality protection for those fields that are 1194 not exposed to on-path elements. 1196 This protection applies to the least-significant bits of the first 1197 byte, plus the Packet Number field. The four least-significant bits 1198 of the first byte are protected for packets with long headers; the 1199 five least significant bits of the first byte are protected for 1200 packets with short headers. For both header forms, this covers the 1201 reserved bits and the Packet Number Length field; the Key Phase bit 1202 is also protected for packets with a short header. 1204 The same header protection key is used for the duration of the 1205 connection, with the value not changing after a key update (see 1206 Section 6). This allows header protection to be used to protect the 1207 key phase. 1209 This process does not apply to Retry or Version Negotiation packets, 1210 which do not contain a protected payload or any of the fields that 1211 are protected by this process. 1213 5.4.1. Header Protection Application 1215 Header protection is applied after packet protection is applied (see 1216 Section 5.3). The ciphertext of the packet is sampled and used as 1217 input to an encryption algorithm. The algorithm used depends on the 1218 negotiated AEAD. 1220 The output of this algorithm is a 5-byte mask that is applied to the 1221 protected header fields using exclusive OR. The least significant 1222 bits of the first byte of the packet are masked by the least 1223 significant bits of the first mask byte, and the packet number is 1224 masked with the remaining bytes. Any unused bytes of mask that might 1225 result from a shorter packet number encoding are unused. 1227 Figure 6 shows a sample algorithm for applying header protection. 1228 Removing header protection only differs in the order in which the 1229 packet number length (pn_length) is determined (here "^" is used to 1230 represent exclusive or). 1232 mask = header_protection(hp_key, sample) 1234 pn_length = (packet[0] & 0x03) + 1 1235 if (packet[0] & 0x80) == 0x80: 1236 # Long header: 4 bits masked 1237 packet[0] ^= mask[0] & 0x0f 1238 else: 1239 # Short header: 5 bits masked 1240 packet[0] ^= mask[0] & 0x1f 1242 # pn_offset is the start of the Packet Number field. 1243 packet[pn_offset:pn_offset+pn_length] ^= mask[1:1+pn_length] 1245 Figure 6: Header Protection Pseudocode 1247 Specific header protection functions are defined based on the 1248 selected cipher suite; see Section 5.4.3 and Section 5.4.4. 1250 Figure 7 shows an example long header packet (Initial) and a short 1251 header packet (1-RTT). Figure 7 shows the fields in each header that 1252 are covered by header protection and the portion of the protected 1253 packet payload that is sampled. 1255 Initial Packet { 1256 Header Form (1) = 1, 1257 Fixed Bit (1) = 1, 1258 Long Packet Type (2) = 0, 1259 Reserved Bits (2), # Protected 1260 Packet Number Length (2), # Protected 1261 Version (32), 1262 DCID Len (8), 1263 Destination Connection ID (0..160), 1264 SCID Len (8), 1265 Source Connection ID (0..160), 1266 Token Length (i), 1267 Token (..), 1268 Length (i), 1269 Packet Number (8..32), # Protected 1270 Protected Payload (0..24), # Skipped Part 1271 Protected Payload (128), # Sampled Part 1272 Protected Payload (..) # Remainder 1273 } 1275 1-RTT Packet { 1276 Header Form (1) = 0, 1277 Fixed Bit (1) = 1, 1278 Spin Bit (1), 1279 Reserved Bits (2), # Protected 1280 Key Phase (1), # Protected 1281 Packet Number Length (2), # Protected 1282 Destination Connection ID (0..160), 1283 Packet Number (8..32), # Protected 1284 Protected Payload (0..24), # Skipped Part 1285 Protected Payload (128), # Sampled Part 1286 Protected Payload (..), # Remainder 1287 } 1289 Figure 7: Header Protection and Ciphertext Sample 1291 Before a TLS cipher suite can be used with QUIC, a header protection 1292 algorithm MUST be specified for the AEAD used with that cipher suite. 1293 This document defines algorithms for AEAD_AES_128_GCM, 1294 AEAD_AES_128_CCM, AEAD_AES_256_GCM (all these AES AEADs are defined 1295 in [AEAD]), and AEAD_CHACHA20_POLY1305 (defined in [CHACHA]). Prior 1296 to TLS selecting a cipher suite, AES header protection is used 1297 (Section 5.4.3), matching the AEAD_AES_128_GCM packet protection. 1299 5.4.2. Header Protection Sample 1301 The header protection algorithm uses both the header protection key 1302 and a sample of the ciphertext from the packet Payload field. 1304 The same number of bytes are always sampled, but an allowance needs 1305 to be made for the endpoint removing protection, which will not know 1306 the length of the Packet Number field. The sample of ciphertext is 1307 taken starting from an offset of 4 bytes after the start of the 1308 Packet Number field. That is, in sampling packet ciphertext for 1309 header protection, the Packet Number field is assumed to be 4 bytes 1310 long (its maximum possible encoded length). 1312 An endpoint MUST discard packets that are not long enough to contain 1313 a complete sample. 1315 To ensure that sufficient data is available for sampling, packets are 1316 padded so that the combined lengths of the encoded packet number and 1317 protected payload is at least 4 bytes longer than the sample required 1318 for header protection. The cipher suites defined in [TLS13] - other 1319 than TLS_AES_128_CCM_8_SHA256, for which a header protection scheme 1320 is not defined in this document - have 16-byte expansions and 16-byte 1321 header protection samples. This results in needing at least 3 bytes 1322 of frames in the unprotected payload if the packet number is encoded 1323 on a single byte, or 2 bytes of frames for a 2-byte packet number 1324 encoding. 1326 The sampled ciphertext can be determined by the following pseudocode: 1328 # pn_offset is the start of the Packet Number field. 1329 sample_offset = pn_offset + 4 1331 sample = packet[sample_offset..sample_offset+sample_length] 1333 where the packet number offset of a short header packet can be 1334 calculated as: 1336 pn_offset = 1 + len(connection_id) 1338 and the packet number offset of a long header packet can be 1339 calculated as: 1341 pn_offset = 7 + len(destination_connection_id) + 1342 len(source_connection_id) + 1343 len(payload_length) 1344 if packet_type == Initial: 1345 pn_offset += len(token_length) + 1346 len(token) 1348 For example, for a packet with a short header, an 8-byte connection 1349 ID, and protected with AEAD_AES_128_GCM, the sample takes bytes 13 to 1350 28 inclusive (using zero-based indexing). 1352 Multiple QUIC packets might be included in the same UDP datagram. 1353 Each packet is handled separately. 1355 5.4.3. AES-Based Header Protection 1357 This section defines the packet protection algorithm for 1358 AEAD_AES_128_GCM, AEAD_AES_128_CCM, and AEAD_AES_256_GCM. 1359 AEAD_AES_128_GCM and AEAD_AES_128_CCM use 128-bit AES in electronic 1360 code-book (ECB) mode. AEAD_AES_256_GCM uses 256-bit AES in ECB mode. 1361 AES is defined in [AES]. 1363 This algorithm samples 16 bytes from the packet ciphertext. This 1364 value is used as the input to AES-ECB. In pseudocode, the header 1365 protection function is defined as: 1367 header_protection(hp_key, sample): 1368 mask = AES-ECB(hp_key, sample) 1370 5.4.4. ChaCha20-Based Header Protection 1372 When AEAD_CHACHA20_POLY1305 is in use, header protection uses the raw 1373 ChaCha20 function as defined in Section 2.4 of [CHACHA]. This uses a 1374 256-bit key and 16 bytes sampled from the packet protection output. 1376 The first 4 bytes of the sampled ciphertext are the block counter. A 1377 ChaCha20 implementation could take a 32-bit integer in place of a 1378 byte sequence, in which case the byte sequence is interpreted as a 1379 little-endian value. 1381 The remaining 12 bytes are used as the nonce. A ChaCha20 1382 implementation might take an array of three 32-bit integers in place 1383 of a byte sequence, in which case the nonce bytes are interpreted as 1384 a sequence of 32-bit little-endian integers. 1386 The encryption mask is produced by invoking ChaCha20 to protect 5 1387 zero bytes. In pseudocode, the header protection function is defined 1388 as: 1390 header_protection(hp_key, sample): 1391 counter = sample[0..3] 1392 nonce = sample[4..15] 1393 mask = ChaCha20(hp_key, counter, nonce, {0,0,0,0,0}) 1395 5.5. Receiving Protected Packets 1397 Once an endpoint successfully receives a packet with a given packet 1398 number, it MUST discard all packets in the same packet number space 1399 with higher packet numbers if they cannot be successfully unprotected 1400 with either the same key, or - if there is a key update - a 1401 subsequent packet protection key; see Section 6. Similarly, a packet 1402 that appears to trigger a key update, but cannot be unprotected 1403 successfully MUST be discarded. 1405 Failure to unprotect a packet does not necessarily indicate the 1406 existence of a protocol error in a peer or an attack. The truncated 1407 packet number encoding used in QUIC can cause packet numbers to be 1408 decoded incorrectly if they are delayed significantly. 1410 5.6. Use of 0-RTT Keys 1412 If 0-RTT keys are available (see Section 4.6.1), the lack of replay 1413 protection means that restrictions on their use are necessary to 1414 avoid replay attacks on the protocol. 1416 Of the frames defined in [QUIC-TRANSPORT], the STREAM, RESET_STREAM, 1417 STOP_SENDING, and CONNECTION_CLOSE frames are potentially unsafe for 1418 use with 0-RTT as they carry application data. Application data that 1419 is received in 0-RTT could cause an application at the server to 1420 process the data multiple times rather than just once. Additional 1421 actions taken by a server as a result of processing replayed 1422 application data could have unwanted consequences. A client 1423 therefore MUST NOT use 0-RTT for application data unless specifically 1424 requested by the application that is in use. 1426 An application protocol that uses QUIC MUST include a profile that 1427 defines acceptable use of 0-RTT; otherwise, 0-RTT can only be used to 1428 carry QUIC frames that do not carry application data. For example, a 1429 profile for HTTP is described in [HTTP-REPLAY] and used for HTTP/3; 1430 see Section 10.9 of [QUIC-HTTP]. 1432 Though replaying packets might result in additional connection 1433 attempts, the effect of processing replayed frames that do not carry 1434 application data is limited to changing the state of the affected 1435 connection. A TLS handshake cannot be successfully completed using 1436 replayed packets. 1438 A client MAY wish to apply additional restrictions on what data it 1439 sends prior to the completion of the TLS handshake. 1441 A client otherwise treats 0-RTT keys as equivalent to 1-RTT keys, 1442 except that it cannot send certain frames with 0-RTT keys; see 1443 Section 12.5 of [QUIC-TRANSPORT]. 1445 A client that receives an indication that its 0-RTT data has been 1446 accepted by a server can send 0-RTT data until it receives all of the 1447 server's handshake messages. A client SHOULD stop sending 0-RTT data 1448 if it receives an indication that 0-RTT data has been rejected. 1450 A server MUST NOT use 0-RTT keys to protect packets; it uses 1-RTT 1451 keys to protect acknowledgments of 0-RTT packets. A client MUST NOT 1452 attempt to decrypt 0-RTT packets it receives and instead MUST discard 1453 them. 1455 Once a client has installed 1-RTT keys, it MUST NOT send any more 1456 0-RTT packets. 1458 Note: 0-RTT data can be acknowledged by the server as it receives 1459 it, but any packets containing acknowledgments of 0-RTT data 1460 cannot have packet protection removed by the client until the TLS 1461 handshake is complete. The 1-RTT keys necessary to remove packet 1462 protection cannot be derived until the client receives all server 1463 handshake messages. 1465 5.7. Receiving Out-of-Order Protected Packets 1467 Due to reordering and loss, protected packets might be received by an 1468 endpoint before the final TLS handshake messages are received. A 1469 client will be unable to decrypt 1-RTT packets from the server, 1470 whereas a server will be able to decrypt 1-RTT packets from the 1471 client. Endpoints in either role MUST NOT decrypt 1-RTT packets from 1472 their peer prior to completing the handshake. 1474 Even though 1-RTT keys are available to a server after receiving the 1475 first handshake messages from a client, it is missing assurances on 1476 the client state: 1478 * The client is not authenticated, unless the server has chosen to 1479 use a pre-shared key and validated the client's pre-shared key 1480 binder; see Section 4.2.11 of [TLS13]. 1482 * The client has not demonstrated liveness, unless the server has 1483 validated the client's address with a Retry packet or other means; 1484 see Section 8.1 of [QUIC-TRANSPORT]. 1486 * Any received 0-RTT data that the server responds to might be due 1487 to a replay attack. 1489 Therefore, the server's use of 1-RTT keys before the handshake is 1490 complete is limited to sending data. A server MUST NOT process 1491 incoming 1-RTT protected packets before the TLS handshake is 1492 complete. Because sending acknowledgments indicates that all frames 1493 in a packet have been processed, a server cannot send acknowledgments 1494 for 1-RTT packets until the TLS handshake is complete. Received 1495 packets protected with 1-RTT keys MAY be stored and later decrypted 1496 and used once the handshake is complete. 1498 Note: TLS implementations might provide all 1-RTT secrets prior to 1499 handshake completion. Even where QUIC implementations have 1-RTT 1500 read keys, those keys are not to be used prior to completing the 1501 handshake. 1503 The requirement for the server to wait for the client Finished 1504 message creates a dependency on that message being delivered. A 1505 client can avoid the potential for head-of-line blocking that this 1506 implies by sending its 1-RTT packets coalesced with a Handshake 1507 packet containing a copy of the CRYPTO frame that carries the 1508 Finished message, until one of the Handshake packets is acknowledged. 1509 This enables immediate server processing for those packets. 1511 A server could receive packets protected with 0-RTT keys prior to 1512 receiving a TLS ClientHello. The server MAY retain these packets for 1513 later decryption in anticipation of receiving a ClientHello. 1515 A client generally receives 1-RTT keys at the same time as the 1516 handshake completes. Even if it has 1-RTT secrets, a client MUST NOT 1517 process incoming 1-RTT protected packets before the TLS handshake is 1518 complete. 1520 5.8. Retry Packet Integrity 1522 Retry packets (see the Retry Packet section of [QUIC-TRANSPORT]) 1523 carry a Retry Integrity Tag that provides two properties: it allows 1524 discarding packets that have accidentally been corrupted by the 1525 network; only an entity that observes an Initial packet can send a 1526 valid Retry packet. 1528 The Retry Integrity Tag is a 128-bit field that is computed as the 1529 output of AEAD_AES_128_GCM ([AEAD]) used with the following inputs: 1531 * The secret key, K, is 128 bits equal to 1532 0xbe0c690b9f66575a1d766b54e368c84e. 1534 * The nonce, N, is 96 bits equal to 0x461599d35d632bf2239825bb. 1536 * The plaintext, P, is empty. 1538 * The associated data, A, is the contents of the Retry Pseudo- 1539 Packet, as illustrated in Figure 8: 1541 The secret key and the nonce are values derived by calling HKDF- 1542 Expand-Label using 1543 0xd9c9943e6101fd200021506bcc02814c73030f25c79d71ce876eca876e6fca8e as 1544 the secret, with labels being "quic key" and "quic iv" (Section 5.1). 1546 Retry Pseudo-Packet { 1547 ODCID Length (8), 1548 Original Destination Connection ID (0..160), 1549 Header Form (1) = 1, 1550 Fixed Bit (1) = 1, 1551 Long Packet Type (2) = 3, 1552 Unused (4), 1553 Version (32), 1554 DCID Len (8), 1555 Destination Connection ID (0..160), 1556 SCID Len (8), 1557 Source Connection ID (0..160), 1558 Retry Token (..), 1559 } 1561 Figure 8: Retry Pseudo-Packet 1563 The Retry Pseudo-Packet is not sent over the wire. It is computed by 1564 taking the transmitted Retry packet, removing the Retry Integrity Tag 1565 and prepending the two following fields: 1567 ODCID Length: The ODCID Length field contains the length in bytes of 1568 the Original Destination Connection ID field that follows it, 1569 encoded as an 8-bit unsigned integer. 1571 Original Destination Connection ID: The Original Destination 1572 Connection ID contains the value of the Destination Connection ID 1573 from the Initial packet that this Retry is in response to. The 1574 length of this field is given in ODCID Length. The presence of 1575 this field ensures that a valid Retry packet can only be sent by 1576 an entity that observes the Initial packet. 1578 6. Key Update 1580 Once the handshake is confirmed (see Section 4.1.2), an endpoint MAY 1581 initiate a key update. 1583 The Key Phase bit indicates which packet protection keys are used to 1584 protect the packet. The Key Phase bit is initially set to 0 for the 1585 first set of 1-RTT packets and toggled to signal each subsequent key 1586 update. 1588 The Key Phase bit allows a recipient to detect a change in keying 1589 material without needing to receive the first packet that triggered 1590 the change. An endpoint that notices a changed Key Phase bit updates 1591 keys and decrypts the packet that contains the changed value. 1593 Initiating a key update results in both endpoints updating keys. 1594 This differs from TLS where endpoints can update keys independently. 1596 This mechanism replaces the key update mechanism of TLS, which relies 1597 on KeyUpdate messages sent using 1-RTT encryption keys. Endpoints 1598 MUST NOT send a TLS KeyUpdate message. Endpoints MUST treat the 1599 receipt of a TLS KeyUpdate message as a connection error of type 1600 0x10a, equivalent to a fatal TLS alert of unexpected_message; see 1601 Section 4.8. 1603 Figure 9 shows a key update process, where the initial set of keys 1604 used (identified with @M) are replaced by updated keys (identified 1605 with @N). The value of the Key Phase bit is indicated in brackets 1606 []. 1608 Initiating Peer Responding Peer 1610 @M [0] QUIC Packets 1612 ... Update to @N 1613 @N [1] QUIC Packets 1614 --------> 1615 Update to @N ... 1616 QUIC Packets [1] @N 1617 <-------- 1618 QUIC Packets [1] @N 1619 containing ACK 1620 <-------- 1621 ... Key Update Permitted 1623 @N [1] QUIC Packets 1624 containing ACK for @N packets 1625 --------> 1626 Key Update Permitted ... 1628 Figure 9: Key Update 1630 6.1. Initiating a Key Update 1632 Endpoints maintain separate read and write secrets for packet 1633 protection. An endpoint initiates a key update by updating its 1634 packet protection write secret and using that to protect new packets. 1635 The endpoint creates a new write secret from the existing write 1636 secret as performed in Section 7.2 of [TLS13]. This uses the KDF 1637 function provided by TLS with a label of "quic ku". The 1638 corresponding key and IV are created from that secret as defined in 1639 Section 5.1. The header protection key is not updated. 1641 For example, to update write keys with TLS 1.3, HKDF-Expand-Label is 1642 used as: 1644 secret_ = HKDF-Expand-Label(secret_, "quic ku", 1645 "", Hash.length) 1647 The endpoint toggles the value of the Key Phase bit and uses the 1648 updated key and IV to protect all subsequent packets. 1650 An endpoint MUST NOT initiate a key update prior to having confirmed 1651 the handshake (Section 4.1.2). An endpoint MUST NOT initiate a 1652 subsequent key update unless it has received an acknowledgment for a 1653 packet that was sent protected with keys from the current key phase. 1654 This ensures that keys are available to both peers before another key 1655 update can be initiated. This can be implemented by tracking the 1656 lowest packet number sent with each key phase, and the highest 1657 acknowledged packet number in the 1-RTT space: once the latter is 1658 higher than or equal to the former, another key update can be 1659 initiated. 1661 Note: Keys of packets other than the 1-RTT packets are never 1662 updated; their keys are derived solely from the TLS handshake 1663 state. 1665 The endpoint that initiates a key update also updates the keys that 1666 it uses for receiving packets. These keys will be needed to process 1667 packets the peer sends after updating. 1669 An endpoint MUST retain old keys until it has successfully 1670 unprotected a packet sent using the new keys. An endpoint SHOULD 1671 retain old keys for some time after unprotecting a packet sent using 1672 the new keys. Discarding old keys too early can cause delayed 1673 packets to be discarded. Discarding packets will be interpreted as 1674 packet loss by the peer and could adversely affect performance. 1676 6.2. Responding to a Key Update 1678 A peer is permitted to initiate a key update after receiving an 1679 acknowledgment of a packet in the current key phase. An endpoint 1680 detects a key update when processing a packet with a key phase that 1681 differs from the value used to protect the last packet it sent. To 1682 process this packet, the endpoint uses the next packet protection key 1683 and IV. See Section 6.3 for considerations about generating these 1684 keys. 1686 If a packet is successfully processed using the next key and IV, then 1687 the peer has initiated a key update. The endpoint MUST update its 1688 send keys to the corresponding key phase in response, as described in 1689 Section 6.1. Sending keys MUST be updated before sending an 1690 acknowledgment for the packet that was received with updated keys. 1691 By acknowledging the packet that triggered the key update in a packet 1692 protected with the updated keys, the endpoint signals that the key 1693 update is complete. 1695 An endpoint can defer sending the packet or acknowledgment according 1696 to its normal packet sending behaviour; it is not necessary to 1697 immediately generate a packet in response to a key update. The next 1698 packet sent by the endpoint will use the updated keys. The next 1699 packet that contains an acknowledgment will cause the key update to 1700 be completed. If an endpoint detects a second update before it has 1701 sent any packets with updated keys containing an acknowledgment for 1702 the packet that initiated the key update, it indicates that its peer 1703 has updated keys twice without awaiting confirmation. An endpoint 1704 MAY treat such consecutive key updates as a connection error of type 1705 KEY_UPDATE_ERROR. 1707 An endpoint that receives an acknowledgment that is carried in a 1708 packet protected with old keys where any acknowledged packet was 1709 protected with newer keys MAY treat that as a connection error of 1710 type KEY_UPDATE_ERROR. This indicates that a peer has received and 1711 acknowledged a packet that initiates a key update, but has not 1712 updated keys in response. 1714 6.3. Timing of Receive Key Generation 1716 Endpoints responding to an apparent key update MUST NOT generate a 1717 timing side-channel signal that might indicate that the Key Phase bit 1718 was invalid (see Section 9.4). Endpoints can use dummy packet 1719 protection keys in place of discarded keys when key updates are not 1720 yet permitted. Using dummy keys will generate no variation in the 1721 timing signal produced by attempting to remove packet protection, and 1722 results in all packets with an invalid Key Phase bit being rejected. 1724 The process of creating new packet protection keys for receiving 1725 packets could reveal that a key update has occurred. An endpoint MAY 1726 generate new keys as part of packet processing, but this creates a 1727 timing signal that could be used by an attacker to learn when key 1728 updates happen and thus leak the value of the Key Phase bit. 1730 Endpoints are generally expected to have current and next receive 1731 packet protection keys available. For a short period after a key 1732 update completes, up to the PTO, endpoints MAY defer generation of 1733 the next set of receive packet protection keys. This allows 1734 endpoints to retain only two sets of receive keys; see Section 6.5. 1736 Once generated, the next set of packet protection keys SHOULD be 1737 retained, even if the packet that was received was subsequently 1738 discarded. Packets containing apparent key updates are easy to forge 1739 and - while the process of key update does not require significant 1740 effort - triggering this process could be used by an attacker for 1741 DoS. 1743 For this reason, endpoints MUST be able to retain two sets of packet 1744 protection keys for receiving packets: the current and the next. 1745 Retaining the previous keys in addition to these might improve 1746 performance, but this is not essential. 1748 6.4. Sending with Updated Keys 1750 An endpoint never sends packets that are protected with old keys. 1751 Only the current keys are used. Keys used for protecting packets can 1752 be discarded immediately after switching to newer keys. 1754 Packets with higher packet numbers MUST be protected with either the 1755 same or newer packet protection keys than packets with lower packet 1756 numbers. An endpoint that successfully removes protection with old 1757 keys when newer keys were used for packets with lower packet numbers 1758 MUST treat this as a connection error of type KEY_UPDATE_ERROR. 1760 6.5. Receiving with Different Keys 1762 For receiving packets during a key update, packets protected with 1763 older keys might arrive if they were delayed by the network. 1764 Retaining old packet protection keys allows these packets to be 1765 successfully processed. 1767 As packets protected with keys from the next key phase use the same 1768 Key Phase value as those protected with keys from the previous key 1769 phase, it is necessary to distinguish between the two, if packets 1770 protected with old keys are to be processed. This can be done using 1771 packet numbers. A recovered packet number that is lower than any 1772 packet number from the current key phase uses the previous packet 1773 protection keys; a recovered packet number that is higher than any 1774 packet number from the current key phase requires the use of the next 1775 packet protection keys. 1777 Some care is necessary to ensure that any process for selecting 1778 between previous, current, and next packet protection keys does not 1779 expose a timing side channel that might reveal which keys were used 1780 to remove packet protection. See Section 9.5 for more information. 1782 Alternatively, endpoints can retain only two sets of packet 1783 protection keys, swapping previous for next after enough time has 1784 passed to allow for reordering in the network. In this case, the Key 1785 Phase bit alone can be used to select keys. 1787 An endpoint MAY allow a period of approximately the Probe Timeout 1788 (PTO; see [QUIC-RECOVERY]) after promoting the next set of receive 1789 keys to be current before it creates the subsequent set of packet 1790 protection keys. These updated keys MAY replace the previous keys at 1791 that time. With the caveat that PTO is a subjective measure - that 1792 is, a peer could have a different view of the RTT - this time is 1793 expected to be long enough that any reordered packets would be 1794 declared lost by a peer even if they were acknowledged and short 1795 enough to allow a peer to initiate further key updates. 1797 Endpoints need to allow for the possibility that a peer might not be 1798 able to decrypt packets that initiate a key update during the period 1799 when the peer retains old keys. Endpoints SHOULD wait three times 1800 the PTO before initiating a key update after receiving an 1801 acknowledgment that confirms that the previous key update was 1802 received. Failing to allow sufficient time could lead to packets 1803 being discarded. 1805 An endpoint SHOULD retain old read keys for no more than three times 1806 the PTO after having received a packet protected using the new keys. 1807 After this period, old read keys and their corresponding secrets 1808 SHOULD be discarded. 1810 6.6. Limits on AEAD Usage 1812 This document sets usage limits for AEAD algorithms to ensure that 1813 overuse does not give an adversary a disproportionate advantage in 1814 attacking the confidentiality and integrity of communications when 1815 using QUIC. 1817 The usage limits defined in TLS 1.3 exist for protection against 1818 attacks on confidentiality and apply to successful applications of 1819 AEAD protection. The integrity protections in authenticated 1820 encryption also depend on limiting the number of attempts to forge 1821 packets. TLS achieves this by closing connections after any record 1822 fails an authentication check. In comparison, QUIC ignores any 1823 packet that cannot be authenticated, allowing multiple forgery 1824 attempts. 1826 QUIC accounts for AEAD confidentiality and integrity limits 1827 separately. The confidentiality limit applies to the number of 1828 packets encrypted with a given key. The integrity limit applies to 1829 the number of packets decrypted within a given connection. Details 1830 on enforcing these limits for each AEAD algorithm follow below. 1832 Endpoints MUST count the number of encrypted packets for each set of 1833 keys. If the total number of encrypted packets with the same key 1834 exceeds the confidentiality limit for the selected AEAD, the endpoint 1835 MUST stop using those keys. Endpoints MUST initiate a key update 1836 before sending more protected packets than the confidentiality limit 1837 for the selected AEAD permits. If a key update is not possible or 1838 integrity limits are reached, the endpoint MUST stop using the 1839 connection and only send stateless resets in response to receiving 1840 packets. It is RECOMMENDED that endpoints immediately close the 1841 connection with a connection error of type AEAD_LIMIT_REACHED before 1842 reaching a state where key updates are not possible. 1844 For AEAD_AES_128_GCM and AEAD_AES_256_GCM, the confidentiality limit 1845 is 2^23 encrypted packets; see Appendix B.1. For 1846 AEAD_CHACHA20_POLY1305, the confidentiality limit is greater than the 1847 number of possible packets (2^62) and so can be disregarded. For 1848 AEAD_AES_128_CCM, the confidentiality limit is 2^21.5 encrypted 1849 packets; see Appendix B.2. Applying a limit reduces the probability 1850 that an attacker can distinguish the AEAD in use from a random 1851 permutation; see [AEBounds], [ROBUST], and [GCM-MU]. 1853 In addition to counting packets sent, endpoints MUST count the number 1854 of received packets that fail authentication during the lifetime of a 1855 connection. If the total number of received packets that fail 1856 authentication within the connection, across all keys, exceeds the 1857 integrity limit for the selected AEAD, the endpoint MUST immediately 1858 close the connection with a connection error of type 1859 AEAD_LIMIT_REACHED and not process any more packets. 1861 For AEAD_AES_128_GCM and AEAD_AES_256_GCM, the integrity limit is 1862 2^52 invalid packets; see Appendix B.1. For AEAD_CHACHA20_POLY1305, 1863 the integrity limit is 2^36 invalid packets; see [AEBounds]. For 1864 AEAD_AES_128_CCM, the integrity limit is 2^21.5 invalid packets; see 1865 Appendix B.2. Applying this limit reduces the probability that an 1866 attacker can successfully forge a packet; see [AEBounds], [ROBUST], 1867 and [GCM-MU]. 1869 Endpoints that limit the size of packets MAY use higher 1870 confidentiality and integrity limits; see Appendix B for details. 1872 Future analyses and specifications MAY relax confidentiality or 1873 integrity limits for an AEAD. 1875 Any TLS cipher suite that is specified for use with QUIC MUST define 1876 limits on the use of the associated AEAD function that preserves 1877 margins for confidentiality and integrity. That is, limits MUST be 1878 specified for the number of packets that can be authenticated and for 1879 the number of packets that can fail authentication. Providing a 1880 reference to any analysis upon which values are based - and any 1881 assumptions used in that analysis - allows limits to be adapted to 1882 varying usage conditions. 1884 6.7. Key Update Error Code 1886 The KEY_UPDATE_ERROR error code (0xe) is used to signal errors 1887 related to key updates. 1889 7. Security of Initial Messages 1891 Initial packets are not protected with a secret key, so they are 1892 subject to potential tampering by an attacker. QUIC provides 1893 protection against attackers that cannot read packets, but does not 1894 attempt to provide additional protection against attacks where the 1895 attacker can observe and inject packets. Some forms of tampering -- 1896 such as modifying the TLS messages themselves -- are detectable, but 1897 some -- such as modifying ACKs -- are not. 1899 For example, an attacker could inject a packet containing an ACK 1900 frame that makes it appear that a packet had not been received or to 1901 create a false impression of the state of the connection (e.g., by 1902 modifying the ACK Delay). Note that such a packet could cause a 1903 legitimate packet to be dropped as a duplicate. Implementations 1904 SHOULD use caution in relying on any data that is contained in 1905 Initial packets that is not otherwise authenticated. 1907 It is also possible for the attacker to tamper with data that is 1908 carried in Handshake packets, but because that tampering requires 1909 modifying TLS handshake messages, that tampering will cause the TLS 1910 handshake to fail. 1912 8. QUIC-Specific Adjustments to the TLS Handshake 1914 Certain aspects of the TLS handshake are different when used with 1915 QUIC. 1917 QUIC also requires additional features from TLS. In addition to 1918 negotiation of cryptographic parameters, the TLS handshake carries 1919 and authenticates values for QUIC transport parameters. 1921 8.1. Protocol Negotiation 1923 QUIC requires that the cryptographic handshake provide authenticated 1924 protocol negotiation. TLS uses Application Layer Protocol 1925 Negotiation ([ALPN]) to select an application protocol. Unless 1926 another mechanism is used for agreeing on an application protocol, 1927 endpoints MUST use ALPN for this purpose. 1929 When using ALPN, endpoints MUST immediately close a connection (see 1930 Section 10.2 of [QUIC-TRANSPORT]) with a no_application_protocol TLS 1931 alert (QUIC error code 0x178; see Section 4.8) if an application 1932 protocol is not negotiated. While [ALPN] only specifies that servers 1933 use this alert, QUIC clients MUST use error 0x178 to terminate a 1934 connection when ALPN negotiation fails. 1936 An application protocol MAY restrict the QUIC versions that it can 1937 operate over. Servers MUST select an application protocol compatible 1938 with the QUIC version that the client has selected. The server MUST 1939 treat the inability to select a compatible application protocol as a 1940 connection error of type 0x178 (no_application_protocol). Similarly, 1941 a client MUST treat the selection of an incompatible application 1942 protocol by a server as a connection error of type 0x178. 1944 8.2. QUIC Transport Parameters Extension 1946 QUIC transport parameters are carried in a TLS extension. Different 1947 versions of QUIC might define a different method for negotiating 1948 transport configuration. 1950 Including transport parameters in the TLS handshake provides 1951 integrity protection for these values. 1953 enum { 1954 quic_transport_parameters(0x39), (65535) 1955 } ExtensionType; 1957 The extension_data field of the quic_transport_parameters extension 1958 contains a value that is defined by the version of QUIC that is in 1959 use. 1961 The quic_transport_parameters extension is carried in the ClientHello 1962 and the EncryptedExtensions messages during the handshake. Endpoints 1963 MUST send the quic_transport_parameters extension; endpoints that 1964 receive ClientHello or EncryptedExtensions messages without the 1965 quic_transport_parameters extension MUST close the connection with an 1966 error of type 0x16d (equivalent to a fatal TLS missing_extension 1967 alert, see Section 4.8). 1969 Transport parameters become available prior to the completion of the 1970 handshake. A server might use these values earlier than handshake 1971 completion. However, the value of transport parameters is not 1972 authenticated until the handshake completes, so any use of these 1973 parameters cannot depend on their authenticity. Any tampering with 1974 transport parameters will cause the handshake to fail. 1976 Endpoints MUST NOT send this extension in a TLS connection that does 1977 not use QUIC (such as the use of TLS with TCP defined in [TLS13]). A 1978 fatal unsupported_extension alert MUST be sent by an implementation 1979 that supports this extension if the extension is received when the 1980 transport is not QUIC. 1982 Negotiating the quic_transport_parameters extension causes the 1983 EndOfEarlyData to be removed; see Section 8.3. 1985 8.3. Removing the EndOfEarlyData Message 1987 The TLS EndOfEarlyData message is not used with QUIC. QUIC does not 1988 rely on this message to mark the end of 0-RTT data or to signal the 1989 change to Handshake keys. 1991 Clients MUST NOT send the EndOfEarlyData message. A server MUST 1992 treat receipt of a CRYPTO frame in a 0-RTT packet as a connection 1993 error of type PROTOCOL_VIOLATION. 1995 As a result, EndOfEarlyData does not appear in the TLS handshake 1996 transcript. 1998 8.4. Prohibit TLS Middlebox Compatibility Mode 2000 Appendix D.4 of [TLS13] describes an alteration to the TLS 1.3 2001 handshake as a workaround for bugs in some middleboxes. The TLS 1.3 2002 middlebox compatibility mode involves setting the legacy_session_id 2003 field to a 32-byte value in the ClientHello and ServerHello, then 2004 sending a change_cipher_spec record. Both field and record carry no 2005 semantic content and are ignored. 2007 This mode has no use in QUIC as it only applies to middleboxes that 2008 interfere with TLS over TCP. QUIC also provides no means to carry a 2009 change_cipher_spec record. A client MUST NOT request the use of the 2010 TLS 1.3 compatibility mode. A server SHOULD treat the receipt of a 2011 TLS ClientHello with a non-empty legacy_session_id field as a 2012 connection error of type PROTOCOL_VIOLATION. 2014 9. Security Considerations 2016 All of the security considerations that apply to TLS also apply to 2017 the use of TLS in QUIC. Reading all of [TLS13] and its appendices is 2018 the best way to gain an understanding of the security properties of 2019 QUIC. 2021 This section summarizes some of the more important security aspects 2022 specific to the TLS integration, though there are many security- 2023 relevant details in the remainder of the document. 2025 9.1. Session Linkability 2027 Use of TLS session tickets allows servers and possibly other entities 2028 to correlate connections made by the same client; see Section 4.5 for 2029 details. 2031 9.2. Replay Attacks with 0-RTT 2033 As described in Section 8 of [TLS13], use of TLS early data comes 2034 with an exposure to replay attack. The use of 0-RTT in QUIC is 2035 similarly vulnerable to replay attack. 2037 Endpoints MUST implement and use the replay protections described in 2038 [TLS13], however it is recognized that these protections are 2039 imperfect. Therefore, additional consideration of the risk of replay 2040 is needed. 2042 QUIC is not vulnerable to replay attack, except via the application 2043 protocol information it might carry. The management of QUIC protocol 2044 state based on the frame types defined in [QUIC-TRANSPORT] is not 2045 vulnerable to replay. Processing of QUIC frames is idempotent and 2046 cannot result in invalid connection states if frames are replayed, 2047 reordered or lost. QUIC connections do not produce effects that last 2048 beyond the lifetime of the connection, except for those produced by 2049 the application protocol that QUIC serves. 2051 Note: TLS session tickets and address validation tokens are used to 2052 carry QUIC configuration information between connections. 2053 Specifically, to enable a server to efficiently recover state that 2054 is used in connection establishment and address validation. These 2055 MUST NOT be used to communicate application semantics between 2056 endpoints; clients MUST treat them as opaque values. The 2057 potential for reuse of these tokens means that they require 2058 stronger protections against replay. 2060 A server that accepts 0-RTT on a connection incurs a higher cost than 2061 accepting a connection without 0-RTT. This includes higher 2062 processing and computation costs. Servers need to consider the 2063 probability of replay and all associated costs when accepting 0-RTT. 2065 Ultimately, the responsibility for managing the risks of replay 2066 attacks with 0-RTT lies with an application protocol. An application 2067 protocol that uses QUIC MUST describe how the protocol uses 0-RTT and 2068 the measures that are employed to protect against replay attack. An 2069 analysis of replay risk needs to consider all QUIC protocol features 2070 that carry application semantics. 2072 Disabling 0-RTT entirely is the most effective defense against replay 2073 attack. 2075 QUIC extensions MUST describe how replay attacks affect their 2076 operation, or prohibit their use in 0-RTT. Application protocols 2077 MUST either prohibit the use of extensions that carry application 2078 semantics in 0-RTT or provide replay mitigation strategies. 2080 9.3. Packet Reflection Attack Mitigation 2082 A small ClientHello that results in a large block of handshake 2083 messages from a server can be used in packet reflection attacks to 2084 amplify the traffic generated by an attacker. 2086 QUIC includes three defenses against this attack. First, the packet 2087 containing a ClientHello MUST be padded to a minimum size. Second, 2088 if responding to an unverified source address, the server is 2089 forbidden to send more than three times as many bytes as the number 2090 of bytes it has received (see Section 8.1 of [QUIC-TRANSPORT]). 2091 Finally, because acknowledgments of Handshake packets are 2092 authenticated, a blind attacker cannot forge them. Put together, 2093 these defenses limit the level of amplification. 2095 9.4. Header Protection Analysis 2097 [NAN] analyzes authenticated encryption algorithms that provide nonce 2098 privacy, referred to as "Hide Nonce" (HN) transforms. The general 2099 header protection construction in this document is one of those 2100 algorithms (HN1). Header protection is applied after the packet 2101 protection AEAD, sampling a set of bytes ("sample") from the AEAD 2102 output and encrypting the header field using a pseudorandom function 2103 (PRF) as follows: 2105 protected_field = field XOR PRF(hp_key, sample) 2106 The header protection variants in this document use a pseudorandom 2107 permutation (PRP) in place of a generic PRF. However, since all PRPs 2108 are also PRFs [IMC], these variants do not deviate from the HN1 2109 construction. 2111 As "hp_key" is distinct from the packet protection key, it follows 2112 that header protection achieves AE2 security as defined in [NAN] and 2113 therefore guarantees privacy of "field", the protected packet header. 2114 Future header protection variants based on this construction MUST use 2115 a PRF to ensure equivalent security guarantees. 2117 Use of the same key and ciphertext sample more than once risks 2118 compromising header protection. Protecting two different headers 2119 with the same key and ciphertext sample reveals the exclusive OR of 2120 the protected fields. Assuming that the AEAD acts as a PRF, if L 2121 bits are sampled, the odds of two ciphertext samples being identical 2122 approach 2^(-L/2), that is, the birthday bound. For the algorithms 2123 described in this document, that probability is one in 2^64. 2125 To prevent an attacker from modifying packet headers, the header is 2126 transitively authenticated using packet protection; the entire packet 2127 header is part of the authenticated additional data. Protected 2128 fields that are falsified or modified can only be detected once the 2129 packet protection is removed. 2131 9.5. Header Protection Timing Side-Channels 2133 An attacker could guess values for packet numbers or Key Phase and 2134 have an endpoint confirm guesses through timing side channels. 2135 Similarly, guesses for the packet number length can be tried and 2136 exposed. If the recipient of a packet discards packets with 2137 duplicate packet numbers without attempting to remove packet 2138 protection they could reveal through timing side-channels that the 2139 packet number matches a received packet. For authentication to be 2140 free from side-channels, the entire process of header protection 2141 removal, packet number recovery, and packet protection removal MUST 2142 be applied together without timing and other side-channels. 2144 For the sending of packets, construction and protection of packet 2145 payloads and packet numbers MUST be free from side-channels that 2146 would reveal the packet number or its encoded size. 2148 During a key update, the time taken to generate new keys could reveal 2149 through timing side-channels that a key update has occurred. 2150 Alternatively, where an attacker injects packets this side-channel 2151 could reveal the value of the Key Phase on injected packets. After 2152 receiving a key update, an endpoint SHOULD generate and save the next 2153 set of receive packet protection keys, as described in Section 6.3. 2155 By generating new keys before a key update is received, receipt of 2156 packets will not create timing signals that leak the value of the Key 2157 Phase. 2159 This depends on not doing this key generation during packet 2160 processing and it can require that endpoints maintain three sets of 2161 packet protection keys for receiving: for the previous key phase, for 2162 the current key phase, and for the next key phase. Endpoints can 2163 instead choose to defer generation of the next receive packet 2164 protection keys until they discard old keys so that only two sets of 2165 receive keys need to be retained at any point in time. 2167 9.6. Key Diversity 2169 In using TLS, the central key schedule of TLS is used. As a result 2170 of the TLS handshake messages being integrated into the calculation 2171 of secrets, the inclusion of the QUIC transport parameters extension 2172 ensures that handshake and 1-RTT keys are not the same as those that 2173 might be produced by a server running TLS over TCP. To avoid the 2174 possibility of cross-protocol key synchronization, additional 2175 measures are provided to improve key separation. 2177 The QUIC packet protection keys and IVs are derived using a different 2178 label than the equivalent keys in TLS. 2180 To preserve this separation, a new version of QUIC SHOULD define new 2181 labels for key derivation for packet protection key and IV, plus the 2182 header protection keys. This version of QUIC uses the string "quic". 2183 Other versions can use a version-specific label in place of that 2184 string. 2186 The initial secrets use a key that is specific to the negotiated QUIC 2187 version. New QUIC versions SHOULD define a new salt value used in 2188 calculating initial secrets. 2190 9.7. Randomness 2192 QUIC depends on endpoints being able to generate secure random 2193 numbers, both directly for protocol values such as the connection ID, 2194 and transitively via TLS. See [RFC4086] for guidance on secure 2195 random number generation. 2197 10. IANA Considerations 2199 IANA has registered a codepoint of 57 (or 0x39) for the 2200 quic_transport_parameters extension (defined in Section 8.2) in the 2201 TLS ExtensionType Values Registry [TLS-REGISTRIES]. 2203 The Recommended column for this extension is marked Yes. The TLS 1.3 2204 Column includes CH and EE. 2206 11. References 2208 11.1. Normative References 2210 [AEAD] McGrew, D., "An Interface and Algorithms for Authenticated 2211 Encryption", RFC 5116, DOI 10.17487/RFC5116, January 2008, 2212 . 2214 [AES] "Advanced encryption standard (AES)", National Institute 2215 of Standards and Technology report, 2216 DOI 10.6028/nist.fips.197, November 2001, 2217 . 2219 [ALPN] Friedl, S., Popov, A., Langley, A., and E. Stephan, 2220 "Transport Layer Security (TLS) Application-Layer Protocol 2221 Negotiation Extension", RFC 7301, DOI 10.17487/RFC7301, 2222 July 2014, . 2224 [CHACHA] Nir, Y. and A. Langley, "ChaCha20 and Poly1305 for IETF 2225 Protocols", RFC 8439, DOI 10.17487/RFC8439, June 2018, 2226 . 2228 [HKDF] Krawczyk, H. and P. Eronen, "HMAC-based Extract-and-Expand 2229 Key Derivation Function (HKDF)", RFC 5869, 2230 DOI 10.17487/RFC5869, May 2010, 2231 . 2233 [QUIC-RECOVERY] 2234 Iyengar, J., Ed. and I. Swett, Ed., "QUIC Loss Detection 2235 and Congestion Control", Work in Progress, Internet-Draft, 2236 draft-ietf-quic-recovery-34, 15 January 2021, 2237 . 2239 [QUIC-TRANSPORT] 2240 Iyengar, J., Ed. and M. Thomson, Ed., "QUIC: A UDP-Based 2241 Multiplexed and Secure Transport", Work in Progress, 2242 Internet-Draft, draft-ietf-quic-transport-34, 15 January 2243 2021, . 2246 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2247 Requirement Levels", BCP 14, RFC 2119, 2248 DOI 10.17487/RFC2119, March 1997, 2249 . 2251 [RFC4086] Eastlake 3rd, D., Schiller, J., and S. Crocker, 2252 "Randomness Requirements for Security", BCP 106, RFC 4086, 2253 DOI 10.17487/RFC4086, June 2005, 2254 . 2256 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2257 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2258 May 2017, . 2260 [SHA] Dang, Q., "Secure Hash Standard", National Institute of 2261 Standards and Technology report, 2262 DOI 10.6028/nist.fips.180-4, July 2015, 2263 . 2265 [TLS-REGISTRIES] 2266 Salowey, J. and S. Turner, "IANA Registry Updates for TLS 2267 and DTLS", RFC 8447, DOI 10.17487/RFC8447, August 2018, 2268 . 2270 [TLS13] Rescorla, E., "The Transport Layer Security (TLS) Protocol 2271 Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, 2272 . 2274 11.2. Informative References 2276 [AEBounds] Luykx, A. and K. Paterson, "Limits on Authenticated 2277 Encryption Use in TLS", 8 March 2016, 2278 . 2280 [ASCII] Cerf, V., "ASCII format for network interchange", STD 80, 2281 RFC 20, DOI 10.17487/RFC0020, October 1969, 2282 . 2284 [CCM-ANALYSIS] 2285 Jonsson, J., "On the Security of CTR + CBC-MAC", Selected 2286 Areas in Cryptography pp. 76-93, 2287 DOI 10.1007/3-540-36492-7_7, 2003, 2288 . 2290 [COMPRESS] Ghedini, A. and V. Vasiliev, "TLS Certificate 2291 Compression", Work in Progress, Internet-Draft, draft- 2292 ietf-tls-certificate-compression-10, 6 January 2020, 2293 . 2296 [GCM-MU] Hoang, V., Tessaro, S., and A. Thiruvengadam, "The Multi- 2297 user Security of GCM, Revisited: Tight Bounds for Nonce 2298 Randomization", Proceedings of the 2018 ACM SIGSAC 2299 Conference on Computer and Communications Security, 2300 DOI 10.1145/3243734.3243816, January 2018, 2301 . 2303 [HTTP-REPLAY] 2304 Thomson, M., Nottingham, M., and W. Tarreau, "Using Early 2305 Data in HTTP", RFC 8470, DOI 10.17487/RFC8470, September 2306 2018, . 2308 [HTTP2-TLS13] 2309 Benjamin, D., "Using TLS 1.3 with HTTP/2", RFC 8740, 2310 DOI 10.17487/RFC8740, February 2020, 2311 . 2313 [IMC] Katz, J. and Y. Lindell, "Introduction to Modern 2314 Cryptography, Second Edition", ISBN 978-1466570269, 6 2315 November 2014. 2317 [NAN] Bellare, M., Ng, R., and B. Tackmann, "Nonces Are Noticed: 2318 AEAD Revisited", Advances in Cryptology - CRYPTO 2019 pp. 2319 235-265, DOI 10.1007/978-3-030-26948-7_9, 2019, 2320 . 2322 [QUIC-HTTP] 2323 Bishop, M., Ed., "Hypertext Transfer Protocol Version 3 2324 (HTTP/3)", Work in Progress, Internet-Draft, draft-ietf- 2325 quic-http-33, 15 January 2021, 2326 . 2328 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, 2329 DOI 10.17487/RFC2818, May 2000, 2330 . 2332 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 2333 Housley, R., and W. Polk, "Internet X.509 Public Key 2334 Infrastructure Certificate and Certificate Revocation List 2335 (CRL) Profile", RFC 5280, DOI 10.17487/RFC5280, May 2008, 2336 . 2338 [ROBUST] Fischlin, M., Günther, F., and C. Janson, "Robust 2339 Channels: Handling Unreliable Networks in the Record 2340 Layers of QUIC and DTLS 1.3", 16 May 2020, 2341 . 2343 Appendix A. Sample Packet Protection 2345 This section shows examples of packet protection so that 2346 implementations can be verified incrementally. Samples of Initial 2347 packets from both client and server, plus a Retry packet are defined. 2348 These packets use an 8-byte client-chosen Destination Connection ID 2349 of 0x8394c8f03e515708. Some intermediate values are included. All 2350 values are shown in hexadecimal. 2352 A.1. Keys 2354 The labels generated during the execution of the HKDF-Expand-Label 2355 function (that is, HkdfLabel.label) and part of the value given to 2356 the HKDF-Expand function in order to produce its output are: 2358 client in: 00200f746c73313320636c69656e7420696e00 2360 server in: 00200f746c7331332073657276657220696e00 2362 quic key: 00100e746c7331332071756963206b657900 2364 quic iv: 000c0d746c733133207175696320697600 2366 quic hp: 00100d746c733133207175696320687000 2368 The initial secret is common: 2370 initial_secret = HKDF-Extract(initial_salt, cid) 2371 = 7db5df06e7a69e432496adedb0085192 2372 3595221596ae2ae9fb8115c1e9ed0a44 2374 The secrets for protecting client packets are: 2376 client_initial_secret 2377 = HKDF-Expand-Label(initial_secret, "client in", "", 32) 2378 = c00cf151ca5be075ed0ebfb5c80323c4 2379 2d6b7db67881289af4008f1f6c357aea 2381 key = HKDF-Expand-Label(client_initial_secret, "quic key", "", 16) 2382 = 1f369613dd76d5467730efcbe3b1a22d 2384 iv = HKDF-Expand-Label(client_initial_secret, "quic iv", "", 12) 2385 = fa044b2f42a3fd3b46fb255c 2387 hp = HKDF-Expand-Label(client_initial_secret, "quic hp", "", 16) 2388 = 9f50449e04a0e810283a1e9933adedd2 2390 The secrets for protecting server packets are: 2392 server_initial_secret 2393 = HKDF-Expand-Label(initial_secret, "server in", "", 32) 2394 = 3c199828fd139efd216c155ad844cc81 2395 fb82fa8d7446fa7d78be803acdda951b 2397 key = HKDF-Expand-Label(server_initial_secret, "quic key", "", 16) 2398 = cf3a5331653c364c88f0f379b6067e37 2400 iv = HKDF-Expand-Label(server_initial_secret, "quic iv", "", 12) 2401 = 0ac1493ca1905853b0bba03e 2403 hp = HKDF-Expand-Label(server_initial_secret, "quic hp", "", 16) 2404 = c206b8d9b9f0f37644430b490eeaa314 2406 A.2. Client Initial 2408 The client sends an Initial packet. The unprotected payload of this 2409 packet contains the following CRYPTO frame, plus enough PADDING 2410 frames to make a 1162-byte payload: 2412 060040f1010000ed0303ebf8fa56f129 39b9584a3896472ec40bb863cfd3e868 2413 04fe3a47f06a2b69484c000004130113 02010000c000000010000e00000b6578 2414 616d706c652e636f6dff01000100000a 00080006001d00170018001000070005 2415 04616c706e0005000501000000000033 00260024001d00209370b2c9caa47fba 2416 baf4559fedba753de171fa71f50f1ce1 5d43e994ec74d748002b000302030400 2417 0d0010000e0403050306030203080408 050806002d00020101001c0002400100 2418 3900320408ffffffffffffffff050480 00ffff07048000ffff08011001048000 2419 75300901100f088394c8f03e51570806 048000ffff 2421 The unprotected header indicates a length of 1182 bytes: the 4-byte 2422 packet number, 1162 bytes of frames, and the 16-byte authentication 2423 tag. The header includes the connection ID and a packet number of 2: 2425 c300000001088394c8f03e5157080000449e00000002 2427 Protecting the payload produces output that is sampled for header 2428 protection. Because the header uses a 4-byte packet number encoding, 2429 the first 16 bytes of the protected payload is sampled, then applied 2430 to the header: 2432 sample = d1b1c98dd7689fb8ec11d242b123dc9b 2434 mask = AES-ECB(hp, sample)[0..4] 2435 = 437b9aec36 2437 header[0] ^= mask[0] & 0x0f 2438 = c0 2439 header[18..21] ^= mask[1..4] 2440 = 7b9aec34 2441 header = c000000001088394c8f03e5157080000449e7b9aec34 2443 The resulting protected packet is: 2445 c000000001088394c8f03e5157080000 449e7b9aec34d1b1c98dd7689fb8ec11 2446 d242b123dc9bd8bab936b47d92ec356c 0bab7df5976d27cd449f63300099f399 2447 1c260ec4c60d17b31f8429157bb35a12 82a643a8d2262cad67500cadb8e7378c 2448 8eb7539ec4d4905fed1bee1fc8aafba1 7c750e2c7ace01e6005f80fcb7df6212 2449 30c83711b39343fa028cea7f7fb5ff89 eac2308249a02252155e2347b63d58c5 2450 457afd84d05dfffdb20392844ae81215 4682e9cf012f9021a6f0be17ddd0c208 2451 4dce25ff9b06cde535d0f920a2db1bf3 62c23e596d11a4f5a6cf3948838a3aec 2452 4e15daf8500a6ef69ec4e3feb6b1d98e 610ac8b7ec3faf6ad760b7bad1db4ba3 2453 485e8a94dc250ae3fdb41ed15fb6a8e5 eba0fc3dd60bc8e30c5c4287e53805db 2454 059ae0648db2f64264ed5e39be2e20d8 2df566da8dd5998ccabdae053060ae6c 2455 7b4378e846d29f37ed7b4ea9ec5d82e7 961b7f25a9323851f681d582363aa5f8 2456 9937f5a67258bf63ad6f1a0b1d96dbd4 faddfcefc5266ba6611722395c906556 2457 be52afe3f565636ad1b17d508b73d874 3eeb524be22b3dcbc2c7468d54119c74 2458 68449a13d8e3b95811a198f3491de3e7 fe942b330407abf82a4ed7c1b311663a 2459 c69890f4157015853d91e923037c227a 33cdd5ec281ca3f79c44546b9d90ca00 2460 f064c99e3dd97911d39fe9c5d0b23a22 9a234cb36186c4819e8b9c5927726632 2461 291d6a418211cc2962e20fe47feb3edf 330f2c603a9d48c0fcb5699dbfe58964 2462 25c5bac4aee82e57a85aaf4e2513e4f0 5796b07ba2ee47d80506f8d2c25e50fd 2463 14de71e6c418559302f939b0e1abd576 f279c4b2e0feb85c1f28ff18f58891ff 2464 ef132eef2fa09346aee33c28eb130ff2 8f5b766953334113211996d20011a198 2465 e3fc433f9f2541010ae17c1bf202580f 6047472fb36857fe843b19f5984009dd 2466 c324044e847a4f4a0ab34f719595de37 252d6235365e9b84392b061085349d73 2467 203a4a13e96f5432ec0fd4a1ee65accd d5e3904df54c1da510b0ff20dcc0c77f 2468 cb2c0e0eb605cb0504db87632cf3d8b4 dae6e705769d1de354270123cb11450e 2469 fc60ac47683d7b8d0f811365565fd98c 4c8eb936bcab8d069fc33bd801b03ade 2470 a2e1fbc5aa463d08ca19896d2bf59a07 1b851e6c239052172f296bfb5e724047 2471 90a2181014f3b94a4e97d117b4381303 68cc39dbb2d198065ae3986547926cd2 2472 162f40a29f0c3c8745c0f50fba3852e5 66d44575c29d39a03f0cda721984b6f4 2473 40591f355e12d439ff150aab7613499d bd49adabc8676eef023b15b65bfc5ca0 2474 6948109f23f350db82123535eb8a7433 bdabcb909271a6ecbcb58b936a88cd4e 2475 8f2e6ff5800175f113253d8fa9ca8885 c2f552e657dc603f252e1a8e308f76f0 2476 be79e2fb8f5d5fbbe2e30ecadd220723 c8c0aea8078cdfcb3868263ff8f09400 2477 54da48781893a7e49ad5aff4af300cd8 04a6b6279ab3ff3afb64491c85194aab 2478 760d58a606654f9f4400e8b38591356f bf6425aca26dc85244259ff2b19c41b9 2479 f96f3ca9ec1dde434da7d2d392b905dd f3d1f9af93d1af5950bd493f5aa731b4 2480 056df31bd267b6b90a079831aaf579be 0a39013137aac6d404f518cfd4684064 2481 7e78bfe706ca4cf5e9c5453e9f7cfd2b 8b4c8d169a44e55c88d4a9a7f9474241 2482 e221af44860018ab0856972e194cd934 2484 A.3. Server Initial 2486 The server sends the following payload in response, including an ACK 2487 frame, a CRYPTO frame, and no PADDING frames: 2489 02000000000600405a020000560303ee fce7f7b37ba1d1632e96677825ddf739 2490 88cfc79825df566dc5430b9a045a1200 130100002e00330024001d00209d3c94 2491 0d89690b84d08a60993c144eca684d10 81287c834d5311bcf32bb9da1a002b00 2492 020304 2493 The header from the server includes a new connection ID and a 2-byte 2494 packet number encoding for a packet number of 1: 2496 c1000000010008f067a5502a4262b50040750001 2498 As a result, after protection, the header protection sample is taken 2499 starting from the third protected byte: 2501 sample = 2cd0991cd25b0aac406a5816b6394100 2502 mask = 2ec0d8356a 2503 header = cf000000010008f067a5502a4262b5004075c0d9 2505 The final protected packet is then: 2507 cf000000010008f067a5502a4262b500 4075c0d95a482cd0991cd25b0aac406a 2508 5816b6394100f37a1c69797554780bb3 8cc5a99f5ede4cf73c3ec2493a1839b3 2509 dbcba3f6ea46c5b7684df3548e7ddeb9 c3bf9c73cc3f3bded74b562bfb19fb84 2510 022f8ef4cdd93795d77d06edbb7aaf2f 58891850abbdca3d20398c276456cbc4 2511 2158407dd074ee 2513 A.4. Retry 2515 This shows a Retry packet that might be sent in response to the 2516 Initial packet in Appendix A.2. The integrity check includes the 2517 client-chosen connection ID value of 0x8394c8f03e515708, but that 2518 value is not included in the final Retry packet: 2520 ff000000010008f067a5502a4262b574 6f6b656e04a265ba2eff4d829058fb3f 2521 0f2496ba 2523 A.5. ChaCha20-Poly1305 Short Header Packet 2525 This example shows some of the steps required to protect a packet 2526 with a short header. This example uses AEAD_CHACHA20_POLY1305. 2528 In this example, TLS produces an application write secret from which 2529 a server uses HKDF-Expand-Label to produce four values: a key, an IV, 2530 a header protection key, and the secret that will be used after keys 2531 are updated (this last value is not used further in this example). 2533 secret 2534 = 9ac312a7f877468ebe69422748ad00a1 2535 5443f18203a07d6060f688f30f21632b 2537 key = HKDF-Expand-Label(secret, "quic key", "", 32) 2538 = c6d98ff3441c3fe1b2182094f69caa2e 2539 d4b716b65488960a7a984979fb23e1c8 2541 iv = HKDF-Expand-Label(secret, "quic iv", "", 12) 2542 = e0459b3474bdd0e44a41c144 2544 hp = HKDF-Expand-Label(secret, "quic hp", "", 32) 2545 = 25a282b9e82f06f21f488917a4fc8f1b 2546 73573685608597d0efcb076b0ab7a7a4 2548 ku = HKDF-Expand-Label(secret, "quic ku", "", 32) 2549 = 1223504755036d556342ee9361d25342 2550 1a826c9ecdf3c7148684b36b714881f9 2552 The following shows the steps involved in protecting a minimal packet 2553 with an empty Destination Connection ID. This packet contains a 2554 single PING frame (that is, a payload of just 0x01) and has a packet 2555 number of 654360564. In this example, using a packet number of 2556 length 3 (that is, 49140 is encoded) avoids having to pad the payload 2557 of the packet; PADDING frames would be needed if the packet number is 2558 encoded on fewer bytes. 2560 pn = 654360564 (decimal) 2561 nonce = e0459b3474bdd0e46d417eb0 2562 unprotected header = 4200bff4 2563 payload plaintext = 01 2564 payload ciphertext = 655e5cd55c41f69080575d7999c25a5bfb 2566 The resulting ciphertext is the minimum size possible. One byte is 2567 skipped to produce the sample for header protection. 2569 sample = 5e5cd55c41f69080575d7999c25a5bfb 2570 mask = aefefe7d03 2571 header = 4cfe4189 2573 The protected packet is the smallest possible packet size of 21 2574 bytes. 2576 packet = 4cfe4189655e5cd55c41f69080575d7999c25a5bfb 2578 Appendix B. AEAD Algorithm Analysis 2580 This section documents analyses used in deriving AEAD algorithm 2581 limits for AEAD_AES_128_GCM, AEAD_AES_128_CCM, and AEAD_AES_256_GCM. 2582 The analyses that follow use symbols for multiplication (*), division 2583 (/), and exponentiation (^), plus parentheses for establishing 2584 precedence. The following symbols are also used: 2586 t: The size of the authentication tag in bits. For these ciphers, t 2587 is 128. 2589 n: The size of the block function in bits. For these ciphers, n is 2590 128. 2592 k: The size of the key in bits. This is 128 for AEAD_AES_128_GCM 2593 and AEAD_AES_128_CCM; 256 for AEAD_AES_256_GCM. 2595 l: The number of blocks in each packet (see below). 2597 q: The number of genuine packets created and protected by endpoints. 2598 This value is the bound on the number of packets that can be 2599 protected before updating keys. 2601 v: The number of forged packets that endpoints will accept. This 2602 value is the bound on the number of forged packets that an 2603 endpoint can reject before updating keys. 2605 o: The amount of offline ideal cipher queries made by an adversary. 2607 The analyses that follow rely on a count of the number of block 2608 operations involved in producing each message. This analysis is 2609 performed for packets of size up to 2^11 (l = 2^7) and 2^16 (l = 2610 2^12). A size of 2^11 is expected to be a limit that matches common 2611 deployment patterns, whereas the 2^16 is the maximum possible size of 2612 a QUIC packet. Only endpoints that strictly limit packet size can 2613 use the larger confidentiality and integrity limits that are derived 2614 using the smaller packet size. 2616 For AEAD_AES_128_GCM and AEAD_AES_256_GCM, the message length (l) is 2617 the length of the associated data in blocks plus the length of the 2618 plaintext in blocks. 2620 For AEAD_AES_128_CCM, the total number of block cipher operations is 2621 the sum of: the length of the associated data in blocks, the length 2622 of the ciphertext in blocks, the length of the plaintext in blocks, 2623 plus 1. In this analysis, this is simplified to a value of twice the 2624 length of the packet in blocks (that is, "2l = 2^8" for packets that 2625 are limited to 2^11 bytes, or "2l = 2^13" otherwise). This 2626 simplification is based on the packet containing all of the 2627 associated data and ciphertext. This results in a 1 to 3 block 2628 overestimation of the number of operations per packet. 2630 B.1. Analysis of AEAD_AES_128_GCM and AEAD_AES_256_GCM Usage Limits 2632 [GCM-MU] specify concrete bounds for AEAD_AES_128_GCM and 2633 AEAD_AES_256_GCM as used in TLS 1.3 and QUIC. This section documents 2634 this analysis using several simplifying assumptions: 2636 * The number of ciphertext blocks an attacker uses in forgery 2637 attempts is bounded by v * l, the number of forgery attempts and 2638 the size of each packet (in blocks). 2640 * The amount of offline work done by an attacker does not dominate 2641 other factors in the analysis. 2643 The bounds in [GCM-MU] are tighter and more complete than those used 2644 in [AEBounds], which allows for larger limits than those described in 2645 [TLS13]. 2647 B.1.1. Confidentiality Limit 2649 For confidentiality, Theorum (4.3) in [GCM-MU] establishes that - for 2650 a single user that does not repeat nonces - the dominant term in 2651 determining the distinguishing advantage between a real and random 2652 AEAD algorithm gained by an attacker is: 2654 2 * (q * l)^2 / 2^n 2656 For a target advantage of 2^-57, this results in the relation: 2658 q <= 2^35 / l 2660 Thus, endpoints that do not send packets larger than 2^11 bytes 2661 cannot protect more than 2^28 packets in a single connection without 2662 causing an attacker to gain an larger advantage than the target of 2663 2^-57. The limit for endpoints that allow for the packet size to be 2664 as large as 2^16 is instead 2^23. 2666 B.1.2. Integrity Limit 2668 For integrity, Theorem (4.3) in [GCM-MU] establishes that an attacker 2669 gains an advantage in successfully forging a packet of no more than: 2671 (1 / 2^(8 * n)) + ((2 * v) / 2^(2 * n)) 2672 + ((2 * o * v) / 2^(k + n)) + (n * (v + (v * l)) / 2^k) 2674 The goal is to limit this advantage to 2^-57. For AEAD_AES_128_GCM, 2675 the fourth term in this inequality dominates the rest, so the others 2676 can be removed without significant effect on the result. This 2677 produces the following approximation: 2679 v <= 2^64 / l 2681 Endpoints that do not attempt to remove protection from packets 2682 larger than 2^11 bytes can attempt to remove protection from at most 2683 2^57 packets. Endpoints that do not restrict the size of processed 2684 packets can attempt to remove protection from at most 2^52 packets. 2686 For AEAD_AES_256_GCM, the same term dominates, but the larger value 2687 of k produces the following approximation: 2689 v <= 2^192 / l 2691 This is substantially larger than the limit for AEAD_AES_128_GCM. 2692 However, this document recommends that the same limit be applied to 2693 both functions as either limit is acceptably large. 2695 B.2. Analysis of AEAD_AES_128_CCM Usage Limits 2697 TLS [TLS13] and [AEBounds] do not specify limits on usage for 2698 AEAD_AES_128_CCM. However, any AEAD that is used with QUIC requires 2699 limits on use that ensure that both confidentiality and integrity are 2700 preserved. This section documents that analysis. 2702 [CCM-ANALYSIS] is used as the basis of this analysis. The results of 2703 that analysis are used to derive usage limits that are based on those 2704 chosen in [TLS13]. 2706 For confidentiality, Theorem 2 in [CCM-ANALYSIS] establishes that an 2707 attacker gains a distinguishing advantage over an ideal pseudorandom 2708 permutation (PRP) of no more than: 2710 (2l * q)^2 / 2^n 2712 The integrity limit in Theorem 1 in [CCM-ANALYSIS] provides an 2713 attacker a strictly higher advantage for the same number of messages. 2714 As the targets for the confidentiality advantage and the integrity 2715 advantage are the same, only Theorem 1 needs to be considered. 2717 Theorem 1 establishes that an attacker gains an advantage over an 2718 ideal PRP of no more than: 2720 v / 2^t + (2l * (v + q))^2 / 2^n 2721 As "t" and "n" are both 128, the first term is negligible relative to 2722 the second, so that term can be removed without a significant effect 2723 on the result. 2725 This produces a relation that combines both encryption and decryption 2726 attempts with the same limit as that produced by the theorem for 2727 confidentiality alone. For a target advantage of 2^-57, this results 2728 in: 2730 v + q <= 2^34.5 / l 2732 By setting "q = v", values for both confidentiality and integrity 2733 limits can be produced. Endpoints that limit packets to 2^11 bytes 2734 therefore have both confidentiality and integrity limits of 2^26.5 2735 packets. Endpoints that do not restrict packet size have a limit of 2736 2^21.5. 2738 Appendix C. Change Log 2740 *RFC Editor's Note:* Please remove this section prior to 2741 publication of a final version of this document. 2743 Issue and pull request numbers are listed with a leading octothorp. 2745 C.1. Since draft-ietf-quic-tls-32 2747 * Added final values for Initial key derivation, Retry 2748 authentication, and TLS extension type for the QUIC Transport 2749 Parameters extension (#4431) (#4431) 2751 * Corrected rules for handling of 0-RTT (#4393, #4394) 2753 C.2. Since draft-ietf-quic-tls-31 2755 * Packet protection limits are based on maximum-sized packets; 2756 improved analysis (#3701, #4175) 2758 C.3. Since draft-ietf-quic-tls-30 2760 * Add a new error code for AEAD_LIMIT_REACHED code to avoid conflict 2761 (#4087, #4088) 2763 C.4. Since draft-ietf-quic-tls-29 2765 * Updated limits on packet protection (#3788, #3789) 2767 * Allow for packet processing to continue while waiting for TLS to 2768 provide keys (#3821, #3874) 2770 C.5. Since draft-ietf-quic-tls-28 2772 * Defined limits on the number of packets that can be protected with 2773 a single key and limits on the number of packets that can fail 2774 authentication (#3619, #3620) 2776 * Update Initial salt, Retry keys, and samples (#3711) 2778 C.6. Since draft-ietf-quic-tls-27 2780 * Allowed CONNECTION_CLOSE in any packet number space, with 2781 restrictions on use of the application-specific variant (#3430, 2782 #3435, #3440) 2784 * Prohibit the use of the compatibility mode from TLS 1.3 (#3594, 2785 #3595) 2787 C.7. Since draft-ietf-quic-tls-26 2789 * No changes 2791 C.8. Since draft-ietf-quic-tls-25 2793 * No changes 2795 C.9. Since draft-ietf-quic-tls-24 2797 * Rewrite key updates (#3050) 2799 - Allow but don't recommend deferring key updates (#2792, #3263) 2801 - More completely define received behavior (#2791) 2803 - Define the label used with HKDF-Expand-Label (#3054) 2805 C.10. Since draft-ietf-quic-tls-23 2807 * Key update text update (#3050): 2809 - Recommend constant-time key replacement (#2792) 2811 - Provide explicit labels for key update key derivation (#3054) 2813 * Allow first Initial from a client to span multiple packets (#2928, 2814 #3045) 2816 * PING can be sent at any encryption level (#3034, #3035) 2818 C.11. Since draft-ietf-quic-tls-22 2820 * Update the salt used for Initial secrets (#2887, #2980) 2822 C.12. Since draft-ietf-quic-tls-21 2824 * No changes 2826 C.13. Since draft-ietf-quic-tls-20 2828 * Mandate the use of the QUIC transport parameters extension (#2528, 2829 #2560) 2831 * Define handshake completion and confirmation; define clearer rules 2832 when it encryption keys should be discarded (#2214, #2267, #2673) 2834 C.14. Since draft-ietf-quic-tls-18 2836 * Increased the set of permissible frames in 0-RTT (#2344, #2355) 2838 * Transport parameter extension is mandatory (#2528, #2560) 2840 C.15. Since draft-ietf-quic-tls-17 2842 * Endpoints discard initial keys as soon as handshake keys are 2843 available (#1951, #2045) 2845 * Use of ALPN or equivalent is mandatory (#2263, #2284) 2847 C.16. Since draft-ietf-quic-tls-14 2849 * Update the salt used for Initial secrets (#1970) 2851 * Clarify that TLS_AES_128_CCM_8_SHA256 isn't supported (#2019) 2853 * Change header protection 2855 - Sample from a fixed offset (#1575, #2030) 2857 - Cover part of the first byte, including the key phase (#1322, 2858 #2006) 2860 * TLS provides an AEAD and KDF function (#2046) 2862 - Clarify that the TLS KDF is used with TLS (#1997) 2864 - Change the labels for calculation of QUIC keys (#1845, #1971, 2865 #1991) 2867 * Initial keys are discarded once Handshake keys are available 2868 (#1951, #2045) 2870 C.17. Since draft-ietf-quic-tls-13 2872 * Updated to TLS 1.3 final (#1660) 2874 C.18. Since draft-ietf-quic-tls-12 2876 * Changes to integration of the TLS handshake (#829, #1018, #1094, 2877 #1165, #1190, #1233, #1242, #1252, #1450) 2879 - The cryptographic handshake uses CRYPTO frames, not stream 0 2881 - QUIC packet protection is used in place of TLS record 2882 protection 2884 - Separate QUIC packet number spaces are used for the handshake 2886 - Changed Retry to be independent of the cryptographic handshake 2888 - Limit the use of HelloRetryRequest to address TLS needs (like 2889 key shares) 2891 * Changed codepoint of TLS extension (#1395, #1402) 2893 C.19. Since draft-ietf-quic-tls-11 2895 * Encrypted packet numbers. 2897 C.20. Since draft-ietf-quic-tls-10 2899 * No significant changes. 2901 C.21. Since draft-ietf-quic-tls-09 2903 * Cleaned up key schedule and updated the salt used for handshake 2904 packet protection (#1077) 2906 C.22. Since draft-ietf-quic-tls-08 2908 * Specify value for max_early_data_size to enable 0-RTT (#942) 2910 * Update key derivation function (#1003, #1004) 2912 C.23. Since draft-ietf-quic-tls-07 2913 * Handshake errors can be reported with CONNECTION_CLOSE (#608, 2914 #891) 2916 C.24. Since draft-ietf-quic-tls-05 2918 No significant changes. 2920 C.25. Since draft-ietf-quic-tls-04 2922 * Update labels used in HKDF-Expand-Label to match TLS 1.3 (#642) 2924 C.26. Since draft-ietf-quic-tls-03 2926 No significant changes. 2928 C.27. Since draft-ietf-quic-tls-02 2930 * Updates to match changes in transport draft 2932 C.28. Since draft-ietf-quic-tls-01 2934 * Use TLS alerts to signal TLS errors (#272, #374) 2936 * Require ClientHello to fit in a single packet (#338) 2938 * The second client handshake flight is now sent in the clear (#262, 2939 #337) 2941 * The QUIC header is included as AEAD Associated Data (#226, #243, 2942 #302) 2944 * Add interface necessary for client address validation (#275) 2946 * Define peer authentication (#140) 2948 * Require at least TLS 1.3 (#138) 2950 * Define transport parameters as a TLS extension (#122) 2952 * Define handling for protected packets before the handshake 2953 completes (#39) 2955 * Decouple QUIC version and ALPN (#12) 2957 C.29. Since draft-ietf-quic-tls-00 2959 * Changed bit used to signal key phase 2960 * Updated key phase markings during the handshake 2962 * Added TLS interface requirements section 2964 * Moved to use of TLS exporters for key derivation 2966 * Moved TLS error code definitions into this document 2968 C.30. Since draft-thomson-quic-tls-01 2970 * Adopted as base for draft-ietf-quic-tls 2972 * Updated authors/editors list 2974 * Added status note 2976 Contributors 2978 The IETF QUIC Working Group received an enormous amount of support 2979 from many people. The following people provided substantive 2980 contributions to this document: 2982 * Adam Langley 2984 * Alessandro Ghedini 2986 * Christian Huitema 2988 * Christopher Wood 2990 * David Schinazi 2992 * Dragana Damjanovic 2994 * Eric Rescorla 2996 * Felix Guenther 2998 * Ian Swett 3000 * Jana Iyengar 3002 * 奥 一穂 (Kazuho Oku) 3004 * Marten Seemann 3006 * Martin Duke 3007 * Mike Bishop 3009 * Mikkel Fahnøe Jørgensen 3011 * Nick Banks 3013 * Nick Harper 3015 * Roberto Peon 3017 * Rui Paulo 3019 * Ryan Hamilton 3021 * Victor Vasiliev 3023 Authors' Addresses 3025 Martin Thomson (editor) 3026 Mozilla 3028 Email: mt@lowentropy.net 3030 Sean Turner (editor) 3031 sn3rd 3033 Email: sean@sn3rd.com