nx_https_get_happy_test.nx
buildroot/runtime/nx_https_get_happy_test.nx
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
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
structs
| none |
consts
| 89 | const HPORT: i64 = 19454 |
| 90 | const NOW_EPOCH: i64 = 1718452800 // 2024-06-15 within cert validity |
functions
| 96 | func hbuild_addr(out: *u8, port: i64) -> i64 called by 1: main |
| 106 | func hread_n(fd: i64, buf: *u8, n: i64) -> i64 |
| 116 | func hwrite_n(fd: i64, buf: *u8, n: i64) -> i64 |
| 128 | func send_tls_plain_record(fd: i64, body: *u8, body_len: i64) -> i64 |
| 143 | func recv_tls_plain_record(fd: i64, out_buf: *u8, out_cap: i64) -> i64 |
| 153 | func send_aead_record(fd: i64, key: *u8, iv: *u8, seq: i64, |
| 169 | func recv_aead_record(fd: i64, key: *u8, iv: *u8, seq: i64, |
| 195 | func derive_s_scalar(priv: *u8, s_out: *u8) -> i64 |
| 206 | func derive_pub_from_priv(priv: *u8, pub_out: *u8) -> i64 called by 1: main calls 6: sys_mmapderive_s_scalarge_p3_alloced25519_basepoint_p3ge_scalar_mulge_p3_compress |
| 221 | func emit_ed25519_algid(buf: *u8, off: i64) -> i64 called by 1: build_cert_with_pub |
| 232 | func emit_utctime(buf: *u8, off: i64, called by 1: build_cert_with_pub |
| 254 | func emit_dnsname(buf: *u8, off: i64, name: *u8, name_len: i64) -> i64 called by 1: build_cert_with_pub |
| 270 | func build_cert_with_pub(buf: *u8, pub: *u8) -> i64 |
| 360 | func sign_cert(buf: *u8, priv: *u8, cert_len: i64) -> i64 |
| 378 | func client_session_run(cfd: i64, cert_for_trust: *u8, cert_len: i64) -> i64 called by 1: main calls 5: trust_store_allocsys_mmapx509_parsetrust_store_addnx_tls13_client_session_run |
| 420 | func server_parse_ch(ch: *u8, ch_len: i64, |
| 444 | func server_derive_keys(s_priv: *u8, c_pub: *u8, th: *u8, eh: *u8, |
| 461 | func build_cv(out: *u8) -> i64 called by 1: server_run |
| 479 | func build_cert_msg(out: *u8, cert: *u8, cert_len: i64) -> i64 called by 1: server_run |
| 502 | func build_ee(out: *u8) -> i64 called by 1: server_run |
| 510 | func build_sf(tx: *u8, shts: *u8, out: *u8) -> i64 called by 1: server_run calls 4: sys_mmapnx_tls13_transcript_snapshottls13_finished_keynx_tls13_finished_compute |
| 524 | func server_run(sfd: i64, cert_for_msg: *u8, cert_len: i64) -> i64 called by 1: main calls 17: sys_mmaprecv_tls_plain_recordserver_parse_chx25519tls13_server_emit_server_hellosend_tls_plain_record+11 |
| 615 | func main() -> i64 |