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.
Addresses part of #175 but doesn't complete it. This ended up being a lot of infrastructure, so I'm going to break it into a separate PR.
This PR moves the WOTS+ scheme to its own directory (since it will be used in SPHINCS+ as well). The spec defines parameters for WOTS (
n
,w
, F, and
PRF), which have various constraints and also some dependent WOTS-specific types (
len`) that have their own constraints.My original plan was to have the XMSS spec take all the parameters for both XMSS and WOTS+, and then pass some of them through to instantiate WOTS+. However, I would've had to duplicate all of the WOTS-specific constraints in XMSS, which felt inelegant.
Then I was hoping to make an anonymous interface for the XMSS parameters (e.g. just a
parameter
block like most protocols have) and import the WOTS+ interface. This would match the spec, since SP 800-208 defines the WOTS+ parameter sets separately (Section 5.0) from the XMSS parameter sets (the rest of Section 5). The spec compiled with this but I couldn't figure out how to instantiate it -- cryptol#1581 suggests that this might not be possible.However, we can definitely import multiple interfaces to a single spec -- there's a section in the refman about it. So I moved the XMSS parameters to their own interface and imported it. It's pretty simple; it did require a few extra constraints that come out of the hash functions (and aren't really specified in the NIST spec, but some hash functions have message length upper bounds). Then I instantiated the XMSS parameter sets, and imported those parameters into the XMSS instantiation.
Open to feedback on a simpler way to do this, if there are any suggestions.
TODO