Add mixed-parameter HSS support - #56
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
HSS_Paramsto use variadicHSSLeveldescriptors.Existing typedef names and wire formats are unchanged. Code using the shipped HSS typedefs does not need to change.
Code that directly instantiates
HSS_Paramsor uses its oldLMSParametersandOTSParametersmembers must move to the newHSSLevelform and per-level accessors.