code wiki / _hdl_build / nx_tls12_handshake_gate.nx

nx_tls12_handshake_gate.nx

buildroot/runtime/_hdl_build/nx_tls12_handshake_gate.nx

11117 B248 linesdepth 17pulls 108 transitivereach 0 importersview sourcekind gate/prooftopic tls12
docsdependenciesstructsconstsfunctions

about

nx_tls12_handshake_gate.nx -- SOVEREIGN, LIVE gate for PHASE 2 of the TLS 1.2 client: a FULL handshake (ECDHE-RSA-AES128-GCM-SHA256) to a real TLS-1.2-max host, proving the encrypted session works end-to-end. PRIMARY TARGET = api.porkbun.com (the real goal: a TLS-1.2-max host our 1.3-only client cannot reach; needed for nx_porkbun_set_txt -> ACME wildcard renew). The gate: 1. Loads the real Mozilla CA bundle (data/mozilla_certdata.txt) into a TrustStore. 2. Connects + runs the full handshake (production path, no fault): ClientHello -> server flight -> CERT-CHAIN VALIDATE -> SKE VERIFY -> ECDHE -> key schedule -> ClientKeyExchange + ChangeCipherSpec + encrypted client Finished -> server ChangeCipherSpec + encrypted server Finished VERIFY. MUST reach CONNECTED. 3. Over the established session sends a real GET / HTTP/1.1\r\nHost: <h>\r\nConnection: close\r\n\r\n decrypts the response, and asserts it begins with "HTTP/1.1 " (ANY status proves the encrypted session works). 4. NEG-CONTROLS (liar-kill -- the session MUST FAIL CLOSED if any security check is bypassed): a. EMPTY trust store -> cert validation FAILS -> no session b. tampered SKE signature -> SKE verify FAILS -> no session c. tampered server Finished -> Finished MAC FAILS -> no session expect_exit: 0 license_tier: ORIGINAL

dependencies 8 imports · 0 importers

nx_syscalls.nx nx_url.nx nx_https_url_for_fetch.nx nx_https_url_connect.nx nx_x509_trust_store.nx nx_trust_store_load_from_certdata. nx_tls13_client_validate_certifica nx_tls12_client_session.nx nx_tls12_handshake_gate.nx

imports: nx_syscalls.nxnx_url.nxnx_https_url_for_fetch.nxnx_https_url_connect.nxnx_x509_trust_store.nxnx_trust_store_load_from_certdata.nxnx_tls13_client_validate_certificate.nxnx_tls12_client_session.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap g_w sys_write nx_trust_store_load_from_c sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close nx_nss_certdata_parse sys_mmap ↻ _pat_class_cert _pat_value_octal _pat_end _find_newline _starts_with _parse_octal_line sys_mmap ↻ _is_space _decode_octal_escape _is_octal trust_store_alloc sys_mmap ↻ nx_x509_trust_store_load sys_mmap ↻ x509_parse sys_mmap ↻ asn1_cursor_init asn1_expect_tag sys_mmap ↻ asn1_read_tlv_header asn1_read_tag asn1_read_length asn1_read_length ↻ x509_read_tlv sys_mmap ↻ asn1_expect_tag ↻

structs

none

consts

none

functions

37func g_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 4: g_ng_rowg_negmain calls 1: sys_write
38func g_n(v: i64) -> i64
called by 2: g_negmain calls 3: g_wsys_mmapsys_write
48func g_row(id: *u8, ok: i64, pass: *i64) -> i64
calls 1: g_w
53func g_cpy(dst: *u8, off: i64, s: *u8) -> i64
58func g_startswith(buf: *u8, n: i64, pat: *u8) -> i64
73func g_handshake(url: *u8, store: *TrustStore, fault: i64,
111func g_neg(url: *u8, store: *TrustStore, fault: i64, want: i64) -> i64
135func main() -> i64