The module tls_tcp
TLS 1.3 over TCP and the wire borders of QUIC as a library module of the system.
Each export calls the support packages modus:tls_tcp and modus:quic over bytes and tables of the caller, so a process that imports the module reads and writes the same bytes as a process that compiles the packages in.
- The caller supplies the memory: the module allocates nothing and keeps nothing between two calls. It has no package variable that is not read-only: a library module has no data that the loader writes for one base.
- The bytes are hostile input: in an isolated call they are in the call region, which another thread can change during the call. Each export copies the few bytes that it reads into its own frame once, then checks and reads the copy only.
- A refusal is an error record and a negative result, and it writes no byte and no record of the caller.
See: From the desktop of today to a light web browser in the repository, Shared libraries as modules: where the border goes in the repository, Shared libraries as modules: where the border goes: The subtle points in the repository
tls_tcp module with no entry
- Hash
d4cb34d1946c601ba3bbc18ee00a7ffdf5578fccd041581a332d537a37ebb6d5- Size
24576 bytes- Exports
8- Imports
0- Imported by
0- License
- MIT
TLS 1.3 over TCP and the wire borders of QUIC as a library module of the system
| Fact | Value |
|---|---|
| Kind | Modules with no entry |
| Source | src/modules/libraries/tls_tcp |
| Boot image | yes: in the boot image, 24576 bytes in this build |
| Build settings | none: the defaults of the source |
| Imports | none |
| Imported by | none |
Neighbours
It imports no module, and no module imports it. The module graph shows it with the other modules that have no edge.
Exports
| Export | What it does |
|---|---|
cipher_suite_supported(suite_word: Integer) -> Integer | reports whether suite_word names a TLS 1.3 cipher suite implemented by this module (1 = supported, 0 = unsupported) |
record_max_plaintext_bytes() -> Integer | returns the RFC 8446 maximum plaintext record payload size in bytes (16 384) |
record_max_ciphertext_bytes() -> Integer | returns the RFC 8446 maximum encrypted record payload size in bytes (16 640) |
tls_record_header_parse(input: Bytes(Read), header: Table(Record_Header, Change)) -> Integer | reads the 5-byte header of a TLS 1.3 record (RFC 8446, section 5.1) at the start of the bytes of argument 1, and writes it into the first record of the table of argument 2: its content type, its legacy version and the length of its payload |
tls_record_header_write(content_type_word: Integer, payload_length: Integer, output: Bytes(Change)) -> Integer | writes the 5-byte header of a TLS 1.3 record (RFC 8446, section 5.1) at the start of the bytes of argument 3: the content type, the legacy version 0x0303, and the payload length, the most significant byte first |
quic_variable_length_integer_read(input: Bytes(Read), integer: Table(Variable_Length_Integer, Change)) -> Integer | reads the variable-length integer of QUIC (RFC 9000, section 16) at the start of the bytes of argument 1, and writes its value and its size into the first record of the table of argument 2 |
quic_variable_length_integer_write(value: Integer, output: Bytes(Change)) -> Integer | writes a value as a variable-length integer of QUIC (RFC 9000, section 16), in its shortest encoding, at the start of the bytes of argument 2 |
quic_header_probe(packet: Bytes(Read), probe: Table(Quic_Header_Probe, Change)) -> Integer | reads the form of the header of a QUIC packet at the start of the bytes of argument 1 and, for a long header, its version (RFC 9000, sections 17.2 and 17.3), into the first record of the table of argument 2 |
cipher_suite_supported
cipher_suite_supported(suite_word: ) ->
cipher_suite_supported reports whether suite_word names a TLS 1.3 cipher suite implemented by this module (1 = supported, 0 = unsupported).
suite_word:
- When it fails
- a negative result, and the error record
src/modules/libraries/tls_tcp/tls_tcp.odin:63
record_max_plaintext_bytes
record_max_plaintext_bytes() ->
record_max_plaintext_bytes returns the RFC 8446 maximum plaintext record payload size in bytes (16 384).
record_max_ciphertext_bytes
record_max_ciphertext_bytes() ->
record_max_ciphertext_bytes returns the RFC 8446 maximum encrypted record payload size in bytes (16 640).
tls_record_header_parse
tls_record_header_parse(input: (Read), header: (, Change)) ->
tls_record_header_parse reads the 5-byte header of a TLS 1.3 record (RFC 8446, section 5.1) at the start of the bytes of argument 1, and writes it into the first record of the table of argument 2: its content type, its legacy version and the length of its payload. The result is 5, the bytes of the header, or -1 with an error record: a nil place, or a nil address with bytes (Bad_Address); fewer than 5 bytes (Too_Small, argument 1: value the count, limit 5); a table with no record (Too_Small, argument 2, Records: value the count, limit 1); a content type that is not 20 to 23 (Bad_Value, argument 1: value the byte, limit 23, found 1, the number of the byte); a legacy version other than 0x0303 (Bad_Value, argument 1: value the version, limit 0x0303, found 2); a length over 16 640 for application data or over 16 384 for another type (Too_Long, argument 1: value the length, limit the most). The first ClientHello with the legacy version 0x0301 is refused too: the handshake of the package reads that one record. Nothing is written on a refusal.
input: (Read)header: (, Change)
- When it fails
- a negative result, and the error record
src/modules/libraries/tls_tcp/tls_tcp.odin:87
tls_record_header_write
tls_record_header_write(content_type_word: , payload_length: , output: (Change)) ->
tls_record_header_write writes the 5-byte header of a TLS 1.3 record (RFC 8446, section 5.1) at the start of the bytes of argument 3: the content type, the legacy version 0x0303, and the payload length, the most significant byte first. The result is 5, or -1 with an error record: a content type that is not 20 to 23 (Bad_Value, argument 1: value the word, limit 23); a negative length (Bad_Value, argument 2: value the length, limit the most); a length over 16 640 for application data or over 16 384 for another type (Too_Long, argument 2: value the length, limit the most); a nil place, or a nil address with bytes (Bad_Address, argument 3, found 1); fewer than 5 bytes (Too_Small, argument 3: value the count, limit 5). Nothing is written on a refusal.
content_type_word:payload_length:output: (Change)
- When it fails
- a negative result, and the error record
src/modules/libraries/tls_tcp/tls_tcp.odin:154
quic_variable_length_integer_read
quic_variable_length_integer_read(input: (Read), integer: (, Change)) ->
quic_variable_length_integer_read reads the variable-length integer of QUIC (RFC 9000, section 16) at the start of the bytes of argument 1, and writes its value and its size into the first record of the table of argument 2. The result is the bytes that it takes, 1, 2, 4 or 8, or -1 with an error record: a nil place, or a nil address with bytes (Bad_Address); no byte (Too_Small, argument 1: value 0, limit 1); fewer bytes than the two high bits of the first byte name (Too_Small, argument 1: value the count, limit the size); a table with no record (Too_Small, argument 2, Records: value the count, limit 1). It accepts an encoding longer than the shortest, as RFC 9000 does outside a frame type. Nothing is written on a refusal.
input: (Read)integer: (, Change)
- When it fails
- a negative result, and the error record
src/modules/libraries/tls_tcp/tls_tcp.odin:189
quic_variable_length_integer_write
quic_variable_length_integer_write(value: , output: (Change)) ->
quic_variable_length_integer_write writes a value as a variable-length integer of QUIC (RFC 9000, section 16), in its shortest encoding, at the start of the bytes of argument 2. The result is the bytes written, 1, 2, 4 or 8, or -1 with an error record: a negative value or a value over 2^62 - 1 (Bad_Value, argument 1: value the value, limit 2^62 - 1); a nil place, or a nil address with bytes (Bad_Address, argument 2, found 1); fewer bytes than the encoding takes (Too_Small, argument 2: value the count, limit the size). Nothing is written on a refusal.
value:output: (Change)
- When it fails
- a negative result, and the error record
src/modules/libraries/tls_tcp/tls_tcp.odin:225
quic_header_probe
quic_header_probe(packet: (Read), probe: (, Change)) ->
quic_header_probe reads the form of the header of a QUIC packet at the start of the bytes of argument 1 and, for a long header, its version (RFC 9000, sections 17.2 and 17.3), into the first record of the table of argument 2. It is the first look of a receiver, before it chooses a connection: it reads no connection identifier and no length. The result is the bytes read, 1 for a short header and 5 for a long header, or -1 with an error record: a nil place, or a nil address with bytes (Bad_Address); no byte, or a long header of fewer than 5 bytes (Too_Small, argument 1: value the count, limit 1 or 5); a table with no record (Too_Small, argument 2, Records: value the count, limit 1); the Fixed Bit clear in a short header or in a long header of version 1 (Bad_Value, argument 1: value the first byte, limit 0x40, found 1, the number of the byte). A long header of another version, Version Negotiation (version 0) included, has no Fixed Bit to check. Nothing is written on a refusal.
packet: (Read)probe: (, Change)
- When it fails
- a negative result, and the error record
src/modules/libraries/tls_tcp/tls_tcp.odin:245
Read from the source of the module, as the build reads it to describe the exports (tools/modustool/build/describe.odin).
Integer wire form
A wire form of the module contract: one word of a call. A signed integer of 64 bits, in a register.
Error_Record record of a module
A record of the module tls_tcp: 56 bytes, aligned on 8 bytes, 0 bytes of padding.
kindi6408 bytesuniti6488 bytesoperationi64168 bytesargumenti64248 bytesvaluei64328 byteslimiti64408 bytesfoundi64488 bytes
Bytes wire form
A wire form of the module contract: one word of a call. Bytes with no description.
Table wire form
A wire form of the module contract: one word of a call. Records of one description that follow each other (a table).
Record_Header record of a module
A record of the module tls_tcp: 6 bytes, aligned on 2 bytes, 1 bytes of padding.
content_typeu801 bytes- padding11 bytes
legacy_versionu1622 byteslengthu1642 bytes
Variable_Length_Integer record of a module
A record of the module tls_tcp: 16 bytes, aligned on 8 bytes, 0 bytes of padding.
valuei6408 bytessizei6488 bytes
Quic_Header_Probe record of a module
A record of the module tls_tcp: 8 bytes, aligned on 4 bytes, 3 bytes of padding.
formu801 bytes- padding13 bytes
versionu3244 bytes
