Skip to content

Add mixed-parameter HSS support - #56

Merged
Coralesoft merged 11 commits into
mainfrom
feature/sp800-208-mixed-hss
Jul 15, 2026
Merged

Add mixed-parameter HSS support#56
Coralesoft merged 11 commits into
mainfrom
feature/sp800-208-mixed-hss

Conversation

@Coralesoft

Copy link
Copy Markdown
Collaborator

Adds mixed-parameter HSS hierarchies, allowing each level to use a different LMS tree height and LM-OTS Winternitz parameter.

Adds the RFC 8554 Appendix F Test Case 2 parameter set (HSS_SHA256_H10W4_H5W8_L2) and completes the SHA-256/N32 LM-OTS family with W1, W2 and W4.

What changed

  • Changes HSS_Params to use variadic HSSLevel descriptors.
  • Resolves LMS and LM-OTS parameters per level in the signer and verifier.
  • Enforces matching LMS and LM-OTS output sizes.
  • Adds RFC TC2 verification and mixed-parameter signing, serialisation, boundary and restart tests.

Existing typedef names and wire formats are unchanged. Code using the shipped HSS typedefs does not need to change.

Code that directly instantiates HSS_Params or uses its old LMSParameters and OTSParameters members must move to the new HSSLevel form and per-level accessors.

Add indexed accessors for per-level parameter types, LMS signature size, LMS public-key size, and leaf count, with smoke checks against the existing uniform aggregates. The current template remains uniform, so every index resolves to the same LMS/OTS pair and runtime behaviour is unchanged.

Add the TypeAt helper for the later variadic HSS_Params shape.
Move the HSS signer and verifier off the uniform LMS/LM-OTS traits and onto the per-level HSS_Params accessors.

HSS_Params is still uniform, so every level resolves to the same LMS/OTS pair and signing and verification behaviour is unchanged.
Move HSS_Params to the HSSLevel parameter-pack shape and migrate the shipped uniform typedefs to repeated level descriptors.

Runtime behaviour is unchanged; mixed-level dispatch remains gated for the next step.
Build per-call level tables for HSS signing and verification, and use per-level params and sizes when decomposing indexes, building subtree chains, emitting signatures, and verifying each layer.

Remove the mixed-parameter gate. Add a height-mixed L=2 test covering sign/verify, tamper rejection, and restart across a bottom-subtree rollover.
Adds the remaining SHA-256/N32 LM-OTS parameter sets, explicit LMS H5/H10 instantiations, and H5 sign/verify coverage for each new set.
Add HSS_SHA256_H10W4_H5W8_L2, a two-level HSS set with an H10/W4 root over an H5/W8 leaf, and instantiate the HSS class templates for it.

Add a verify-only RFC 8554 Appendix F Test Case 2 known-answer test. TC2 mixes parameters across levels, giving coverage for W4 and mixed-level verification.
Lock TotalSignatures(), PublicKeySize(), and SignatureSize() for the uniform HSS typedefs with compile-time assertions.

Add deterministic L=2 golden signature checks using fixed SEED, I, and a fixed 0xC5 signing RNG; the goldens are regression fixtures captured from this implementation. Cover L=3 and L=4 with deterministic sign/verify round-trips and SignatureSize() checks, keeping full byte fixtures to L=2 to limit test data.
TC2 verifies the H10/W4 over H5/W8 typedef against the RFC vector, but only on the verify side. Add the existing generic HSS signing tests for that typedef so the mixed-W signing path is covered too.
The private H10/H5 test parameter set was explicitly instantiated in lms.cpp, which would export its symbols from the Unix shared library. The public H10/W4 over H5/W8 typedef exercises the same mixed-height dispatch and adds mixed W, so the boundary, tamper and restart coverage runs on it instead and the private instantiations are removed.
A mismatched parameter pair would feed an N-byte LM-OTS result into buffers sized from LMS M. Add a CompatibleLMSParams trait, assert it in every LMS template that composes the pair, and route the per-level HSS check through it. All shipped parameter sets are 32/32, so this rejects inconsistent descriptors at compile time without changing any current configuration.
Index the bottom level explicitly in the uniform boundary tests, and restore the safety-boundary wording on the HSS signer reservation comment.
@Coralesoft
Coralesoft merged commit 60dc074 into main Jul 15, 2026
47 checks passed
@Coralesoft
Coralesoft deleted the feature/sp800-208-mixed-hss branch July 15, 2026 05:55
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