Speed

ClientHello Extensions

The 11 extensions of the recorded ClientHello are a type, a length and data; supported_versions offers 0304 and 0303 while legacy_version stays 0303.

The question

A ClientHello ends with a list of extensions, and TLS 1.3 hides its real version choice in one of them. How is the list laid out, and which of the extensions of the recorded ClientHello says "TLS 1.3"?

The recording is one loopback connection between two test programs, made on 2026-11-20 with OpenSSL 4.0.3 and kept as test material. Its ClientHello has 11 extensions in a block of 173 bytes (the ClientHello of the previous lesson ends with it). Each extension is a 2-byte type, a 2-byte length and that many bytes of data (RFC 9846, 4.3).

Work it by hand

Read the first bytes of the block: ff 01 00 01 00. The type is 0xff01, 65281; the length is 1; the one data byte is 00. The next extension starts 4 + 1 = 5 bytes later. Every step is the same: read type and length, skip 4 + length bytes.

Near the end of the block stands 00 2b 00 05 04 03 04 03 03. The type 0x2b is 43, supported_versions; the length is 5. Its data starts with one length byte, 04, and then 4 bytes: the two versions 0304 and 0303, that is TLS 1.3 and TLS 1.2 (RFC 9846, 4.3.1). The 2-byte legacy_version in the hello still says 0303; the real choice lives in this extension.

Run it

The program takes the block as hex in extensions. The loop from line 3 to line 19 reads the type at at (line 4) and the length at at + 2 (line 5), then names the type (lines 6 to 17) and adds one row (line 18); line 19 moves to the next extension. Line 21 returns the rows.

The names are those that OpenSSL's trace prints for this ClientHello (the trace adds the number in brackets, which the table already shows in its first column). The IANA registry (IANA TLS ExtensionType Values, read 2026-11-20) says renegotiation_info for 65281 and extended_main_secret for 23: another source, another spelling. Do not mix them.

A table of 11 rows: 65281 length 1, 11 length 2, 10 length 4, 35 length 0, 22 length 0, 23 length 0, 13 length 56, 43 length 5, 45 length 2, 51 length 38 and 0 length 21, each with the name OpenSSL's trace prints.
Watch the steps (recorded video)

Public test material, generated for this lesson. Never use it for anything real.

let rows = str_list();
let at = 0;
while (at < hex_len(extensions)) {
  let kind = hex_u16(extensions, at);
  let size = hex_u16(extensions, at + 2);
  let name = "unknown";
  if (kind == 0) { name = "server_name"; }
  if (kind == 10) { name = "supported_groups"; }
  if (kind == 11) { name = "ec_point_formats"; }
  if (kind == 13) { name = "signature_algorithms"; }
  if (kind == 22) { name = "encrypt_then_mac"; }
  if (kind == 23) { name = "extended_master_secret"; }
  if (kind == 35) { name = "session_ticket"; }
  if (kind == 43) { name = "supported_versions"; }
  if (kind == 45) { name = "psk_key_exchange_modes"; }
  if (kind == 51) { name = "key_share"; }
  if (kind == 65281) { name = "renegotiate"; }
  rows.add(str(kind) + "|" + str(size) + "|" + name);
  at = at + 4 + size;
}
let answer = rows;
{
  "answer": [
    "65281|1|renegotiate",
    "11|2|ec_point_formats",
    "10|4|supported_groups",
    "35|0|session_ticket",
    "22|0|encrypt_then_mac",
    "23|0|extended_master_secret",
    "13|56|signature_algorithms",
    "43|5|supported_versions",
    "45|2|psk_key_exchange_modes",
    "51|38|key_share",
    "0|21|server_name"
  ]
}

You can change the block freely if it is made of whole extensions: a type the program does not know is named unknown. An extension whose stated length runs past the end of the block is still listed, and the loop then ends without an error (measured), and a block cut inside a type or length field stops the run with the message that a byte is past the end of the data.

Your turn

A client wants the TLS versions that a ClientHello offers. The program below is meant to return them from an extensions block as a list of texts, each a 4-digit hex version, in the order they appear in the supported_versions extension; an extension block without that extension gives an empty list.

Decide whether it does, and find the candidates that do. Check runs each candidate on the block shown and on five others. The blocks are built by hand from the pieces of the real layout; they are test material and not captures.

The first 16 bytes of an extensions block, shown in hex with the total number of bytes of the block.

Public test material, generated for this lesson. Never use it for anything real.

let answer = str_list();
let at = 0;
let total = hex_len(extensions);
while (at < total) {
  let kind = hex_u16(extensions, at);
  let size = hex_u16(extensions, at + 2);
  if (kind == 43) {
    let count = hex_u8(extensions, at + 4) / 2;
    for (i in range(0, math_min(count, 1))) {
      answer.add(hex_slice(extensions, at + 5 + 2 * i, 2));
    }
  }
  at = at + 4 + size;
}
{
  "answer": [
    "0304"
  ]
}

Return the TLS versions offered in the supported_versions extension as a list of texts, each version as 4 hex digits, in the order they appear. An extensions block without that extension gives an empty list.

Read the result carefully

The version numbers are not an ordering of what a server will choose: the list says what the client offers, in its order, and the server's choice appears in its own reply. The extension block of this page is one recorded ClientHello and some hand-built blocks. A real client sends other extensions and orders them as it likes, which is why a reader must walk the list and cannot rely on a position.

The page does not show what the other extensions mean, what a server does with them, or any other client. Names of extensions differ between sources; this page names where each one comes from.

Recap

  • An extension is a 2-byte type, a 2-byte length and the data; the next one starts 4 + length bytes on.
  • The supported_versions extension (43) carries a 1-byte length and then 2 bytes per version.
  • In the recorded ClientHello it offers 0304 and 0303; the hello's legacy_version is 0303.
  • OpenSSL's trace and the IANA registry spell two of the names differently.