code wiki / (root) / nx_drm_audit.nx

nx_drm_audit.nx source

↩ module page · 80 lines · 4706 B

1// nx_drm_audit.nx -- cartridge/printer DRM auditor: classify the DRM mechanism(s) in play and pair each with 2// the HONEST bypass, NEVER-BRICK by construction (#26). Grounded in the sovereign researcher's cited cases: 3// - "fake empty" (vendor disables a cartridge while consumable remains) -- HP $5M settlement. 4// - firmware that blocks 3rd-party consumables -- HP ($1.5M), Epson (2019 class action), Canon, Brother 5// (HOP planned-obsolescence suit). [Brother/HP/Canon/Epson all named.] 6// - smart chips enforcing genuine/region/expiry -- chip-resetters exist; Brother chipped since 2017. 7// 8// THE NEVER-BRICK PROPERTY (#26, brand-critical, proven MECHANICALLY here, not asserted as a promise): EVERY 9// bypass this auditor recommends is read-only / reversible / externally-guided and writes NO printer firmware/ 10// NVRAM. A hypothetical firmware-write action is included so the gate can PROVE the recommender never emits it. 11// 12// PURE arithmetic classifier, no syscalls -> safe by construction. license_tier: ORIGINAL 13// genealogy_id: project-printer-management-ipp-sclass-2026-06-20 14 15// ---- vendor ids (for the firmware-block knowledge -- grounded in the lawsuits) ---- 16const NX_DRMV_UNKNOWN: i64 = 0 17const NX_DRMV_HP: i64 = 1 18const NX_DRMV_EPSON: i64 = 2 19const NX_DRMV_CANON: i64 = 3 20const NX_DRMV_BROTHER: i64 = 4 21 22// ---- DRM mechanism flags (bitmask) ---- 23const NX_DRM_NONE: i64 = 0 24const NX_DRM_FAKE_EMPTY: i64 = 1 // reports empty while consumable remains (HP $5M class) 25const NX_DRM_FIRMWARE_BLOCK: i64 = 2 // firmware disables 3rd-party consumables (HP/Epson/Canon/Brother) 26const NX_DRM_CHIP: i64 = 4 // smart chip enforces genuine/region/expiry 27 28// ---- sealed bypass actions -- EVERY one read-only/reversible/guided; NONE writes printer firmware ---- 29const NX_BYP_NONE: i64 = 0 30const NX_BYP_CONTINUE_MODE: i64 = 1 // the printer's OWN reversible Continue setting + trust our real coverage 31const NX_BYP_REFUSE_FIRMWARE: i64 = 2 // do NOT apply the vendor firmware update; our IPP path ignores driver-DRM 32const NX_BYP_CHIP_RESET: i64 = 3 // external chip-reset tool on the CARTRIDGE's chip (guided, physical) 33const NX_BYP_FIRMWARE_DOWNGRADE: i64 = 9 // DANGEROUS: writes printer firmware -- we NEVER recommend this (#26) 34 35// Is this vendor known to ship firmware that blocks 3rd-party consumables? (grounded: HP/Epson/Canon/Brother 36// all named in the firmware-block + planned-obsolescence lawsuits the researcher surfaced.) 37func nx_drm_vendor_blocks(vendor: i64) -> i64 { 38 if vendor == NX_DRMV_HP { return 1 } 39 if vendor == NX_DRMV_EPSON { return 1 } 40 if vendor == NX_DRMV_CANON { return 1 } 41 if vendor == NX_DRMV_BROTHER { return 1 } 42 return 0 43} 44 45// Classify the DRM mechanisms in play. reported_empty = the printer says the supply is empty (level 0 / 46// marker-supply-empty). real_remaining_bp = OUR coverage-based remaining (10000=100%, -1=unknown). 47// cartridge_chipped = 1 if this cartridge class carries a smart chip (data-driven model table at the caller). 48func nx_drm_classify(vendor: i64, cartridge_chipped: i64, reported_empty: i64, real_remaining_bp: i64) -> i64 { 49 var flags: i64 = 0 50 // FAKE-EMPTY: vendor says empty, but OUR independent measurement says meaningful toner remains (>=10%). 51 // Requiring real-remaining >= 10% is the HONEST guard: at genuine near-empty we do NOT cry DRM. 52 if reported_empty == 1 { if real_remaining_bp >= 1000 { flags = flags | NX_DRM_FAKE_EMPTY } } 53 if nx_drm_vendor_blocks(vendor) == 1 { flags = flags | NX_DRM_FIRMWARE_BLOCK } 54 if cartridge_chipped == 1 { flags = flags | NX_DRM_CHIP } 55 return flags 56} 57 58func nx_drm_flag_count(flags: i64) -> i64 { 59 var c: i64 = 0 60 if (flags & NX_DRM_FAKE_EMPTY) != 0 { c = c + 1 } 61 if (flags & NX_DRM_FIRMWARE_BLOCK) != 0 { c = c + 1 } 62 if (flags & NX_DRM_CHIP) != 0 { c = c + 1 } 63 return c 64} 65 66// The honest bypass for a given single DRM flag. Always a SAFE (never-brick) action. 67func nx_drm_bypass_for(flag: i64) -> i64 { 68 if flag == NX_DRM_FAKE_EMPTY { return NX_BYP_CONTINUE_MODE } 69 if flag == NX_DRM_FIRMWARE_BLOCK { return NX_BYP_REFUSE_FIRMWARE } 70 if flag == NX_DRM_CHIP { return NX_BYP_CHIP_RESET } 71 return NX_BYP_NONE 72} 73 74// NEVER-BRICK PROOF (#26): does this bypass action write persistent printer firmware/NVRAM/EEPROM? Must be 0 75// for every action the recommender emits. Only the hypothetical DANGEROUS action returns 1 -- so the gate can 76// prove the function discriminates AND that nx_drm_bypass_for never emits it. 77func nx_drm_bypass_writes_firmware(action: i64) -> i64 { 78 if action == NX_BYP_FIRMWARE_DOWNGRADE { return 1 } 79 return 0 80}