draft-ietf-quic-tls-16.txt   draft-ietf-quic-tls-latest.txt 
QUIC Working Group M. Thomson, Ed. QUIC Working Group M. Thomson, Ed.
Internet-Draft Mozilla Internet-Draft Mozilla
Intended status: Standards Track S. Turner, Ed. Intended status: Standards Track S. Turner, Ed.
Expires: April 26, 2019 sn3rd Expires: May 21, 2019 sn3rd
October 23, 2018 November 17, 2018
Using Transport Layer Security (TLS) to Secure QUIC Using Transport Layer Security (TLS) to Secure QUIC
draft-ietf-quic-tls-16 draft-ietf-quic-tls-latest
Abstract Abstract
This document describes how Transport Layer Security (TLS) is used to This document describes how Transport Layer Security (TLS) is used to
secure QUIC. secure QUIC.
Note to Readers Note to Readers
Discussion of this draft takes place on the QUIC working group Discussion of this draft takes place on the QUIC working group
mailing list (quic@ietf.org), which is archived at mailing list (quic@ietf.org), which is archived at
skipping to change at page 1, line 42 skipping to change at page 1, line 42
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at https://datatracker.ietf.org/drafts/current/. Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on April 26, 2019. This Internet-Draft will expire on May 21, 2019.
Copyright Notice Copyright Notice
Copyright (c) 2018 IETF Trust and the persons identified as the Copyright (c) 2018 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(https://trustee.ietf.org/license-info) in effect on the date of (https://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
skipping to change at page 2, line 45 skipping to change at page 2, line 45
5.1. Packet Protection Keys . . . . . . . . . . . . . . . . . 16 5.1. Packet Protection Keys . . . . . . . . . . . . . . . . . 16
5.2. Initial Secrets . . . . . . . . . . . . . . . . . . . . . 17 5.2. Initial Secrets . . . . . . . . . . . . . . . . . . . . . 17
5.3. AEAD Usage . . . . . . . . . . . . . . . . . . . . . . . 18 5.3. AEAD Usage . . . . . . . . . . . . . . . . . . . . . . . 18
5.4. Packet Number Protection . . . . . . . . . . . . . . . . 19 5.4. Packet Number Protection . . . . . . . . . . . . . . . . 19
5.4.1. AES-Based Packet Number Protection . . . . . . . . . 20 5.4.1. AES-Based Packet Number Protection . . . . . . . . . 20
5.4.2. ChaCha20-Based Packet Number Protection . . . . . . . 20 5.4.2. ChaCha20-Based Packet Number Protection . . . . . . . 20
5.5. Receiving Protected Packets . . . . . . . . . . . . . . . 20 5.5. Receiving Protected Packets . . . . . . . . . . . . . . . 20
5.6. Use of 0-RTT Keys . . . . . . . . . . . . . . . . . . . . 21 5.6. Use of 0-RTT Keys . . . . . . . . . . . . . . . . . . . . 21
5.7. Receiving Out-of-Order Protected Frames . . . . . . . . . 21 5.7. Receiving Out-of-Order Protected Frames . . . . . . . . . 21
6. Key Update . . . . . . . . . . . . . . . . . . . . . . . . . 22 6. Key Update . . . . . . . . . . . . . . . . . . . . . . . . . 22
7. Security of Initial Messages . . . . . . . . . . . . . . . . 23 7. Security of Initial Messages . . . . . . . . . . . . . . . . 24
8. QUIC-Specific Additions to the TLS Handshake . . . . . . . . 24 8. QUIC-Specific Additions to the TLS Handshake . . . . . . . . 24
8.1. Protocol and Version Negotiation . . . . . . . . . . . . 24 8.1. Protocol and Version Negotiation . . . . . . . . . . . . 24
8.2. QUIC Transport Parameters Extension . . . . . . . . . . . 25 8.2. QUIC Transport Parameters Extension . . . . . . . . . . . 25
8.3. Removing the EndOfEarlyData Message . . . . . . . . . . . 25 8.3. Removing the EndOfEarlyData Message . . . . . . . . . . . 25
9. Security Considerations . . . . . . . . . . . . . . . . . . . 26 9. Security Considerations . . . . . . . . . . . . . . . . . . . 26
9.1. Packet Reflection Attack Mitigation . . . . . . . . . . . 26 9.1. Packet Reflection Attack Mitigation . . . . . . . . . . . 26
9.2. Peer Denial of Service . . . . . . . . . . . . . . . . . 26 9.2. Peer Denial of Service . . . . . . . . . . . . . . . . . 26
9.3. Packet Number Protection Analysis . . . . . . . . . . . . 26 9.3. Packet Number Protection Analysis . . . . . . . . . . . . 27
10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 27 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 28
11. References . . . . . . . . . . . . . . . . . . . . . . . . . 28 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 28
11.1. Normative References . . . . . . . . . . . . . . . . . . 28 11.1. Normative References . . . . . . . . . . . . . . . . . . 28
11.2. Informative References . . . . . . . . . . . . . . . . . 29 11.2. Informative References . . . . . . . . . . . . . . . . . 29
11.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 29 11.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 29 Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 30
A.1. Since draft-ietf-quic-tls-13 . . . . . . . . . . . . . . 30 A.1. Since draft-ietf-quic-tls-13 . . . . . . . . . . . . . . 30
A.2. Since draft-ietf-quic-tls-12 . . . . . . . . . . . . . . 30 A.2. Since draft-ietf-quic-tls-12 . . . . . . . . . . . . . . 30
A.3. Since draft-ietf-quic-tls-11 . . . . . . . . . . . . . . 30 A.3. Since draft-ietf-quic-tls-11 . . . . . . . . . . . . . . 30
A.4. Since draft-ietf-quic-tls-10 . . . . . . . . . . . . . . 30 A.4. Since draft-ietf-quic-tls-10 . . . . . . . . . . . . . . 30
A.5. Since draft-ietf-quic-tls-09 . . . . . . . . . . . . . . 30 A.5. Since draft-ietf-quic-tls-09 . . . . . . . . . . . . . . 30
A.6. Since draft-ietf-quic-tls-08 . . . . . . . . . . . . . . 30 A.6. Since draft-ietf-quic-tls-08 . . . . . . . . . . . . . . 31
A.7. Since draft-ietf-quic-tls-07 . . . . . . . . . . . . . . 31 A.7. Since draft-ietf-quic-tls-07 . . . . . . . . . . . . . . 31
A.8. Since draft-ietf-quic-tls-05 . . . . . . . . . . . . . . 31 A.8. Since draft-ietf-quic-tls-05 . . . . . . . . . . . . . . 31
A.9. Since draft-ietf-quic-tls-04 . . . . . . . . . . . . . . 31 A.9. Since draft-ietf-quic-tls-04 . . . . . . . . . . . . . . 31
A.10. Since draft-ietf-quic-tls-03 . . . . . . . . . . . . . . 31 A.10. Since draft-ietf-quic-tls-03 . . . . . . . . . . . . . . 31
A.11. Since draft-ietf-quic-tls-02 . . . . . . . . . . . . . . 31 A.11. Since draft-ietf-quic-tls-02 . . . . . . . . . . . . . . 31
A.12. Since draft-ietf-quic-tls-01 . . . . . . . . . . . . . . 31 A.12. Since draft-ietf-quic-tls-01 . . . . . . . . . . . . . . 31
A.13. Since draft-ietf-quic-tls-00 . . . . . . . . . . . . . . 32 A.13. Since draft-ietf-quic-tls-00 . . . . . . . . . . . . . . 32
A.14. Since draft-thomson-quic-tls-01 . . . . . . . . . . . . . 32 A.14. Since draft-thomson-quic-tls-01 . . . . . . . . . . . . . 32
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 32 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 32
Contributors . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Contributors . . . . . . . . . . . . . . . . . . . . . . . . . . 32
skipping to change at page 8, line 13 skipping to change at page 8, line 13
associated with establishing the connection can usually appear at any associated with establishing the connection can usually appear at any
encryption level, whereas those associated with transferring data can encryption level, whereas those associated with transferring data can
only appear in the 0-RTT and 1-RTT encryption levels: only appear in the 0-RTT and 1-RTT encryption levels:
o CRYPTO frames MAY appear in packets of any encryption level except o CRYPTO frames MAY appear in packets of any encryption level except
0-RTT. 0-RTT.
o CONNECTION_CLOSE MAY appear in packets of any encryption level o CONNECTION_CLOSE MAY appear in packets of any encryption level
other than 0-RTT. other than 0-RTT.
o APPLICATION_CLOSE MAY appear in packets of any encryption level
other than Initial and 0-RTT.
o PADDING frames MAY appear in packets of any encryption level. o PADDING frames MAY appear in packets of any encryption level.
o ACK frames MAY appear in packets of any encryption level other o ACK frames MAY appear in packets of any encryption level other
than 0-RTT, but can only acknowledge packets which appeared in than 0-RTT, but can only acknowledge packets which appeared in
that packet number space. that packet number space.
o STREAM frames MUST ONLY appear in the 0-RTT and 1-RTT levels. o STREAM frames MUST ONLY appear in the 0-RTT and 1-RTT levels.
o All other frame types MUST only appear at the 1-RTT levels. o All other frame types MUST only appear at the 1-RTT levels.
skipping to change at page 8, line 48 skipping to change at page 8, line 45
| | | | | | | |
| Handshake | Handshake | Handshake | | Handshake | Handshake | Handshake |
| | | | | | | |
| Retry | N/A | N/A | | Retry | N/A | N/A |
| | | | | | | |
| Short Header | 1-RTT | 0/1-RTT | | Short Header | 1-RTT | 0/1-RTT |
+-----------------+------------------+-----------+ +-----------------+------------------+-----------+
Table 1: Encryption Levels by Packet Type Table 1: Encryption Levels by Packet Type
Section 6.5 of [QUIC-TRANSPORT] shows how packets at the various Section 17 of [QUIC-TRANSPORT] shows how packets at the various
encryption levels fit into the handshake process. encryption levels fit into the handshake process.
4.1. Interface to TLS 4.1. Interface to TLS
As shown in Figure 2, the interface from QUIC to TLS consists of As shown in Figure 2, the interface from QUIC to TLS consists of
three primary functions: three primary functions:
o Sending and receiving handshake messages o Sending and receiving handshake messages
o Rekeying (both transmit and receive) o Rekeying (both transmit and receive)
skipping to change at page 9, line 28 skipping to change at page 9, line 28
4.1.1. Sending and Receiving Handshake Messages 4.1.1. Sending and Receiving Handshake Messages
In order to drive the handshake, TLS depends on being able to send In order to drive the handshake, TLS depends on being able to send
and receive handshake messages. There are two basic functions on and receive handshake messages. There are two basic functions on
this interface: one where QUIC requests handshake messages and one this interface: one where QUIC requests handshake messages and one
where QUIC provides handshake packets. where QUIC provides handshake packets.
Before starting the handshake QUIC provides TLS with the transport Before starting the handshake QUIC provides TLS with the transport
parameters (see Section 8.2) that it wishes to carry. parameters (see Section 8.2) that it wishes to carry.
A QUIC client starts TLS by requesting TLS handshake octets from TLS. A QUIC client starts TLS by requesting TLS handshake bytes from TLS.
The client acquires handshake octets before sending its first packet. The client acquires handshake bytes before sending its first packet.
A QUIC server starts the process by providing TLS with the client's A QUIC server starts the process by providing TLS with the client's
handshake octets. handshake bytes.
At any given time, the TLS stack at an endpoint will have a current At any given time, the TLS stack at an endpoint will have a current
sending encryption level and receiving encryption level. Each sending encryption level and receiving encryption level. Each
encryption level is associated with a different flow of bytes, which encryption level is associated with a different flow of bytes, which
is reliably transmitted to the peer in CRYPTO frames. When TLS is reliably transmitted to the peer in CRYPTO frames. When TLS
provides handshake octets to be sent, they are appended to the provides handshake bytes to be sent, they are appended to the current
current flow and any packet that includes the CRYPTO frame is flow and any packet that includes the CRYPTO frame is protected using
protected using keys from the corresponding encryption level. keys from the corresponding encryption level.
QUIC takes the unprotected content of TLS handshake records as the QUIC takes the unprotected content of TLS handshake records as the
content of CRYPTO frames. TLS record protection is not used by QUIC. content of CRYPTO frames. TLS record protection is not used by QUIC.
QUIC assembles CRYPTO frames into QUIC packets, which are protected QUIC assembles CRYPTO frames into QUIC packets, which are protected
using QUIC packet protection. using QUIC packet protection.
When an endpoint receives a QUIC packet containing a CRYPTO frame When an endpoint receives a QUIC packet containing a CRYPTO frame
from the network, it proceeds as follows: from the network, it proceeds as follows:
o If the packet was in the TLS receiving encryption level, sequence o If the packet was in the TLS receiving encryption level, sequence
skipping to change at page 10, line 21 skipping to change at page 10, line 21
violations of this requirement as a connection error of type violations of this requirement as a connection error of type
PROTOCOL_VIOLATION. PROTOCOL_VIOLATION.
o If the packet is from a new encryption level, it is saved for o If the packet is from a new encryption level, it is saved for
later processing by TLS. Once TLS moves to receiving from this later processing by TLS. Once TLS moves to receiving from this
encryption level, saved data can be provided. When providing data encryption level, saved data can be provided. When providing data
from any new encryption level to TLS, if there is data from a from any new encryption level to TLS, if there is data from a
previous encryption level that TLS has not consumed, this MUST be previous encryption level that TLS has not consumed, this MUST be
treated as a connection error of type PROTOCOL_VIOLATION. treated as a connection error of type PROTOCOL_VIOLATION.
Each time that TLS is provided with new data, new handshake octets Each time that TLS is provided with new data, new handshake bytes are
are requested from TLS. TLS might not provide any octets if the requested from TLS. TLS might not provide any bytes if the handshake
handshake messages it has received are incomplete or it has no data messages it has received are incomplete or it has no data to send.
to send.
Once the TLS handshake is complete, this is indicated to QUIC along Once the TLS handshake is complete, this is indicated to QUIC along
with any final handshake octets that TLS needs to send. TLS also with any final handshake bytes that TLS needs to send. TLS also
provides QUIC with the transport parameters that the peer advertised provides QUIC with the transport parameters that the peer advertised
during the handshake. during the handshake.
Once the handshake is complete, TLS becomes passive. TLS can still Once the handshake is complete, TLS becomes passive. TLS can still
receive data from its peer and respond in kind, but it will not need receive data from its peer and respond in kind, but it will not need
to send more data unless specifically requested - either by an to send more data unless specifically requested - either by an
application or QUIC. One reason to send data is that the server application or QUIC. One reason to send data is that the server
might wish to provide additional or updated session tickets to a might wish to provide additional or updated session tickets to a
client. client.
skipping to change at page 11, line 15 skipping to change at page 11, line 14
Finished message in multiple packets. This enables immediate Finished message in multiple packets. This enables immediate
server processing for those packets. server processing for those packets.
4.1.2. Encryption Level Changes 4.1.2. Encryption Level Changes
As keys for new encryption levels become available, TLS provides QUIC As keys for new encryption levels become available, TLS provides QUIC
with those keys. Separately, as TLS starts using keys at a given with those keys. Separately, as TLS starts using keys at a given
encryption level, TLS indicates to QUIC that it is now reading or encryption level, TLS indicates to QUIC that it is now reading or
writing with keys at that encryption level. These events are not writing with keys at that encryption level. These events are not
asynchronous; they always occur immediately after TLS is provided asynchronous; they always occur immediately after TLS is provided
with new handshake octets, or after TLS produces handshake octets. with new handshake bytes, or after TLS produces handshake bytes.
If 0-RTT is possible, it is ready after the client sends a TLS If 0-RTT is possible, it is ready after the client sends a TLS
ClientHello message or the server receives that message. After ClientHello message or the server receives that message. After
providing a QUIC client with the first handshake octets, the TLS providing a QUIC client with the first handshake bytes, the TLS stack
stack might signal the change to 0-RTT keys. On the server, after might signal the change to 0-RTT keys. On the server, after
receiving handshake octets that contain a ClientHello message, a TLS receiving handshake bytes that contain a ClientHello message, a TLS
server might signal that 0-RTT keys are available. server might signal that 0-RTT keys are available.
Although TLS only uses one encryption level at a time, QUIC may use Although TLS only uses one encryption level at a time, QUIC may use
more than one level. For instance, after sending its Finished more than one level. For instance, after sending its Finished
message (using a CRYPTO frame at the Handshake encryption level) an message (using a CRYPTO frame at the Handshake encryption level) an
endpoint can send STREAM data (in 1-RTT encryption). If the Finished endpoint can send STREAM data (in 1-RTT encryption). If the Finished
message is lost, the endpoint uses the Handshake encryption level to message is lost, the endpoint uses the Handshake encryption level to
retransmit the lost message. Reordering or loss of packets can mean retransmit the lost message. Reordering or loss of packets can mean
that QUIC will need to handle packets at multiple encryption levels. that QUIC will need to handle packets at multiple encryption levels.
During the handshake, this means potentially handling packets at During the handshake, this means potentially handling packets at
skipping to change at page 13, line 9 skipping to change at page 13, line 9
QUIC are supported by the newer version. QUIC are supported by the newer version.
A badly configured TLS implementation could negotiate TLS 1.2 or A badly configured TLS implementation could negotiate TLS 1.2 or
another older version of TLS. An endpoint MUST terminate the another older version of TLS. An endpoint MUST terminate the
connection if a version of TLS older than 1.3 is negotiated. connection if a version of TLS older than 1.3 is negotiated.
4.3. ClientHello Size 4.3. ClientHello Size
QUIC requires that the first Initial packet from a client contain an QUIC requires that the first Initial packet from a client contain an
entire cryptographic handshake message, which for TLS is the entire cryptographic handshake message, which for TLS is the
ClientHello. Though a packet larger than 1200 octets might be ClientHello. Though a packet larger than 1200 bytes might be
supported by the path, a client improves the likelihood that a packet supported by the path, a client improves the likelihood that a packet
is accepted if it ensures that the first ClientHello message is small is accepted if it ensures that the first ClientHello message is small
enough to stay within this limit. enough to stay within this limit.
QUIC packet and framing add at least 36 octets of overhead to the QUIC packet and framing add at least 36 bytes of overhead to the
ClientHello message. That overhead increases if the client chooses a ClientHello message. That overhead increases if the client chooses a
connection ID without zero length. Overheads also do not include the connection ID without zero length. Overheads also do not include the
token or a connection ID longer than 8 octets, both of which might be token or a connection ID longer than 8 bytes, both of which might be
required if a server sends a Retry packet. required if a server sends a Retry packet.
A typical TLS ClientHello can easily fit into a 1200 octet packet. A typical TLS ClientHello can easily fit into a 1200 byte packet.
However, in addition to the overheads added by QUIC, there are However, in addition to the overheads added by QUIC, there are
several variables that could cause this limit to be exceeded. Large several variables that could cause this limit to be exceeded. Large
session tickets, multiple or large key shares, and long lists of session tickets, multiple or large key shares, and long lists of
supported ciphers, signature algorithms, versions, QUIC transport supported ciphers, signature algorithms, versions, QUIC transport
parameters, and other negotiable parameters and extensions could parameters, and other negotiable parameters and extensions could
cause this message to grow. cause this message to grow.
For servers, in addition to connection IDs and tokens, the size of For servers, in addition to connection IDs and tokens, the size of
TLS session tickets can have an effect on a client's ability to TLS session tickets can have an effect on a client's ability to
connect. Minimizing the size of these values increases the connect. Minimizing the size of these values increases the
skipping to change at page 14, line 49 skipping to change at page 14, line 49
of 0-RTT. of 0-RTT.
4.7. HelloRetryRequest 4.7. HelloRetryRequest
In TLS over TCP, the HelloRetryRequest feature (see Section 4.1.4 of In TLS over TCP, the HelloRetryRequest feature (see Section 4.1.4 of
[TLS13]) can be used to correct a client's incorrect KeyShare [TLS13]) can be used to correct a client's incorrect KeyShare
extension as well as for a stateless round-trip check. From the extension as well as for a stateless round-trip check. From the
perspective of QUIC, this just looks like additional messages carried perspective of QUIC, this just looks like additional messages carried
in the Initial encryption level. Although it is in principle in the Initial encryption level. Although it is in principle
possible to use this feature for address verification in QUIC, QUIC possible to use this feature for address verification in QUIC, QUIC
implementations SHOULD instead use the Retry feature (see Section 4.4 implementations SHOULD instead use the Retry feature (see Section 8.1
of [QUIC-TRANSPORT]). HelloRetryRequest is still used to request key of [QUIC-TRANSPORT]). HelloRetryRequest is still used to request key
shares. shares.
4.8. TLS Errors 4.8. TLS Errors
If TLS experiences an error, it generates an appropriate alert as If TLS experiences an error, it generates an appropriate alert as
defined in Section 6 of [TLS13]. defined in Section 6 of [TLS13].
A TLS alert is turned into a QUIC connection error by converting the A TLS alert is turned into a QUIC connection error by converting the
one-octet alert description into a QUIC error code. The alert one-byte alert description into a QUIC error code. The alert
description is added to 0x100 to produce a QUIC error code from the description is added to 0x100 to produce a QUIC error code from the
range reserved for CRYPTO_ERROR. The resulting value is sent in a range reserved for CRYPTO_ERROR. The resulting value is sent in a
QUIC CONNECTION_CLOSE frame. QUIC CONNECTION_CLOSE frame.
The alert level of all TLS alerts is "fatal"; a TLS stack MUST NOT The alert level of all TLS alerts is "fatal"; a TLS stack MUST NOT
generate alerts at the "warning" level. generate alerts at the "warning" level.
4.9. Discarding Unused Keys 4.9. Discarding Unused Keys
After QUIC moves to a new encryption level, packet protection keys After QUIC moves to a new encryption level, packet protection keys
skipping to change at page 17, line 19 skipping to change at page 17, line 19
The HKDF-Expand-Label function with a "quic " label is also used to The HKDF-Expand-Label function with a "quic " label is also used to
derive the initial secrets (see Section 5.2) and to derive a packet derive the initial secrets (see Section 5.2) and to derive a packet
number protection key (the "pn" label, see Section 5.4). number protection key (the "pn" label, see Section 5.4).
5.2. Initial Secrets 5.2. Initial Secrets
Initial packets are protected with a secret derived from the Initial packets are protected with a secret derived from the
Destination Connection ID field from the client's first Initial Destination Connection ID field from the client's first Initial
packet of the connection. Specifically: packet of the connection. Specifically:
initial_salt = 0x9c108f98520a5c5c32968e950e8a2c5fe06d6c38 initial_salt = 0xef4fb0abb47470c41befcf8031334fae485e09a0
initial_secret = HKDF-Extract(initial_salt, initial_secret = HKDF-Extract(initial_salt,
client_dst_connection_id) client_dst_connection_id)
client_initial_secret = HKDF-Expand-Label(initial_secret, client_initial_secret = HKDF-Expand-Label(initial_secret,
"client in", "", "client in", "",
Hash.length) Hash.length)
server_initial_secret = HKDF-Expand-Label(initial_secret, server_initial_secret = HKDF-Expand-Label(initial_secret,
"server in", "", "server in", "",
Hash.length) Hash.length)
The hash function for HKDF when deriving initial secrets and keys is The hash function for HKDF when deriving initial secrets and keys is
SHA-256 [SHA]. SHA-256 [SHA].
The connection ID used with HKDF-Expand-Label is the Destination The connection ID used with HKDF-Expand-Label is the Destination
Connection ID in the Initial packet sent by the client. This will be Connection ID in the Initial packet sent by the client. This will be
a randomly-selected value unless the client creates the Initial a randomly-selected value unless the client creates the Initial
packet after receiving a Retry packet, where the Destination packet after receiving a Retry packet, where the Destination
Connection ID is selected by the server. Connection ID is selected by the server.
The value of initial_salt is a 20 octet sequence shown in the figure The value of initial_salt is a 20 byte sequence shown in the figure
in hexadecimal notation. Future versions of QUIC SHOULD generate a in hexadecimal notation. Future versions of QUIC SHOULD generate a
new salt value, thus ensuring that the keys are different for each new salt value, thus ensuring that the keys are different for each
version of QUIC. This prevents a middlebox that only recognizes one version of QUIC. This prevents a middlebox that only recognizes one
version of QUIC from seeing or modifying the contents of handshake version of QUIC from seeing or modifying the contents of handshake
packets from future versions. packets from future versions.
Note: The Destination Connection ID is of arbitrary length, and it Note: The Destination Connection ID is of arbitrary length, and it
could be zero length if the server sends a Retry packet with a could be zero length if the server sends a Retry packet with a
zero-length Source Connection ID field. In this case, the Initial zero-length Source Connection ID field. In this case, the Initial
keys provide no assurance to the client that the server received keys provide no assurance to the client that the server received
skipping to change at page 18, line 38 skipping to change at page 18, line 38
larger than their input. larger than their input.
The key and IV for the packet are computed as described in The key and IV for the packet are computed as described in
Section 5.1. The nonce, N, is formed by combining the packet Section 5.1. The nonce, N, is formed by combining the packet
protection IV with the packet number. The 64 bits of the protection IV with the packet number. The 64 bits of the
reconstructed QUIC packet number in network byte order are left- reconstructed QUIC packet number in network byte order are left-
padded with zeros to the size of the IV. The exclusive OR of the padded with zeros to the size of the IV. The exclusive OR of the
padded packet number and the IV forms the AEAD nonce. padded packet number and the IV forms the AEAD nonce.
The associated data, A, for the AEAD is the contents of the QUIC The associated data, A, for the AEAD is the contents of the QUIC
header, starting from the flags octet in either the short or long header, starting from the flags byte in either the short or long
header, up to and including the unprotected packet number. header, up to and including the unprotected packet number.
The input plaintext, P, for the AEAD is the content of the QUIC frame The input plaintext, P, for the AEAD is the content of the QUIC frame
following the header, as described in [QUIC-TRANSPORT]. following the header, as described in [QUIC-TRANSPORT].
The output ciphertext, C, of the AEAD is transmitted in place of P. The output ciphertext, C, of the AEAD is transmitted in place of P.
Some AEAD functions have limits for how many packets can be encrypted Some AEAD functions have limits for how many packets can be encrypted
under the same key and IV (see for example [AEBounds]). This might under the same key and IV (see for example [AEBounds]). This might
be lower than the packet number limit. An endpoint MUST initiate a be lower than the packet number limit. An endpoint MUST initiate a
skipping to change at page 19, line 17 skipping to change at page 19, line 17
QUIC packet numbers are protected using a key that is derived from QUIC packet numbers are protected using a key that is derived from
the current set of secrets. The key derived using the "pn" label is the current set of secrets. The key derived using the "pn" label is
used to protect the packet number from casual observation. The used to protect the packet number from casual observation. The
packet number protection algorithm depends on the negotiated AEAD. packet number protection algorithm depends on the negotiated AEAD.
Packet number protection is applied after packet protection is Packet number protection is applied after packet protection is
applied (see Section 5.3). The ciphertext of the packet is sampled applied (see Section 5.3). The ciphertext of the packet is sampled
and used as input to an encryption algorithm. and used as input to an encryption algorithm.
In sampling the packet ciphertext, the packet number length is In sampling the packet ciphertext, the packet number length is
assumed to be 4 octets (its maximum possible encoded length), unless assumed to be 4 bytes (its maximum possible encoded length), unless
there is insufficient space in the packet for sampling. The sampled there is insufficient space in the packet for sampling. The sampled
ciphertext starts after allowing for a 4 octet packet number unless ciphertext starts after allowing for a 4 byte packet number unless
this would cause the sample to extend past the end of the packet. If this would cause the sample to extend past the end of the packet. If
the sample would extend past the end of the packet, the end of the the sample would extend past the end of the packet, the end of the
packet is sampled. packet is sampled.
For example, the sampled ciphertext for a packet with a short header For example, the sampled ciphertext for a packet with a short header
can be determined by: can be determined by:
sample_offset = 1 + len(connection_id) + 4 sample_offset = 1 + len(connection_id) + 4
if sample_offset + sample_length > packet_length then if sample_offset + sample_length > packet_length then
skipping to change at page 19, line 49 skipping to change at page 19, line 49
len(payload_length) + 4 len(payload_length) + 4
if packet_type == Initial: if packet_type == Initial:
sample_offset += len(token_length) + sample_offset += len(token_length) +
len(token) len(token)
To ensure that this process does not sample the packet number, packet To ensure that this process does not sample the packet number, packet
number protection algorithms MUST NOT sample more ciphertext than the number protection algorithms MUST NOT sample more ciphertext than the
minimum expansion of the corresponding AEAD. minimum expansion of the corresponding AEAD.
Packet number protection is applied to the packet number encoded as Packet number protection is applied to the packet number encoded as
described in Section 4.11 of [QUIC-TRANSPORT]. Since the length of described in Section 17.1 of [QUIC-TRANSPORT]. Since the length of
the packet number is stored in the first octet of the encoded packet the packet number is stored in the first byte of the encoded packet
number, it may be necessary to progressively decrypt the packet number, it may be necessary to progressively decrypt the packet
number. number.
Before a TLS ciphersuite can be used with QUIC, a packet protection Before a TLS ciphersuite can be used with QUIC, a packet protection
algorithm MUST be specifed for the AEAD used with that ciphersuite. algorithm MUST be specifed for the AEAD used with that ciphersuite.
This document defines algorithms for AEAD_AES_128_GCM, This document defines algorithms for AEAD_AES_128_GCM,
AEAD_AES_128_CCM, AEAD_AES_256_GCM, AEAD_AES_256_CCM (all AES AEADs AEAD_AES_128_CCM, AEAD_AES_256_GCM, AEAD_AES_256_CCM (all AES AEADs
are defined in [AEAD]), and AEAD_CHACHA20_POLY1305 ([CHACHA]). are defined in [AEAD]), and AEAD_CHACHA20_POLY1305 ([CHACHA]).
5.4.1. AES-Based Packet Number Protection 5.4.1. AES-Based Packet Number Protection
This section defines the packet protection algorithm for This section defines the packet protection algorithm for
AEAD_AES_128_GCM, AEAD_AES_128_CCM, AEAD_AES_256_GCM, and AEAD_AES_128_GCM, AEAD_AES_128_CCM, AEAD_AES_256_GCM, and
AEAD_AES_256_CCM. AEAD_AES_128_GCM and AEAD_AES_128_CCM use 128-bit AEAD_AES_256_CCM. AEAD_AES_128_GCM and AEAD_AES_128_CCM use 128-bit
AES [AES] in counter (CTR) mode. AEAD_AES_256_GCM, and AES [AES] in counter (CTR) mode. AEAD_AES_256_GCM, and
AEAD_AES_256_CCM use 256-bit AES in CTR mode. AEAD_AES_256_CCM use 256-bit AES in CTR mode.
This algorithm samples 16 octets from the packet ciphertext. This This algorithm samples 16 bytes from the packet ciphertext. This
value is used as the counter input to AES-CTR. value is used as the counter input to AES-CTR.
encrypted_pn = AES-CTR(pn_key, sample, packet_number) encrypted_pn = AES-CTR(pn_key, sample, packet_number)
5.4.2. ChaCha20-Based Packet Number Protection 5.4.2. ChaCha20-Based Packet Number Protection
When AEAD_CHACHA20_POLY1305 is in use, packet number protection uses When AEAD_CHACHA20_POLY1305 is in use, packet number protection uses
the raw ChaCha20 function as defined in Section 2.4 of [CHACHA]. the raw ChaCha20 function as defined in Section 2.4 of [CHACHA].
This uses a 256-bit key and 16 octets sampled from the packet This uses a 256-bit key and 16 bytes sampled from the packet
protection output. protection output.
The first 4 octets of the sampled ciphertext are interpreted as a The first 4 bytes of the sampled ciphertext are interpreted as a
32-bit number in little-endian order and are used as the block count. 32-bit number in little-endian order and are used as the block count.
The remaining 12 octets are interpreted as three concatenated 32-bit The remaining 12 bytes are interpreted as three concatenated 32-bit
numbers in little-endian order and used as the nonce. numbers in little-endian order and used as the nonce.
The encoded packet number is then encrypted with ChaCha20 directly. The encoded packet number is then encrypted with ChaCha20 directly.
In pseudocode: In pseudocode:
counter = DecodeLE(sample[0..3]) counter = DecodeLE(sample[0..3])
nonce = DecodeLE(sample[4..7], sample[8..11], sample[12..15]) nonce = DecodeLE(sample[4..7], sample[8..11], sample[12..15])
encrypted_pn = ChaCha20(pn_key, counter, nonce, packet_number) encrypted_pn = ChaCha20(pn_key, counter, nonce, packet_number)
5.5. Receiving Protected Packets 5.5. Receiving Protected Packets
skipping to change at page 23, line 45 skipping to change at page 23, line 45
Figure 4: Key Update Figure 4: Key Update
A packet that triggers a key update could arrive after successfully A packet that triggers a key update could arrive after successfully
processing a packet with a higher packet number. This is only processing a packet with a higher packet number. This is only
possible if there is a key compromise and an attack, or if the peer possible if there is a key compromise and an attack, or if the peer
is incorrectly reverting to use of old keys. Because the latter is incorrectly reverting to use of old keys. Because the latter
cannot be differentiated from an attack, an endpoint MUST immediately cannot be differentiated from an attack, an endpoint MUST immediately
terminate the connection if it detects this condition. terminate the connection if it detects this condition.
In deciding when to update keys, endpoints MUST NOT exceed the limits
for use of specific keys, as described in Section 5.5 of [TLS13].
7. Security of Initial Messages 7. Security of Initial Messages
Initial packets are not protected with a secret key, so they are Initial packets are not protected with a secret key, so they are
subject to potential tampering by an attacker. QUIC provides subject to potential tampering by an attacker. QUIC provides
protection against attackers that cannot read packets, but does not protection against attackers that cannot read packets, but does not
attempt to provide additional protection against attacks where the attempt to provide additional protection against attacks where the
attacker can observe and inject packets. Some forms of tampering - attacker can observe and inject packets. Some forms of tampering -
such as modifying the TLS messages themselves - are detectable, but such as modifying the TLS messages themselves - are detectable, but
some - such as modifying ACKs - are not. some - such as modifying ACKs - are not.
skipping to change at page 26, line 24 skipping to change at page 26, line 31
9.1. Packet Reflection Attack Mitigation 9.1. Packet Reflection Attack Mitigation
A small ClientHello that results in a large block of handshake A small ClientHello that results in a large block of handshake
messages from a server can be used in packet reflection attacks to messages from a server can be used in packet reflection attacks to
amplify the traffic generated by an attacker. amplify the traffic generated by an attacker.
QUIC includes three defenses against this attack. First, the packet QUIC includes three defenses against this attack. First, the packet
containing a ClientHello MUST be padded to a minimum size. Second, containing a ClientHello MUST be padded to a minimum size. Second,
if responding to an unverified source address, the server is if responding to an unverified source address, the server is
forbidden to send more than three UDP datagrams in its first flight forbidden to send more than three UDP datagrams in its first flight
(see Section 4.7 of [QUIC-TRANSPORT]). Finally, because (see Section 8.1 of [QUIC-TRANSPORT]). Finally, because
acknowledgements of Handshake packets are authenticated, a blind acknowledgements of Handshake packets are authenticated, a blind
attacker cannot forge them. Put together, these defenses limit the attacker cannot forge them. Put together, these defenses limit the
level of amplification. level of amplification.
9.2. Peer Denial of Service 9.2. Peer Denial of Service
QUIC, TLS, and HTTP/2 all contain messages that have legitimate uses QUIC, TLS, and HTTP/2 all contain messages that have legitimate uses
in some contexts, but that can be abused to cause a peer to expend in some contexts, but that can be abused to cause a peer to expend
processing resources without having any observable impact on the processing resources without having any observable impact on the
state of the connection. If processing is disproportionately large state of the connection. If processing is disproportionately large
skipping to change at page 28, line 28 skipping to change at page 28, line 33
[AES] "Advanced encryption standard (AES)", National Institute [AES] "Advanced encryption standard (AES)", National Institute
of Standards and Technology report, of Standards and Technology report,
DOI 10.6028/nist.fips.197, November 2001. DOI 10.6028/nist.fips.197, November 2001.
[CHACHA] Nir, Y. and A. Langley, "ChaCha20 and Poly1305 for IETF [CHACHA] Nir, Y. and A. Langley, "ChaCha20 and Poly1305 for IETF
Protocols", RFC 8439, DOI 10.17487/RFC8439, June 2018, Protocols", RFC 8439, DOI 10.17487/RFC8439, June 2018,
<https://www.rfc-editor.org/info/rfc8439>. <https://www.rfc-editor.org/info/rfc8439>.
[QUIC-RECOVERY] [QUIC-RECOVERY]
Iyengar, J., Ed. and I. Swett, Ed., "QUIC Loss Detection Iyengar, J., Ed. and I. Swett, Ed., "QUIC Loss Detection
and Congestion Control", draft-ietf-quic-recovery-16 (work and Congestion Control", draft-ietf-quic-recovery-latest
in progress). (work in progress).
[QUIC-TRANSPORT] [QUIC-TRANSPORT]
Iyengar, J., Ed. and M. Thomson, Ed., "QUIC: A UDP-Based Iyengar, J., Ed. and M. Thomson, Ed., "QUIC: A UDP-Based
Multiplexed and Secure Transport", draft-ietf-quic- Multiplexed and Secure Transport", draft-ietf-quic-
transport-16 (work in progress). transport-latest (work in progress).
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997, DOI 10.17487/RFC2119, March 1997,
<https://www.rfc-editor.org/info/rfc2119>. <https://www.rfc-editor.org/info/rfc2119>.
[RFC7301] Friedl, S., Popov, A., Langley, A., and E. Stephan, [RFC7301] Friedl, S., Popov, A., Langley, A., and E. Stephan,
"Transport Layer Security (TLS) Application-Layer Protocol "Transport Layer Security (TLS) Application-Layer Protocol
Negotiation Extension", RFC 7301, DOI 10.17487/RFC7301, Negotiation Extension", RFC 7301, DOI 10.17487/RFC7301,
July 2014, <https://www.rfc-editor.org/info/rfc7301>. July 2014, <https://www.rfc-editor.org/info/rfc7301>.
skipping to change at page 29, line 28 skipping to change at page 29, line 36
Luykx, A. and K. Paterson, "Limits on Authenticated Luykx, A. and K. Paterson, "Limits on Authenticated
Encryption Use in TLS", March 2016, Encryption Use in TLS", March 2016,
<http://www.isg.rhul.ac.uk/~kp/TLS-AEbounds.pdf>. <http://www.isg.rhul.ac.uk/~kp/TLS-AEbounds.pdf>.
[IMC] Katz, J. and Y. Lindell, "Introduction to Modern [IMC] Katz, J. and Y. Lindell, "Introduction to Modern
Cryptography, Second Edition", ISBN 978-1466570269, Cryptography, Second Edition", ISBN 978-1466570269,
November 2014. November 2014.
[QUIC-HTTP] [QUIC-HTTP]
Bishop, M., Ed., "Hypertext Transfer Protocol (HTTP) over Bishop, M., Ed., "Hypertext Transfer Protocol (HTTP) over
QUIC", draft-ietf-quic-http-16 (work in progress). QUIC", draft-ietf-quic-http-latest (work in progress).
[RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818,
DOI 10.17487/RFC2818, May 2000, DOI 10.17487/RFC2818, May 2000,
<https://www.rfc-editor.org/info/rfc2818>. <https://www.rfc-editor.org/info/rfc2818>.
[RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S.,
Housley, R., and W. Polk, "Internet X.509 Public Key Housley, R., and W. Polk, "Internet X.509 Public Key
Infrastructure Certificate and Certificate Revocation List Infrastructure Certificate and Certificate Revocation List
(CRL) Profile", RFC 5280, DOI 10.17487/RFC5280, May 2008, (CRL) Profile", RFC 5280, DOI 10.17487/RFC5280, May 2008,
<https://www.rfc-editor.org/info/rfc5280>. <https://www.rfc-editor.org/info/rfc5280>.
 End of changes. 37 change blocks. 
50 lines changed or deleted 49 lines changed or added

This html diff was produced by rfcdiff 1.44jr. The latest version is available from http://tools.ietf.org/tools/rfcdiff/