code wiki / (root) / nx_https_get_happy_test.nx

nx_https_get_happy_test.nx

buildroot/runtime/nx_https_get_happy_test.nx

24381 B657 linesdepth 19pulls 115 transitivereach 0 importersview sourcekind gate/prooftopic https
docsdependenciesstructsconstsfunctions

about

nx_https_get_happy_test.nx -- REAL fork+child happy-path KAT for the nx_https_get / nx_tls13_client_session_run state machine over TCP loopback. Closes the verdict-only gap explicitly named in the 2026-05-19 PM honest verification audit (NISHI_HTTPS_ARC_STATUS_2026_05_19.md): "nx_https_get (commit 72771424): only tests BAD_URL paths. The full handshake + GET round-trip against a real or loopback HTTPS server is NOT yet a KAT. The lower wire layer IS verified via the pre-existing nx_https_loopback_test (fork+child TCP loopback running both TLS endpoints in NishiLang), but that test bypasses the Tls13ClientSession state machine wrapper..." This file builds the loopback test that DOES exercise the session state machine wrapper. Architecture: Parent process (CLIENT): - socket+bind+listen on 127.0.0.1:19454 - accept(); pass accepted fd to nx_tls13_client_session_run - assert session_run returns POSITIVE pointer (= state reached CONNECTED, all 4 dispatched recv_hs verdicts OK, app keys derived) Child process (SERVER): - socket+connect to loopback port - read ClientHello as REAL TLS record (5-byte header) - emit ServerHello as REAL TLS record (5-byte header) - derive handshake keys - emit AEAD-encrypted EE + Cert + CV + SF records - read AEAD-encrypted CF record The CERT carried in the Certificate message is a REAL 197-byte minimal v1 Ed25519 cert with SAN entry "localhost" matching the SNI hostname used by the client. The cert's outer sig is a REAL Ed25519 signature over its own TBS bytes (now that SHA-512 K constants are fixed -- commit c9ffedfd -- Ed25519 sign produces canonical FIPS-compliant output).

dependencies 22 imports · 0 importers

nx_syscalls.nx nx_connect.nx nx_sha256.nx nx_sha512.nx nx_ed25519.nx nx_ed25519_signature.nx nx_ed25519_scalar.nx nx_ed25519_arith.nx nx_x25519.nx nx_x509.nx nx_https_get_happy_test.nx

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

imports: nx_syscalls.nxnx_connect.nxnx_sha256.nxnx_sha512.nxnx_ed25519.nxnx_ed25519_signature.nxnx_ed25519_scalar.nxnx_ed25519_arith.nxnx_x25519.nxnx_x509.nxnx_x509_trust_store.nxnx_tls13.nxnx_tls13_ext.nxnx_tls13_hello.nxnx_tls13_finished.nxnx_tls13_transcript.nxnx_tls13_handshake.nxnx_tls13_schedule.nxnx_tls13_record.nxnx_tls13_server.nxnx_tls13_client_validate_certificate.nxnx_tls13_client_session_run.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 derive_pub_from_priv sys_mmap ↻ derive_s_scalar sys_mmap ↻ ed25519_sha512 sys_mmap ↻ sha512_init sha512_update sha512_blk_set_byte blk_get_i64 blk_set_i64 sha512_compress sys_mmap ↻ blk_get_i64 ↻ sha512_gamma0 sha512_gamma1 sha512_sigma1 sha512_ch sha512_k sha512_sigma0 sha512_maj sha512_final sha512_blk_set_byte ↻ sha512_compress ↻ ge_p3_alloc sys_mmap ↻ fe_alloc nx_scratch nx_scratch_init sys_mmap ↻ nx_scratch_oom sys_write sys_exit sys_mmap ↻ fe_zero ed25519_basepoint_p3 sys_mmap ↻ ge_p3_decompress

structs

none

consts

89const HPORT: i64 = 19454
90const NOW_EPOCH: i64 = 1718452800 // 2024-06-15 within cert validity

functions

96func hbuild_addr(out: *u8, port: i64) -> i64
called by 1: main
106func hread_n(fd: i64, buf: *u8, n: i64) -> i64
116func hwrite_n(fd: i64, buf: *u8, n: i64) -> i64
128func send_tls_plain_record(fd: i64, body: *u8, body_len: i64) -> i64
called by 1: server_run calls 2: sys_mmaphwrite_n
143func recv_tls_plain_record(fd: i64, out_buf: *u8, out_cap: i64) -> i64
called by 1: server_run calls 1: hread_n
153func send_aead_record(fd: i64, key: *u8, iv: *u8, seq: i64,
169func recv_aead_record(fd: i64, key: *u8, iv: *u8, seq: i64,
195func derive_s_scalar(priv: *u8, s_out: *u8) -> i64
206func derive_pub_from_priv(priv: *u8, pub_out: *u8) -> i64
221func emit_ed25519_algid(buf: *u8, off: i64) -> i64
called by 1: build_cert_with_pub
232func emit_utctime(buf: *u8, off: i64,
called by 1: build_cert_with_pub
254func emit_dnsname(buf: *u8, off: i64, name: *u8, name_len: i64) -> i64
called by 1: build_cert_with_pub
270func build_cert_with_pub(buf: *u8, pub: *u8) -> i64
360func sign_cert(buf: *u8, priv: *u8, cert_len: i64) -> i64
called by 1: main calls 2: sys_mmaped25519_sign_full
378func client_session_run(cfd: i64, cert_for_trust: *u8, cert_len: i64) -> i64
420func server_parse_ch(ch: *u8, ch_len: i64,
444func server_derive_keys(s_priv: *u8, c_pub: *u8, th: *u8, eh: *u8,
461func build_cv(out: *u8) -> i64
called by 1: server_run
479func build_cert_msg(out: *u8, cert: *u8, cert_len: i64) -> i64
called by 1: server_run
502func build_ee(out: *u8) -> i64
called by 1: server_run
510func build_sf(tx: *u8, shts: *u8, out: *u8) -> i64
524func server_run(sfd: i64, cert_for_msg: *u8, cert_len: i64) -> i64
615func main() -> i64