Skip to content

test: exercise SPHINCS+ OID round-trip for -simple variants#2345

Open
major wants to merge 1 commit into
bcgit:mainfrom
major:fix/sphincsplus-simple-oid-roundtrip-test
Open

test: exercise SPHINCS+ OID round-trip for -simple variants#2345
major wants to merge 1 commit into
bcgit:mainfrom
major:fix/sphincsplus-simple-oid-roundtrip-test

Conversation

@major

@major major commented Jul 7, 2026

Copy link
Copy Markdown

This removes a stale FIXME in SphincsPlusTest that was skipping the SubjectPublicKeyInfo/PrivateKeyInfo (OID) encode/decode round-trip for SPHINCS+ "-simple" hash-mode variants.

Why the FIXME was stale: sphincsPlusOids/sphincsPlusParams in pqc/crypto/util/Utils.java already have correct forward and reverse OID mappings for all "-simple" variants (haraka has dedicated _simple-suffixed constants; sha2/shake reuse the unsuffixed constant, which now maps to the final SLH-DSA standard OID rather than the round-3-draft one). This was wired up in 729a3aa83 ("interop updates for SPHINCS+", Nov 2023), which aligned BC's naming with FIPS 205 finalizing on the "simple" hashing mode and dropping "robust". The test guard just never got removed after that change landed.

What changed:

  • Removed the // FIXME No OIDs for simple variants of SPHINCS+ comment and the if (name.indexOf("-simple") < 0) guard, so the OID round-trip now runs unconditionally for every variant.
  • Added assertTrue(... parameters == pubParams.getParameters()) / same for private key, so the test verifies decode(encode(params)) returns the exact same parameter-set instance, not just that raw key bytes happen to match afterward.
  • Applied identically to the jdk1.3 mirror of this test.

Verification: ran SphincsPlusTest locally (via junit.textui.TestRunner, since the gradle module restricts --tests to AllTest*), all 9 cases pass, including every -simple, -robust, and haraka variant now exercising the full ASN.1 round-trip plus the new parameter-identity checks.

Investigation and fix drafted with AI assistance (Claude); I reviewed the git history, verified the OID mapping tables, and ran the tests myself before submitting.

The OID encode/decode round-trip in SphincsPlusTest was skipped for
-simple hash-mode variants behind a stale FIXME guard. OID mappings for
these variants were already wired correctly in commit 729a3aa
(interop updates for SPHINCS+, Nov 2023), aligning with FIPS 205
SLH-DSA finalizing on the simple hashing mode, so the guard was never
needed after that change.

- remove the stale FIXME/guard so the round-trip runs for all variants
- add parameter-identity assertions so decode(encode(params)) is
  verified to return the exact same parameter set, not just matching
  raw key bytes
- apply the same fix to the jdk1.3 mirror of this test

Verified locally: all 9 SphincsPlusTest cases pass, including every
-simple, -robust, and haraka variant.

Investigation and fix drafted with AI assistance (Claude); reviewed
and verified by the author before submission.

Signed-off-by: Major Hayden <major@redhat.com>
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