code wiki / (root) / nx_tls13_read_record_from_fd_loopback_test.nx

nx_tls13_read_record_from_fd_loopback_test.nx

buildroot/runtime/nx_tls13_read_record_from_fd_loopback_test.nx

4597 B125 linesdepth 8pulls 18 transitivereach 0 importersview sourcekind gate/prooftopic tls13
docsdependenciesstructsconstsfunctions

about

nx_tls13_read_record_from_fd_loopback_test.nx -- REAL happy- path KAT for nx_tls13_read_record_from_fd over real TCP loopback. The existing nx_tls13_read_record_from_fd_test.nx preamble explicitly documents that sys_pipe2 is unreliable in qemu so the original test only exercises bounds-check + read-failure paths. That left the primitive's HAPPY PATH (read a real 5-byte TLS record header + body from a real bidirectional socket) UNVERIFIED. This file closes that gap using the same fork+child socket loopback pattern as nx_https_loopback_test (which has been verified to work in qemu-riscv64-static), exercising ONLY the record-reader primitive in isolation. Test shape: 1. parent: socket + bind + listen on loopback port 2. fork 3. child: socket + connect; build a real TLS record bytes (type=22 handshake, version 0x0303, payload "ABCDE"); sys_write the 10-byte record + close. 4. parent: accept; call nx_tls13_read_record_from_fd(accepted_fd, out_buf, out_cap); verify (a) return value == 10 (5 header + 5 payload) (b) header bytes are correct (0x16 0x03 0x03 0x00 0x05) (c) payload bytes are "ABCDE" 5. parent waits for child + returns child's exit code OR a verdict-specific code if anything mismatched expect_exit: 0 license_tier: ORIGINAL

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_connect.nx nx_tls13.nx nx_tls13_read_record_from_fd.nx nx_tls13_read_record_from_fd_l

imports: nx_syscalls.nxnx_connect.nxnx_tls13.nxnx_tls13_read_record_from_fd.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 build_addr sys_socket sys_bind sys_listen sys_fork child_send_record sys_socket ↻ nx_connect_bounded nx_fcntl sys_connect sys_mmap ↻ sys_poll sys_mmap ↻ sys_write sys_close parent_read_and_verify sys_accept sys_mmap ↻ nx_tls13_read_record_from_ _read_n sys_read sys_close ↻ sys_wait4 wait_exit_code

structs

none

consts

38const TEST_PORT: i64 = 19453

functions

40func build_addr(out: *u8, port: i64) -> i64
called by 1: main
53func child_send_record(addr: *u8) -> i64
78func parent_read_and_verify(lfd: i64) -> i64
104func main() -> i64