feat(pqc): add device-resident ML-KEM-512 SampleNTT - #9
Conversation
|
Withdrawing this narrow DR2a sub-milestone for now. DR2 will be pushed as one complete milestone immediately before DR3 begins. The validated work remains local while DR2 integration continues. |
There was a problem hiding this comment.
Pull request overview
Adds a new narrow “DR2a” device-resident ML-KEM-512 building block that deterministically computes one bounded SampleNTT(SHAKE128(rho || j || i)) polynomial (for j,i ∈ {0,1}) with a terminal-only, complete-or-error ABI, plus host-side validation, an independent reference oracle, and silicon/host test gates. This fits into the PQC device-resident roadmap as a proven streaming topology primitive intended to be composed later into broader ML-KEM graphs (explicitly not full KeyGen).
Changes:
- Introduces a fixed DR2a ABI (descriptor + terminal result) and a two-worker IRON graph that performs exactly two ingress fills and one terminal drain, with no host/reference fallback.
- Adds production C++ kernels for the SHAKE128 streaming producer and SampleNTT consumer (fixed 5-block schedule; fail-closed terminal contract).
- Adds an independent
hashlib.shake_128/ FIPS-203 candidate parser oracle and comprehensive off-hardware + native-only silicon gate tests, plus design/validation documentation.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/test_pqc_dr2a_contract.py | Adds static contract tests asserting DR2a topology, ABI constants, and documentation invariants. |
| tests/pqc_device_resident/test_dr2a_mlkem512_samplentt_silicon.py | Adds a native-only silicon gate that fails closed when hardware/runtime is unavailable. |
| tests/pqc_device_resident/test_dr2_mlkem512_samplentt.py | Adds host/off-hardware tests including a compiled C++ harness that checks full 5-block streams and terminal outputs. |
| tests/pqc_device_resident/dr2a_reference.py | Adds an independent SHAKE128 + FIPS-203 candidate decoding oracle used by tests. |
| phoenix_sdr_dsp/pqc/kernels/dr2_mlkem512_shake128_service.cc | Adds the device-side SHAKE128 producer emitting 5 fixed rate blocks per request. |
| phoenix_sdr_dsp/pqc/kernels/dr2_mlkem512_samplentt.cc | Adds the device-side SampleNTT consumer producing a terminal-only complete-or-error result. |
| phoenix_sdr_dsp/pqc/dr2_mlkem512_samplentt_graph.py | Adds the DR2a IRON graph and native dispatch wrapper with strict host validation and terminal parsing. |
| phoenix_sdr_dsp/pqc/dr2_mlkem512_samplentt_abi.py | Defines the fixed ABI and strict terminal parsing (including fail-closed error behavior). |
| docs/PQC_DR2A_SILICON_VALIDATION_PENDING.md | Records the narrow physical validation evidence and reproduction steps. |
| docs/PQC_DR2A_DESIGN.md | Documents DR2a scope, topology, fixed ABI, and claim boundaries. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| self.assertEqual( | ||
| CANONICAL_RUNNER.read_text(encoding="utf-8"), | ||
| subprocess.run( | ||
| ["git", "show", "HEAD:run_all_silicon_tests.py"], | ||
| cwd=REPO, | ||
| check=True, | ||
| capture_output=True, | ||
| encoding="utf-8", | ||
| ).stdout, | ||
| ) |
Summary
Adds DR2a, a narrow device-resident ML-KEM-512 building block that computes one bounded matrix polynomial:
SampleNTT(SHAKE128(rho || j || i))for
j,iin0..1.This reuses the physically proven DR1 two-worker streaming topology while replacing the earlier fixed-stream partial-polynomial behavior with a complete-or-error terminal contract.
Device topology
rhoand 16-byte descriptorLIMIT_EXCEEDEDandBAD_DESCRIPTORreturn fixed zero-payload terminal recordsPhysical Phoenix validation
Validated on Phoenix XDNA1 with IRON 1.4.1:
dr2a-mlkem512-samplentt:siliconTOTAL 13/13 PASS(0,2):.text6,192 B,.bss272 B, 16 KiB stack reservation(0,3):.text2,976 B,.bss524 B, 16 KiB stack reservationdff7cf7e-0931-4fd5-b1e3-55f43b342e83The placed MLIR records depth-two FIFO allocation, bank/address placement, two shim MM2S ingress routes, and one shim S2MM terminal route.
Host validation
hashlib.shake_128/ FIPS 203 parsergit diff --checkpassedrun_all_silicon_tests.pyis unchangedClaim boundary
This PR validates one bounded ML-KEM-512 SampleNTT polynomial per invocation. It does not claim complete K-PKE KeyGen, complete ML-KEM residency or conformance, performance, constant-time behavior, secure zeroization, side-channel resistance, CMVP validation, or certification.
The physical corpus did not inject malformed descriptors or corrupted internal tokens. Those fail-closed paths remain compiled host-harness and source-contract evidence.
Specification references: