code wiki / (root) / nx_tls13_hello.nx

nx_tls13_hello.nx

buildroot/runtime/nx_tls13_hello.nx

20204 B503 linesdepth 3pulls 4 transitivereach 569 importersview sourcekind librarytopic tls13
docsdependenciesstructsconstsfunctions

about

nx_tls13_hello.nx -- TLS 1.3 ClientHello + ServerHello (RFC 8446 §4.1.2 / §4.1.3). Phase 0b §F.2 of the Nishi TLS 1.3 stack per docs/NISHI_TLS13_GAP_AUDIT.md. Composes the extension emitters from nx_tls13_ext into a complete ClientHello byte stream that can go on the wire. Parses an incoming ServerHello into its fixed-position fields + an extensions blob the caller iterates. Both Hello structures sit inside a 4-byte Handshake wrapper: struct { HandshakeType msg_type; /* 1 byte: 1=ClientHello, 2=ServerHello */ uint24 length; /* 3 bytes, body length */ <ClientHello | ServerHello body>; } Handshake; ClientHello body (RFC 8446 §4.1.2): ProtocolVersion legacy_version = 0x0303; Random random; (32 bytes) opaque legacy_session_id<0..32>; (1-byte len + bytes) CipherSuite cipher_suites<2..2^16-2>; (2-byte len + 2-byte suite ids) opaque legacy_compression_methods<1..2^8-1>; (1-byte len + bytes, always 0x01 0x00) Extension extensions<8..2^16-1>; (2-byte len + emitted extensions) ServerHello body (RFC 8446 §4.1.3): ProtocolVersion legacy_version = 0x0303; Random random; (32 bytes) opaque legacy_session_id_echo<0..32>; CipherSuite cipher_suite; (2 bytes; single, not list) uint8 legacy_compression_method; (always 0) Extension extensions<6..2^16-1>; What it does today: - emit ClientHello with all 5 minimum-credible extensions (SNI, supported_versions, supported_groups, signature_algorithms, key_share) in the canonical order - parse ServerHello fixed fields + return extensions blob - iterate an extensions blob, find one by extension_type

dependencies 3 imports · 33 importers

nx_syscalls.nx nx_tls13.nx nx_tls13_ext.nx nx_tls13_hello.nx nx_ch_census_oracle.nx nx_ch_census_race_gate.nx nx_edge_serve_static_test.nx nx_https_get_happy_test.nx nx_https_loopback_test.nx nx_tls13_ch_adversarial_test.nx nx_tls13_chrome_hello_gate.nx nx_tls13_client_session.nx nx_tls13_client_session_recv_sh.nx nx_tls13_full_tcp_test.nx

diagram shows first 10 each side; +0 more imports, +23 more importers in the complete lists below.

imports: nx_syscalls.nxnx_tls13.nxnx_tls13_ext.nx

imported by: nx_ch_census_oracle.nxnx_ch_census_race_gate.nxnx_edge_serve_static_test.nxnx_https_get_happy_test.nxnx_https_loopback_test.nxnx_tls13_ch_adversarial_test.nxnx_tls13_chrome_hello_gate.nxnx_tls13_client_session.nxnx_tls13_client_session_recv_sh.nxnx_tls13_full_tcp_test.nxnx_tls13_handshake_io.nxnx_tls13_handshake_tcp_test.nxnx_tls13_hello_test.nxnx_tls13_hrr.nxnx_tls13_hrr_test.nxnx_tls13_loopback_test.nxnx_tls13_p256_loopback_test.nxnx_tls13_server.nxnx_tls13_server_full_handshake_test.nxnx_tls13_server_session_app_data_test.nxnx_tls13_server_session_derive_hs_test.nxnx_tls13_server_session_derive_traffic_test.nxnx_tls13_server_session_emit_certificate_test.nxnx_tls13_server_session_emit_cv_test.nxnx_tls13_server_session_emit_ee_test.nxnx_tls13_server_session_emit_hrr.nxnx_tls13_server_session_emit_sf_test.nxnx_tls13_server_session_emit_sh.nxnx_tls13_server_session_emit_sh_test.nxnx_tls13_server_session_recv_cf_test.nxnx_tls13_server_session_recv_ch.nxnx_tls13_server_session_recv_ch_test.nxnx_tls13_sh_probe_test.nx

structs

none

consts

78const NX_TLS13_HELLO_VERDICT_OK: i64 = 1
79const NX_TLS13_HELLO_VERDICT_BUF_OVERFLOW: i64 = 2
80const NX_TLS13_HELLO_VERDICT_TRUNCATED: i64 = 3
81const NX_TLS13_HELLO_VERDICT_BAD_VERSION: i64 = 4
82const NX_TLS13_HELLO_VERDICT_BAD_HEADER: i64 = 5
83const NX_TLS13_HELLO_VERDICT_NOT_FOUND: i64 = 6
84const NX_TLS13_HELLO_VERDICT_N: i64 = 7
91const NX_TLS13_CS_AES_128_GCM_SHA256: i64 = 0x1301
92const NX_TLS13_CS_AES_256_GCM_SHA384: i64 = 0x1302
93const NX_TLS13_CS_CHACHA20_POLY1305_SHA256: i64 = 0x1303

functions

126func tls13_client_hello_emit(
141func tls13_client_hello_emit2(
256func tls13_client_hello_emit2_h2only(
348func tls13_server_hello_parse(
398func tls13_ext_find(
422func nx_tls13_hello_verdict_is_valid(v: i64) -> i64
called by 1: main
445func tls13_client_hello_parse(