code wiki / _hdl_build / _drv_f1_gate.nx
_drv_f1_gate.nx
buildroot/runtime/_hdl_build/_drv_f1_gate.nx
about
_drv_f1_gate.nx -- gate for CONSENT-GATED DEVICE TELEMETRY (X-DRV-F1). NO mocks.
Drives the REAL nx_telemetry through the full consent lifecycle and asserts the privacy contract:
(1) NO-SHARE-BY-DEFAULT -- with a consent file carrying NO opt-in rows, the shared outbox stays
EMPTY and the local store is populated. Nothing leaves the device by default.
(2) OPT-IN -- a consent row "2 SHARED" makes deviceid=2's record appear in the shared outbox,
carrying a signature + the node public key (provenance).
(3) SIGNED-VERIFIES -- the shared record's ed25519 signature genuinely verifies over its payload
with the published pubkey (ed25519_verify_full == SIG_OK); a TAMPER (flip a payload byte)
makes verification FAIL -> the signature really binds the payload, not a decorative tag.
(4) REVOKE -- flipping the consent back to "2 LOCAL" makes the next run share NOTHING new.
Evidence -> knowledge/status/telemetry.log (DRVF1GATE row). Sovereign. license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_ed25519_signature.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
| 17 | const F_TELE: *u8 = "_offc/nx_telemetry.elf" |
| 18 | const F_DEVMAP: *u8 = "knowledge/registry/emu_devmap.tsv" |
| 19 | const F_SHARED: *u8 = "knowledge/status/telemetry_shared.log" |
| 20 | const F_LOCAL: *u8 = "knowledge/status/telemetry_local.log" |
functions
| 22 | func g_p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 23 | func g_fp(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 } |
| 24 | func g_fn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 } |
| 26 | func g_run(prog: *u8, a1: *u8, a2: *u8) -> i64 |
| 48 | func g_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 58 | func g_write_file(path: *u8, s: *u8) -> i64 |
| 65 | func g_truncate(path: *u8) -> i64 { let fd: i64 = sys_openat_wr(path, 0x1a4); if fd >= 0 { sys_close(fd) } return 0 } |
| 67 | func g_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 70 | func g_count(buf: *u8, n: i64, pat: *u8) -> i64 |
| 79 | func g_find(buf: *u8, n: i64, from: i64, pat: *u8) -> i64 |
| 88 | func g_hexdec(src: *u8, hexlen: i64, out: *u8) -> i64 called by 1: main |
| 104 | func main() -> i64 |