code wiki / _hdl_build / nx_machine_key.nx
nx_machine_key.nx
buildroot/runtime/_hdl_build/nx_machine_key.nx
about
nx_machine_key.nx -- MACHINE-BOUND key derivation for the sovereign vault (operator's
own-cybersecurity choice: option 2, unattended, hardened as far as software allows). Derives the
vault passphrase from machine-LOCAL identity (/etc/machine-id + hostname) mixed with a repo-stored
PEPPER, via heavily-iterated SHA-256. Writes it to /tmp/nxpass for the gated nx_vault to consume,
then the Warden shreds it. No human prompt; the key never exists on disk -- it is RECONSTRUCTED
each run from machine state.
HONEST THREAT MODEL (recorded so nobody overclaims):
DEFEATS: repo/backup leaks, file theft, cloud sync exposure, a copied vault file alone.
DOES NOT DEFEAT a nation-state with PHYSICAL ACCESS to this exact machine + the binary: a
machine-bound key is, by construction, re-derivable from the machine. True resistance to that
requires a HARDWARE ROOT OF TRUST (TPM2 / the NAS secure element) holding a key that never
leaves silicon -- that is the FLAGGED hardware build, not deliverable in software. argon2id
(memory-hard, already in the team) replacing the SHA-256 stretch is the next software rung.
license_tier: ORIGINAL
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_itoa_lib.nxnx_sha256.nxnx_argon2id.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 20 | const MK_MAGIC_1024: i64 = 1024 |
| 21 | const MK_MAGIC_2048: i64 = 2048 |
| 31 | const MK_ITERS: i64 = 500000 |
| 35 | const MK2_M_KIB: i64 = 32768 |
| 36 | const MK2_T: i64 = 3 |
| 37 | const MK2_P: i64 = 1 |
functions
| 39 | func _p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 44 | func _pn(v: i64) -> i64 { nxi_out(v); return 0 } calls 1: nxi_out |
| 45 | func mk_read(path: *u8, out: *u8, cap: i64, lenbox: *i64) -> i64 |
| 60 | func mk_chomp(buf: *u8, len: i64) -> i64 called by 1: main |
| 66 | func mk_hex(dig: *u8, out: *u8) -> i64 called by 1: main |
| 77 | func mk2_ctx(m_kib: i64) -> *NxArgon2idCtx |
| 100 | func mk_streq(a: *u8, b: *u8) -> i64 called by 1: main |
| 109 | func mk_uidpath(out: *u8) -> i64 |
| 122 | func main(argc: i64, argv: *i64) -> i64 |