code wiki / _hdl_build / nx_cms_pw.nx

nx_cms_pw.nx

buildroot/runtime/_hdl_build/nx_cms_pw.nx

5797 B138 linesdepth 3pulls 6 transitivereach 5 importersview sourcekind librarytopic cms
docsdependenciesstructsconstsfunctions

about

nx_cms_pw.nx -- CMS C10: memory-hard admin-password verification on the team's own argon2id (RFC 9106, the vault KDF v2 primitive -- its 2026-06-10 "integration segfault" was the lane compiler's >6-arg tail-call drop, killed + blessed same day; argon2id itself was never the bug). The credential file <site>/admin_pw.ar2 is SELF-DESCRIBING -- params are DATA in the file, not constants in code (rule 11): ar2 <m_kib> <t> <salt 32 hex chars> <tag 64 hex chars>\n The salt's 32 hex chars are used VERBATIM as the 32-byte salt input (128 bits urandom entropy via st_hex128 at set time; deterministic fixtures may pin it). Production params = the vault's measured m=32768 t=3 (m=1MiB:58ms 8MiB:412ms 64MiB:3644ms on this box, _ar2_perf_probe 2026-06-10); gates may use smaller m -- the file says so, the code never assumes. license_tier: ORIGINAL

dependencies 2 imports · 3 importers

nx_argon2id.nx nx_syscalls.nx nx_cms_pw.nx nx_cms_admin.nx nx_cms_argon_gate.nx nx_cms_setpw2.nx

imports: nx_argon2id.nxnx_syscalls.nx

imported by: nx_cms_admin.nxnx_cms_argon_gate.nxnx_cms_setpw2.nx

structs

none

consts

13const K_MAGIC_1024: i64 = 1024
14const K_MAGIC_2048: i64 = 2048

functions

18func cpw_ctx_new(m_kib: i64) -> *NxArgon2idCtx
called by 2: maincpw_write calls 1: sys_mmap
43func cpw_derive(ctx: *NxArgon2idCtx, pw: *u8, plen: i64, salt32: *u8, m_kib: i64, t: i64, taghex: *u8) -> i64
called by 1: cpw_write calls 2: sys_mmapnx_argon2id_hash
60func cpw_parse(buf: *u8, n: i64, box: *i64, salt_out: *u8, taghex_out: *u8) -> i64
called by 1: main
99func cpw_catnum(dst: *u8, off: i64, v: i64) -> i64
called by 2: cpw_writemain calls 1: sys_mmap
113func cpw_write(path: *u8, pw: *u8, plen: i64, salt32: *u8, m_kib: i64, t: i64) -> i64