Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the packet number encryption sampling clearer #1389

Merged
merged 5 commits into from May 29, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 16 additions & 11 deletions draft-ietf-quic-tls.md
Expand Up @@ -941,15 +941,21 @@ Packet number protection is applied after packet protection is applied (see
{{aead}}). The ciphertext of the packet is sampled and used as input to an
encryption algorithm.

In sampling the packet ciphertext, the packet number length is assumed to be the
smaller of the maximum possible packet number encoding (4 octets), or the
remaining space in the packet when the minimum expansion for the AEAD is
subtracted. For example, the sampled ciphertext for a packet with a short
header can be determined by:
In sampling the packet ciphertext, the packet number length is assumed to be
either 4 octets (its maximum possible encoded length), unless there is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either implies two options. I'd just drop it.

insufficient space in the packet for sampling. The sampled ciphertext starts
after allowing for a 4 octet packet number unless 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 packet is sampled.

For example, the sampled ciphertext for a packet with a short header can be
determined by:

~~~
sample_offset = min(1 + len(connection_id) + 4,
packet_length - aead_expansion)
sample_offset = 1 + len(connection_id) + 4

if sample_offset + sample_length > packet_length then
sample_offset = packet_length - sample_length
sample = packet[sample_offset..sample_offset+sample_length]
~~~

Expand All @@ -958,10 +964,9 @@ QUIC packets might be included in the same UDP datagram and that each one is
handled separately.

~~~
sample_offset = min(6 + len(destination_connection_id) +
len(source_connection_id) +
len(payload_length) + 4,
packet_length - aead_expansion)
sample_offset = 6 + len(destination_connection_id) +
len(source_connection_id) +
len(payload_length) + 4
~~~

To ensure that this process does not sample the packet number, packet number
Expand Down