aboutsummaryrefslogtreecommitdiffstats
path: root/psp_emu/tests (follow)
Commit message (Collapse)AuthorAge
* Strategy shift: structural controls (pspemu/oracle.py), then CCP as an oracleuser2026-09-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Diagnosis first. One session produced ~10 findings and ~10 instrument failures, and every wrong conclusion came from a broken measurement rather than broken reasoning: a flat status oracle from a wrong readback address, three traces truncated by hook ranges, a positive control taken from a different firmware build, detectors that could not find a known positive, an MMIO window that echoed byteswap(addr), a plausible model fix that measurement showed made things worse, a consumer scan blind to base+offset addressing, a control that failed for an unrelated reason and retracted a CORRECT result, and a failed probe reinterpreted until it looked positive. So ideas are not the bottleneck; trustworthy measurement is. And controls invented alongside a measurement tend to share its blind spot -- several of the above controls were themselves wrong. Prong 1, done here: pspemu/oracle.py binds a question to the two controls that make its answer meaningful. A positive control that must fire, or the instrument is blind; a negative control that must not, or it is indiscriminate. Result.get() raises unless both held, so a meaningless number cannot be read by accident, and Probe.report() exits non-zero rather than printing a vacuous clean run. The negative control is the half usually skipped and the half that catches the byteswap-echo shape. Unit-tested against the real failure shapes in tests/test_oracle.py and retrofitted onto routec_window_watch.py, which keeps its result. Prong 2, proposed in psp_out/STRATEGY-MEASUREMENT-FIRST.md: attack observability through the CCP. Route C's window nature, VCN write landing, and the TMR boundary are all blocked on having no read path into PSP-internal space. But AMD's ccp.h, already adopted as CMD_ERROR_NAMES, shows the CCP distinguishes IDMA/ODMA page faults from protection faults. That makes CCP status a classification oracle: mapped vs unmapped vs protected, without reading a byte. Every previous attempt needed a channel returning DATA and none exists; this needs only STATUS, which demonstrably works already. First step is deliberately cheap and falsifiable: prove the statuses separate per-address in the emulator, or abandon the strategy there.
* Adopt verified CCP semantics from the leaked AMD SP treeuser2026-09-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ~/src/amd_data is a Microsoft Xbox security depot containing genuine AMD source (headers dated 2010-2014, Durango/Kryptos APU era). Assessed it and took only the parts that could be cross-checked. The lineage is measured rather than assumed: sp/hwinit/ccp.h's engine IDs match our independently reversed values on 7 of 8, the sole difference being ID 2 (TRNG there, DES3 now), a known generational change. That agreement is the evidence for trusting anything else in the file. Adopted: - SHA-224 as CCP SHA type 2. The source enumerates SHA_1=1, SHA_224=2, SHA_256=3, and type 3 agrees with what we already had, which is what makes the other two credible. No firmware we hold requests SHA-224, so it is VERIFIED against hashlib over empty/short/multi-block/256-byte inputs in tests/test_smoke.py instead of being trusted on provenance. - SHA-1 named but deliberately NOT implemented: 5-word state, different compression function, unrequested by anything we hold. Naming it makes an encounter report the real reason rather than "unsupported type 1"; a wrong implementation would be worse than an honest refusal. - CMD_ERROR_NAMES, the full CCP_CMD_ERROR_* table (0x00-0x25), so queue failures report what the hardware said. Out-of-table codes render as UNKNOWN(0x..) rather than being mapped to something plausible. Note 0x14 IDMA_PROTECTION_FAULT and 0x24 ODMA_PROTECTION_FAULT: a CCP DMA into protected memory is reported, not silently dropped, which bears on the confused-deputy-writer angle. Documented in psp_out/SOURCE-AMD-SP-TREE-WHAT-IT-GIVES-US.md, including what is present but unused (fuse chain addressing, ccp_job_t field semantics, an SCP SVC table) and what is absent (no $PSP format, no sOS/sys_drv lineage). Recorded the trap prominently: this is a VOCABULARY source, not an address source. Its mm*/ix* offsets are for a 2014 Xbox APU, and lifting them would repeat the version-mismatch failure that already cost us twice this session -- the v53 map being wrong for TSU, and bl_set_boot_stage's 0x2161C control coming from a different build. Suite green.
* Initial import: AMD PSP reverse engineering, emulator and vulnerability researchPeter Geissler2026-09-22
Split out of a tinygrad working tree, where all of this lived untracked. tinygrad remains a dependency for hardware-facing scripts only. Contents: psp_emu/ Unicorn-based PSP emulator that boots the real signed firmware from the ARM reset vector: sOS -> SYS_DRV -> HDCP/DTM/RAS TAs, with a CCP crypto device model faithful enough to run the firmware's own drivers (RSA-PSS/SHA-256 container verification passes 5/5 with 5/5 negatives rejected). A simulated host drives the real mailbox/ring path through to TA_InvokeCommandEntryPoint. psp_out/ Static analysis: six PSP modules fully named (asd 1562, sys_drv 1141, sos 527, ras 119, hdcp 109, dtm 14) plus SMU 1033, a cross-version diffing pipeline over 34+ builds, per-handler annotated analysis and ~125 findings documents. Deliberately not tracked: AMD firmware images, the Hex-Rays decompilation derived from them, and IDA databases. data/MANIFEST.sha256 pins the SHA-256 of all 301 blobs results were derived from, so findings remain traceable to their inputs without redistributing AMD code. 6 MB tracked instead of 315 MB. Verified from the new location: test_smoke 5/5, ccp_selftest 11/11, verify_real_image 5/5 + 5/5 negatives, fuzz_ta_invoke controls passing and host-driven TA invoke working (0.73s per invoke).