-
Notifications
You must be signed in to change notification settings - Fork 205
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
Changes from 2 commits
edff824
5b81241
c408ba4
10df2ab
0cdfe02
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -942,16 +942,28 @@ Packet number protection is applied after packet protection is applied (see | |
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 size | ||
of the protected packet minus the minimum expansion for the AEAD. For example, | ||
the sampled ciphertext for a packet with a short header can be determined by: | ||
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: | ||
|
||
~~~ | ||
sample_offset = min(1 + connection_id_length + 4, | ||
sample_offset = min(1 + len(connection_id) + 4, | ||
packet_length - aead_expansion) | ||
sample = packet[sample_offset..sample_offset+sample_length] | ||
~~~ | ||
|
||
A packet with a long header is sampled in the same way, noting that multiple | ||
QUIC packets might be included in the same UDP datagram and that each one is | ||
handled separately. | ||
|
||
~~~ | ||
sample_offset = min(2 + len(destination_connection_id) + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't |
||
len(source_connection_id) + | ||
len(payload_length) + 4, | ||
packet_length - aead_expansion) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahh, I see the problem. You don't know where the payload length starts. It seems like we need to make the payload length cover the packet number length. More changes inbound. |
||
~~~ | ||
|
||
To ensure that this process does not sample the packet number, packet number | ||
protection algorithms MUST NOT sample more ciphertext than the minimum | ||
expansion of the corresponding AEAD. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't "packet number length" be "sample_offset"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, but I see how this text is confusing, I'll rephrase and we can try again.