nx_install_attest.nx
buildroot/runtime/nx_install_attest.nx
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
imports: nx_syscalls.nxnx_install_plan.nxnx_install_hash.nx
imported by: nx_install_attest_test.nx
structs
| none |
consts
| 74 | const NX_ATTEST_VERIFIED: i64 = 0 |
| 75 | const NX_ATTEST_TAMPERED: i64 = 1 |
| 76 | const NX_ATTEST_BAD_INPUT: i64 = 2 |
| 77 | const NX_ATTEST_N: i64 = 3 |
| 86 | const NX_HEX_OK: i64 = 0 |
| 87 | const NX_HEX_BAD_CHAR: i64 = 1 |
| 88 | const NX_HEX_BAD_INPUT: i64 = 2 |
functions
| 79 | func nx_attest_verdict_is_valid(v: i64) -> i64 called by 1: main |
| 92 | func _nibble_to_hex_lower(n: i64) -> i64 called by 1: nx_install_hash_to_hex |
| 100 | func _hex_to_nibble(c: i64) -> i64 called by 1: nx_install_hash_from_hex |
| 118 | func nx_install_hash_to_hex(digest: *u8, out_hex: *u8) -> i64 |
| 139 | func nx_install_hash_from_hex(in_hex: *u8, out_digest: *u8) -> i64 |
| 173 | func nx_install_hash_verify_against(plan: *NxInstallPlan, called by 1: main calls 4: nx_install_plan_is_validsys_mmapnx_install_hash_computenx_install_hash_eq |