code wiki / (root) / nx_install_attest.nx

nx_install_attest.nx

buildroot/runtime/nx_install_attest.nx

7376 B187 linesdepth 7pulls 11 transitivereach 1 importersview sourcekind librarytopic install
docsdependenciesstructsconstsfunctions

about

nx_install_attest.nx -- defensive primitives around install_hash. Composes nx_install_plan + nx_install_hash with three small utilities that close the human-loop + replay-attestation gap: nx_install_hash_to_hex(digest, out_hex) 32-byte binary digest -> 64 ASCII lowercase hex chars. Human- readable form for logs / audit trails / cross-system transfer. nx_install_hash_from_hex(in_hex, out_digest) Inverse: 64 ASCII hex chars -> 32-byte binary digest. Accepts lowercase a-f, uppercase A-F, and 0-9. Rejects any other byte (including spaces / leading 0x / trailing newlines). Caller is responsible for stripping framing. nx_install_hash_verify_against(plan, expected_digest) Recompute install_hash from plan + compare to expected. Returns NX_ATTEST_VERIFIED on bit-equal, NX_ATTEST_TAMPERED on mismatch, NX_ATTEST_BAD_INPUT on null / canary-stomped plan. This is the replay-attestation loop: "given this attested plan + this attested hash, does the plan still hash to the expected value?" Per [[feedback-end-to-end-bit-traceability-architecture]]: the hex form is what gets written into install_attest.jsonl logs + embedded in audit trails. Binary form stays in memory for internal comparison. V1 scope: - lowercase hex emission ("a..f"); decoder tolerates both cases - exactly NX_INSTALL_HASH_BYTES (32) bytes / 64 hex chars; no length negotiation - no leading "0x" / no separators / no whitespace Deferred per roadmap: - cross-machine attestation (in-toto link metadata with signed install_hash) -- SA-7 remainder - Rekor-class append-only audit log -- SA-7 remainder - Byzantine N-of-M attestation chain (multiple independent compile paths must produce bit-equal install_hash) -- SA-7

dependencies 3 imports · 1 importers

nx_syscalls.nx nx_install_plan.nx nx_install_hash.nx nx_install_attest.nx nx_install_attest_test.nx

imports: nx_syscalls.nxnx_install_plan.nxnx_install_hash.nx

imported by: nx_install_attest_test.nx

structs

none

consts

74const NX_ATTEST_VERIFIED: i64 = 0
75const NX_ATTEST_TAMPERED: i64 = 1
76const NX_ATTEST_BAD_INPUT: i64 = 2
77const NX_ATTEST_N: i64 = 3
86const NX_HEX_OK: i64 = 0
87const NX_HEX_BAD_CHAR: i64 = 1
88const NX_HEX_BAD_INPUT: i64 = 2

functions

79func nx_attest_verdict_is_valid(v: i64) -> i64
called by 1: main
92func _nibble_to_hex_lower(n: i64) -> i64
100func _hex_to_nibble(c: i64) -> i64
118func nx_install_hash_to_hex(digest: *u8, out_hex: *u8) -> i64
called by 1: main calls 1: _nibble_to_hex_lower
139func nx_install_hash_from_hex(in_hex: *u8, out_digest: *u8) -> i64
called by 1: main calls 1: _hex_to_nibble
173func nx_install_hash_verify_against(plan: *NxInstallPlan,