code wiki / _hdl_build / nx_cms_pw.nx
nx_cms_pw.nx
buildroot/runtime/_hdl_build/nx_cms_pw.nx
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
imports: nx_argon2id.nxnx_syscalls.nx
imported by: nx_cms_admin.nxnx_cms_argon_gate.nxnx_cms_setpw2.nx
structs
| none |
consts
| 13 | const K_MAGIC_1024: i64 = 1024 |
| 14 | const K_MAGIC_2048: i64 = 2048 |
functions
| 18 | func cpw_ctx_new(m_kib: i64) -> *NxArgon2idCtx |
| 43 | func cpw_derive(ctx: *NxArgon2idCtx, pw: *u8, plen: i64, salt32: *u8, m_kib: i64, t: i64, taghex: *u8) -> i64 |
| 60 | func cpw_parse(buf: *u8, n: i64, box: *i64, salt_out: *u8, taghex_out: *u8) -> i64 called by 1: main |
| 99 | func cpw_catnum(dst: *u8, off: i64, v: i64) -> i64 |
| 113 | func cpw_write(path: *u8, pw: *u8, plen: i64, salt32: *u8, m_kib: i64, t: i64) -> i64 |