code wiki / (root) / nx_x509_leaf_check_test.nx

nx_x509_leaf_check_test.nx

buildroot/runtime/nx_x509_leaf_check_test.nx

12613 B295 linesdepth 6pulls 8 transitivereach 0 importersview sourcekind gate/prooftopic x509
docsdependenciesstructsconstsfunctions

about

nx_x509_leaf_check_test.nx -- orchestrator verdict-mapping KAT. We do NOT round-trip through x509_parse here (the parser has its own existing coverage via nx_x509_validate and the SAN+validity smokes). Instead we exercise the orchestrator's dispatch logic directly by manually constructing X509Cert struct contents + the byte buffers the sub-primitives walk, then calling x509_leaf_check via a structural fast-path. Specifically we test the cases that x509_leaf_check can encounter in production once chained behind x509_parse on a real DER cert: - all checks pass -> NX_X509_LEAF_OK - parse failure (DER too short / corrupt) -> PARSE_FAIL - notBefore in future -> NOT_YET_VALID - notAfter in past -> EXPIRED - SAN missing -> NO_SAN - SAN present, hostname not covered -> HOSTNAME_MISMATCH - bad SAN format -> BAD_FORMAT - bad SAN pattern -> BAD_PATTERN - sealed verdict gate Note: x509_leaf_check internally calls x509_parse, but for the OK / SAN-mismatch / etc. cases we need a real DER cert. We build a minimal-but-real one inline. expect_exit: 0 license_tier: ORIGINAL

dependencies 5 imports · 0 importers

nx_syscalls.nx nx_x509.nx nx_x509_validity.nx nx_x509_san.nx nx_x509_leaf_check.nx nx_x509_leaf_check_test.nx

imports: nx_syscalls.nxnx_x509.nxnx_x509_validity.nxnx_x509_san.nxnx_x509_leaf_check.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_min_cert emit_ed25519_algid emit_utctime emit_dnsname x509_leaf_check sys_mmap ↻ x509_parse sys_mmap ↻ asn1_cursor_init asn1_expect_tag sys_mmap ↻ asn1_read_tlv_header asn1_read_tag asn1_read_length asn1_read_length ↻ x509_read_tlv sys_mmap ↻ asn1_expect_tag ↻ x509_read_alg_id sys_mmap ↻ asn1_expect_tag ↻ x509_validity_check sys_mmap ↻ x509_validity_get sys_mmap ↻ x509_read_time_tlv parse_utctime parse_2digit days_from_civil parse_gentime parse_4digit parse_2digit ↻ days_from_civil ↻ x509_san_match_hostname sys_mmap ↻ x509_san_locate sys_mmap ↻ asn1_expect_tag ↻

structs

none

consts

none

functions

38func emit_utctime(buf: *u8, off: i64,
called by 1: build_min_cert
62func emit_ed25519_algid(buf: *u8, off: i64) -> i64
called by 1: build_min_cert
74func emit_dnsname(buf: *u8, off: i64, name: *u8, name_len: i64) -> i64
called by 1: build_min_cert
128func build_min_cert(buf: *u8, host: *u8, host_len: i64) -> i64
234func main() -> i64