diff options
author | Nick Mathewson <nickm@torproject.org> | 2023-11-08 14:48:11 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2023-11-09 09:12:48 -0500 |
commit | cae2c281238e798d3a2614f241e888e92b53ea4e (patch) | |
tree | e2b0e0d2463b62e029099547624d4d703912176b /spec/tor-spec/cell-packet-format.md | |
parent | 919d193f1c85aef1387c3c3498b23b886abb7489 (diff) | |
download | torspec-cae2c281238e798d3a2614f241e888e92b53ea4e.tar.gz torspec-cae2c281238e798d3a2614f241e888e92b53ea4e.zip |
Finish revising cell-packet-format.
Diffstat (limited to 'spec/tor-spec/cell-packet-format.md')
-rw-r--r-- | spec/tor-spec/cell-packet-format.md | 67 |
1 files changed, 24 insertions, 43 deletions
diff --git a/spec/tor-spec/cell-packet-format.md b/spec/tor-spec/cell-packet-format.md index 5fdfea2..7975af4 100644 --- a/spec/tor-spec/cell-packet-format.md +++ b/spec/tor-spec/cell-packet-format.md @@ -138,11 +138,6 @@ to support a command. Commands with no value given for **P** are supported at least in link protocols 3 and above. -Commands labeled with CircId? = N -MUST must be sent with their `CircId` field set to 0. -Commands labeled with CircId? = N -MUST must be sent with a nonzero `CircId`. - No other command values are allowed. Implementations SHOULD NOT send undefined command values. Upon receiving an unrecognized command, @@ -164,48 +159,34 @@ and MAY terminate the channel with an error. > under the assumption that the command was sent > by a more up-to-date version of Tor. +## Interpreting the fields: Payload {#payload} -The interpretation of `Payload` depends on the type of the cell. - -* `VPADDING`/`PADDING`: Payload contains padding bytes. -* `CREATE`/`CREATE2`: Payload contains the handshake challenge. -* `CREATED`/`CREATED2`: Payload contains the handshake response. -* `RELAY`/`RELAY_EARLY`: Payload contains the relay header and relay body. -* `DESTROY`: Payload contains a reason for closing the circuit. (see [Tearing down circuits](./tearing-down-circuits.md#tearing-down-circuits)) - -The cell is padded up to the cell length with padding bytes. - -Senders set padding bytes depending on the cell's command: +The interpretation of Payload depends on the cell's command. +see the links in the command descriptions above +for more information on each command. -* `VERSIONS`: `Payload` MUST NOT contain padding bytes. -* `AUTHORIZE`: `Payload` is unspecified and reserved for future use. -* Other variable-length cells: - * `Payload` MAY contain padding bytes at the end of the cell. - * Padding bytes SHOULD be set to NUL. -* `RELAY`/`RELAY_EARLY`: `Payload` MUST be padded to `PAYLOAD_LEN` with padding bytes. Padding bytes SHOULD be set to random values. -* Other fixed-length cells: - * `Payload` MUST be padded to `PAYLOAD_LEN` with padding bytes. - * Padding bytes SHOULD be set to NUL. +## Padding fixed-length cell payloads {#payload-padding} -We recommend random padding in `RELAY`/`RELAY_EARLY` cells, so that the cell -content is unpredictable. See the format of relay cells in [Relay cells](./relay-cells.md#relay-cells) -for detail. +Often, the amount of information to be sent +in a fixed-length cell +is less than [`PAYLOAD_LEN`] bytes. +When this happens, +the sender MUST fill the unused part of the payload +with zero-valued bytes. -For other cells, TLS authenticates cell content, so randomized padding -bytes are redundant. +Recipients MUST ignore padding bytes. -Receivers MUST ignore padding bytes. - -`PADDING` cells are currently used to implement connection keepalive. -If there is no other traffic, ORs and OPs send one another a `PADDING` -cell every few minutes. - -`CREATE`, `CREATE2`, `CREATED`, `CREATED2`, and `DESTROY` cells are used to -manage circuits; see [Circuit management](./circuit-management.md#circuit-management). +> [RELAY] and [RELAY_EARLY] cel payloads +> contain encrypted data, +> and are always full +> from the point of the view of the channel layer. +> +> The _plaintext_ of these cells' contents may be padded; +> this uses a [different mechanism](./relay-cells.md#relay-cell-padding) +> and does not interact with channel payload padding. -`RELAY` cells are used to send commands and data along a circuit; see -[Application connections and stream management](./streams.md#application-connections-and-stream-management). +Variable-length cells never have extra space, +so there is no need to pad their payloads. +Unless otherwise specified, +variable-length cells have no padding. -`VERSIONS` and `NETINFO` cells are used to set up connections in link -protocols v2 and higher; in link protocol v3 and higher, `CERTS`, -`AUTH_CHALLENGE`, and `AUTHENTICATE` may also be used. See [Negotiating and initializing channels](./negotiating-channels.md#negotiating). |