Skip to content

fix(codes): renumber the post-quantum codes to the reopened CESR PRs - #427

Open
dhh1128 wants to merge 2 commits into
WebOfTrust:mainfrom
dhh1128:fix/cesr-pq-renumber
Open

dhh1128 wants to merge 2 commits into
WebOfTrust:mainfrom
dhh1128:fix/cesr-pq-renumber

Conversation

@dhh1128

@dhh1128 dhh1128 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

This corrects the post-quantum codes I added in #413 so they follow the CESR spec PRs that replaced the one #413 was built on.

#413 followed trustoverip/kswg-cesr-specification#165. That PR was merged by accident before it had been reviewed, so it was reverted, and the work was reopened for proper review as trustoverip/kswg-cesr-specification#185 (the master-table codes) and trustoverip/kswg-cesr-specification#186 (indexed signature codes). The reopened PR drops FN-DSA and renumbers the table, which left main assigning many codes to a different primitive than the spec draft does. For example, 1AAR is an FN-DSA-512 signature on main and the ML-DSA-87 public key in the draft, and 2AAA is an FN-DSA-1024 key on main and the ML-DSA-44 signature in the draft. signify-ts would misframe anything emitted under the new codes.

The 27 rows in Matter.Sizes now match the master-table PR exactly in code, size, and lead size, with the descriptions carried into the comments. The six rows past its end (1AAc, 1AAd, 2AAL to 2AAO) are removed, and a test checks they stay gone. The tests also check every raw size against the FIPS 204 and FIPS 205 parameter sets. The Falcon test vector is replaced by an ML-DSA-44 receipt with a real keypair and signature, which also exercises both lead-byte selectors (3AAA for the key, 2AAA for the signature).

I didn't add the indexed codes from the second spec PR. Its 8 and 9 selectors carry lead bytes, and Indexer doesn't subtract the lead size when it computes the expected raw length, either when encoding or when decoding, so no indexed code with lead bytes round-trips today. Fixing that is a change to Indexer rather than a table addition, and I think it belongs in its own PR. keripy has the same arithmetic, and the keripy branch tracking these spec PRs fixes it there.

All of these codes are still provisional. They'll need another look if the spec PRs change before they merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QygmFWJVFywFvun7CxZ9wA

The post-quantum rows added in WebOfTrust#413 followed trustoverip/kswg-cesr-specification#165, which was merged before review and then reverted. The work reopened as trustoverip/kswg-cesr-specification#185, which drops FN-DSA and renumbers the master table. That left this table assigning many codes to a different primitive than the reopened PR does: 1AAR was an FN-DSA-512 signature here and is the ML-DSA-87 verification key there, and 2AAA was the FN-DSA-1024 key here and is the ML-DSA-44 signature there. Anything emitted under the new codes would have been misframed.

The 27 rows now match the reopened PR in code, description, full size and lead size. The six codes past its end (1AAc, 1AAd, 2AAL to 2AAO) are gone, and a test pins their absence so a stale row cannot keep accepting a code no draft defines. The codes stay provisional until that PR merges.

The size tests now check every row against the FIPS 204 and FIPS 205 raw sizes rather than against Falcon's. The Falcon exhibit is replaced by an ML-DSA-44 receipt over the same inception: a real keypair and a signature over the receipted event's bytes, generated with @noble/post-quantum 0.7.1, whose key (3AAA) and signature (2AAA) exercise both lead-byte selectors.

The indexed signature codes proposed in trustoverip/kswg-cesr-specification#186 are not added. Indexer's raw-size checks ignore the lead size, so no indexed code with lead bytes round-trips through it today; that needs a change to Indexer, not a table row.

Claude-Session: https://claude.ai/code/session_01QygmFWJVFywFvun7CxZ9wA
Signed-off-by: Daniel Hardman <daniel.hardman@gmail.com>
A hostile review (codex) found three comments in the post-quantum tests overstating them. The header said the smallest public key is 1,312 B, which holds for ML-DSA but not for the 32 to 64 B SLH-DSA keys; it said the tests check real cryptography, when they frame a real key and signature but cannot verify it; and the -A test said it would catch a future indexed code, when it only shows that a Matter code does not resolve as Indexer.

Claude-Session: https://claude.ai/code/session_01QygmFWJVFywFvun7CxZ9wA
Signed-off-by: Daniel Hardman <daniel.hardman@gmail.com>
@codecov

codecov Bot commented Nov 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.46%. Comparing base (6e07dc9) to head (8019726).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #427   +/-   ##
=======================================
  Coverage   97.46%   97.46%           
=======================================
  Files           1        1           
  Lines          79       79           
  Branches       28       28           
=======================================
  Hits           77       77           
  Misses          2        2           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant