code wiki / bin / nx_mtls_test_daemon.nx

nx_mtls_test_daemon.nx

buildroot/runtime/bin/nx_mtls_test_daemon.nx

5759 B110 linesdepth 15pulls 81 transitivereach 0 importersview sourcekind servicetopic mtls
docsdependenciesstructsconstsfunctions

about

nx_mtls_test_daemon.nx -- the mTLS INTEROP test daemon: proves run_ecdsa_mtls completes a real TLS 1.3 MUTUAL-auth handshake against a STANDARD client (openssl s_client / curl / a browser), and that run_ecdsa_mtls VERIFIES the client cert that the standard client presents. This is the byte-level interop the loopback gate cannot cover (the loopback proves the LOGIC against our own message construction; THIS proves the wire format is correct against OpenSSL/Schannel/BoringSSL). It is the de-risk gate before the live doc-wall cutover. NOT a live daemon -- a throwaway harness. Adapted from nx_tls13_ed25519_test_daemon (the proven server-auth interop pattern) by swapping run_ed25519 -> run_ecdsa_mtls and logging the client-auth result. FLOW: read ECDSA server cert+key (the demo P-256 cert) -> bind 127.0.0.1:7444 -> accept ONE conn -> run_ecdsa_mtls (sends CertificateRequest; reads + verifies the client's Certificate+CertificateVerify+Finished) -> LOG auth result + the verified identity -> send a tiny HTTP body -> exit. COMPOSES (sovereign): nx_csprng + nx_http_server + nx_tls13_server_session_run_mtls + app_send + nx_mtls_authz.

dependencies 7 imports · 0 importers

nx_syscalls.nx nx_csprng.nx nx_http_server.nx nx_tls13_server_session.nx nx_tls13_server_session_run_mtls.n nx_tls13_server_session_app_data.n nx_mtls_authz.nx nx_mtls_test_daemon.nx

imports: nx_syscalls.nxnx_csprng.nxnx_http_server.nxnx_tls13_server_session.nxnx_tls13_server_session_run_mtls.nxnx_tls13_server_session_app_data.nxnx_mtls_authz.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 sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close mtd_log sys_write mtd_slen nx_csprng_fill sys_mmap ↻ nx_csprng_urandom_path sys_openat_rd ↻ sys_read ↻ sys_close ↻ nx_http_server_addr_loopba nx_http_server_make_sockad nx_http_server_listen sys_ignore_sigpipe sys_mmap ↻ sys_socket sys_mmap ↻ sys_setsockopt sys_bind sys_close ↻ sys_listen nx_http_server_accept_one sys_accept sys_close ↻ nx_tls13_server_session_ru nx_tls13_server_session_ne sys_mmap ↻ x25519_keypair_public sys_mmap ↻ x25519_base_point x25519 nx_scratch_save nx_scratch_init

structs

none

consts

22const NX_MTD_PORT: i64 = 7444
24const NX_MTD_HTTP_RESP: *u8 = "HTTP/1.0 200 OK\r\nContent-Type: text/plain\r\nContent-Length: 8\r\nConnection: close\r\n\r\nMTLS-OK\n" as *u8
25const NX_MTD_HTTP_RESP_N: i64 = 91

functions

27func mtd_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 2: mtd_logmtd_log_int
28func mtd_log(s: *u8) -> i64 { sys_write(1, s, mtd_slen(s)); return 0 }
called by 1: main calls 2: sys_writemtd_slen
30func mtd_log_int(label: *u8, v: i64) -> i64
called by 1: main calls 3: sys_writemtd_slensys_mmap
46func main() -> i64