code wiki / _hdl_build / nx_tls12_handshake_gate.nx
nx_tls12_handshake_gate.nx
buildroot/runtime/_hdl_build/nx_tls12_handshake_gate.nx
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
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
structs
| none |
consts
| none |
functions
| 37 | func 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 } |
| 38 | func g_n(v: i64) -> i64 |
| 48 | func g_row(id: *u8, ok: i64, pass: *i64) -> i64 calls 1: g_w |
| 53 | func g_cpy(dst: *u8, off: i64, s: *u8) -> i64 |
| 58 | func g_startswith(buf: *u8, n: i64, pat: *u8) -> i64 |
| 73 | func g_handshake(url: *u8, store: *TrustStore, fault: i64, |
| 111 | func g_neg(url: *u8, store: *TrustStore, fault: i64, want: i64) -> i64 |
| 135 | func main() -> i64 |