code wiki / _hdl_build / nx_fw_signed_robust.nx
nx_fw_signed_robust.nx
buildroot/runtime/_hdl_build/nx_fw_signed_robust.nx
about
nx_fw_signed_robust.nx -- the fusion: S-class never-brick (A/B + immutable factory + atomic
commit) WHERE BOOTABILITY = ed25519 SIGNATURE, not just a checksum.
module: nishi-core.genealogy.fw_signed_robust
capability: CORE_COMPUTE (forgery-resistant AND fault-resistant firmware selection)
Rung 6 (nx_fw_robust_flash) survives power loss + double faults but would boot any image with a
valid checksum. Rung 8 (nx_fw_capsule) rejects forgery but had no fallback. FUSED here: the banks
+ factory hold SIGNED capsules, and sr_select boots a bank ONLY if cap_verify passes (signature
valid against the trusted platform key). So a FORGED image planted in the active bank is rejected
at select time and the system falls back to the other bank or the signed immutable factory.
Sandboxed (/tmp). Sovereign: nx_fw_capsule (-> nx_ed25519) + nx_syscalls. license_tier: ORIGINAL
dependencies 2 imports · 1 importers
imports: nx_fw_capsule.nxnx_syscalls.nx
imported by: nx_fw_signed_robust_gate.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 16 | const SR_BANK_A: i64 = 65 |
| 17 | const SR_BANK_B: i64 = 66 |
| 18 | const SR_OK: i64 = 0 |
| 19 | const SR_REJECTED: i64 = 1 // unsigned/forged/corrupt source -> not written |
| 20 | const SR_NO_ANCHOR: i64 = 3 // no signature-valid fallback (active bank nor factory) -> refuse |
| 21 | const SR_VIOLATION: i64 = 4 // a path not under /tmp/ |
| 22 | const SR_HELD: i64 = 6 // inactive write failed verify -> not committed, active retained |
functions
| 24 | func sr_is_sandbox(p: *u8) -> i64 |
| 30 | func sr_tmp(sel: *u8, out: *u8) -> i64 { var o: i64 = cp_cat(out, 0, sel); o = cp_cat(out, o, ".tmp\x00" as *u8); out[o] = 0 as u8; return o } |
| 31 | func sr_read_sel(sel: *u8) -> i64 |
| 41 | func sr_write_sel_atomic(sel: *u8, bankc: i64) -> i64 |
| 49 | func sr_other(bankc: i64) -> i64 { if bankc == SR_BANK_B { return SR_BANK_A } return SR_BANK_B } called by 1: sr_safe_flash |
| 50 | func sr_copy(src: *u8, dst: *u8) -> i64 |
| 60 | func sr_select(sel: *u8, ba: *u8, bb: *u8, fac: *u8) -> *u8 |
| 67 | func sr_selectable(sel: *u8, ba: *u8, bb: *u8, fac: *u8) -> i64 |
| 74 | func sr_safe_flash(sel: *u8, ba: *u8, bb: *u8, fac: *u8, newcap: *u8, corrupt: i64) -> i64 |
| 95 | func main() -> i64 |