Skip to content

Commit

Permalink
Clarify packet number representation
Browse files Browse the repository at this point in the history
  • Loading branch information
janaiyengar committed Dec 20, 2018
1 parent b4b2d14 commit 6980d7b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion draft-ietf-quic-tls.md
Expand Up @@ -829,7 +829,7 @@ an output 16 bytes larger than their input.

The key and IV for the packet are computed as described in {{protection-keys}}.
The nonce, N, is formed by combining the packet protection IV with the packet
number. The 64 bits of the reconstructed QUIC packet number in network byte
number. The 62 bits of the 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 packet number and the IV forms the AEAD nonce.

Expand Down
16 changes: 10 additions & 6 deletions draft-ietf-quic-transport.md
Expand Up @@ -2639,11 +2639,14 @@ other packets in the same UDP datagram.

## Packet Numbers {#packet-numbers}

The packet number is an integer in the range 0 to 2^62-1. Where present, packet
numbers are encoded as a variable-length integer (see {{integer-encoding}}).
This number is used in determining the cryptographic nonce for packet
protection. Each endpoint maintains a separate packet number for sending and
receiving.
The packet number is an integer in the range 0 to (2^62)-1. This number is used
in determining the cryptographic nonce for packet protection. Each endpoint
maintains a separate packet number for sending and receiving.

Packet numbers are limited to this range because they need to be representable
in whole in the Largest Acknowledged field of an ACK frame ({{frame-ack}}).
When present in a long or short header however, packet numbers are reduced and
encoded in 1 to 4 bytes, see {{packet-encoding}}).

Version Negotiation ({{packet-version}}) and Retry {{packet-retry}} packets do
not include a packet number.
Expand Down Expand Up @@ -3297,7 +3300,8 @@ value of fields.

## Packet Number Encoding and Decoding {#packet-encoding}

Packet numbers in long and short packet headers are encoded in 1 to 4 bytes.
Packet numbers are integers in the range 0 to (2^62)-1 ({{packet-numbers}}).
When present in long or short packet headers, they are encoded in 1 to 4 bytes.
The number of bits required to represent the packet number is reduced by
including the least significant bits of the packet number.

Expand Down

0 comments on commit 6980d7b

Please sign in to comment.