code wiki / _hdl_build / nx_token.nx
nx_token.nx
buildroot/runtime/_hdl_build/nx_token.nx
about
nx_token.nx -- CMS layered-spec task #3 (L3-crypto, lowest BUILD): a secure random token for session IDs and
CSRF tokens. Grounded (deep-research wpq1btr1l, OWASP/NIST primary): session IDs need >=64 bits of CSPRNG
entropy, CSRF synchronizer tokens >=128 bits, generated by a CSPRNG. We read the kernel CSPRNG (/dev/urandom)
-- NOT a fast PRNG -- and hex-encode. 16 bytes = 128 bits (covers both). Bottom-up: L0 file read -> L3 token.
Built by the team; Engineer gate = the property test below (length + uniqueness + non-degenerate). Hands a
tested deliverable UP to L7 (cookie/session) and the CSRF binder. license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_syscalls.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
| none |
functions
| 9 | func tk_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 11 | func hexc(v: i64) -> u8 { if v < 10 { return (48 + v) as u8 } return (97 + (v - 10)) as u8 } called by 1: sec_token |
| 14 | func sec_token(out: *u8, nbytes: i64) -> i64 |
| 31 | func main() -> i64 |