code wiki / (root) / nx_tls13_ext.nx

nx_tls13_ext.nx

buildroot/runtime/nx_tls13_ext.nx

22198 B485 linesdepth 2pulls 3 transitivereach 582 importersview sourcekind librarytopic tls13
docsdependenciesstructsconstsfunctions

about

nx_tls13_ext.nx -- TLS 1.3 extension emitters + ServerHello parsers. Phase 0b §F.1 of the Nishi TLS 1.3 stack per docs/NISHI_TLS13_GAP_AUDIT.md. The byte-level emit functions for the 5 extensions a minimum-credible TLS 1.3 ClientHello MUST carry, plus parse functions for the two extensions a ServerHello echoes back (supported_versions + key_share). Per RFC 8446 §9.2: any TLS 1.3 ClientHello MUST contain supported_versions, supported_groups, key_share, and signature_algorithms. We add server_name (RFC 6066 §3) so we can talk to TLS-vhosted servers, and we make ALPN trivially extendable. Wire format per extension is: uint16 extension_type uint16 extension_data_length opaque extension_data[extension_data_length] What it does today: Client emit: - server_name (SNI, RFC 6066 §3, host_name only) - supported_versions client-variant TLS 1.3 only (§4.2.1) - supported_groups X25519 + secp256r1 (§4.2.7) - signature_algorithms ed25519 + rsa_pss_rsae_sha256 + rsa_pss_rsae_sha384 + ecdsa_secp256r1_sha256 (§4.2.3) - key_share client X25519 only (§4.2.8) Server parse: - supported_versions server-variant (single u16) (§4.2.1) - key_share server-variant (single KeyShareEntry) (§4.2.8) What it doesn't do yet: - ALPN emit/parse (queued; single-protocol case is trivial, multi-protocol needs a more general list helper) - psk_key_exchange_modes (queued with Gap M resumption) - pre_shared_key (queued with Gap M) - cookie (HRR path; queued with Gap G) - additional cert chain extensions (status_request, SCT) - additional named groups (P-384, P-521, Kyber, X25519+Kyber768) - additional signature schemes (ecdsa_secp384r1_sha384,

dependencies 2 imports · 17 importers

nx_syscalls.nx nx_tls13.nx nx_tls13_ext.nx nx_h2_conformance.nx nx_https_get_happy_test.nx nx_https_loopback_test.nx nx_p256_keyshare_test.nx nx_sni_extract_gate.nx nx_sni_router_gate.nx nx_tls12_hello.nx nx_tls13_alpn_test.nx nx_tls13_ext_test.nx nx_tls13_full_tcp_test.nx

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

imports: nx_syscalls.nxnx_tls13.nx

imported by: nx_h2_conformance.nxnx_https_get_happy_test.nxnx_https_loopback_test.nxnx_p256_keyshare_test.nxnx_sni_extract_gate.nxnx_sni_router_gate.nxnx_tls12_hello.nxnx_tls13_alpn_test.nxnx_tls13_ext_test.nxnx_tls13_full_tcp_test.nxnx_tls13_handshake_io.nxnx_tls13_handshake_tcp_test.nxnx_tls13_hello.nxnx_tls13_hello_test.nxnx_tls13_loopback_test.nxnx_tls13_server_session_emit_ee_alpn.nxnx_tls13_server_session_emit_sh.nx

structs

none

consts

63const NX_MAGIC_65535: i64 = 65535
66const NX_TLS13_EXT_VERDICT_OK: i64 = 1
67const NX_TLS13_EXT_VERDICT_BUF_OVERFLOW: i64 = 2
68const NX_TLS13_EXT_VERDICT_BAD_FORMAT: i64 = 3
69const NX_TLS13_EXT_VERDICT_TRUNCATED: i64 = 4
70const NX_TLS13_EXT_VERDICT_UNSUPPORTED: i64 = 5
71const NX_TLS13_EXT_VERDICT_N: i64 = 6
74const NX_TLS13_SNI_NAME_TYPE_HOST: i64 = 0

functions

91func tls13_ext_emit_server_name(
121func tls13_ext_emit_supported_versions_tls13(out: *u8, out_cap: i64) -> i64
161func tls13_ext_emit_alpn_http11(out: *u8, out_cap: i64) -> i64
196func tls13_ext_emit_alpn_h2_http11(out: *u8, out_cap: i64) -> i64
called by 1: main calls 1: tls_write_u16_be
240func tls13_ext_emit_alpn_h2_only(out: *u8, out_cap: i64) -> i64
272func tls13_ext_parse_alpn_selected(
called by 2: mainmain calls 1: tls_read_u16_be
300func tls13_ext_emit_supported_groups(out: *u8, out_cap: i64) -> i64
323func tls13_ext_emit_signature_algorithms(out: *u8, out_cap: i64) -> i64
355func tls13_ext_emit_key_share_x25519(
387func tls13_ext_emit_key_share_dual(
423func tls13_ext_emit_key_share_p256(
449func tls13_ext_parse_supported_versions_server(
called by 2: cc_sh_is_tls13main calls 1: tls_read_u16_be
464func tls13_ext_parse_key_share_server(
called by 1: main calls 1: tls_read_u16_be
481func nx_tls13_ext_verdict_is_valid(v: i64) -> i64
called by 1: main