-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add LMS implementation #4826
Add LMS implementation #4826
Conversation
Thank you for contributing this! As this is a substantial amount cryptography code, we'll need to schedule time to review for it. In the meantime, please fix the CI issues on Travis. Once Travis passes, if you need help with the Jenkins failures, post a comment and we'll help. The Jenkins logs are unfortunately not public, all you can see is a truncated list of names of failing jobs. |
9b48ede
to
0c69087
Compare
Right, I think I've fixed most of the CI failures now. There seem to be some random failures occurring in the windows build which I think are CI-related and therefore should be resolved by a re-run. The main remaining issue is a trickier one, since it's related to one of the algorithmic disadvantages of LMS. Each LMOTS key is ~1KiB, and using H=10 each LMS key contains 1024 LMOTS private keys for ~1MiB. As far as I can tell, this size can't be allocated on the heap by some of the tests which is causing the remaining failures. There are a few options to fix this:
None of the options is clearly favorable however. I'd be interested in your thoughts on this @gilles-peskine-arm |
While we don't have a set maximum amount of memory that tests must fit in, we do expect the tests to run on “reasonable” microcontroller boards. A board with 1MB of RAM would definitely be considered reasonable. There is a facility in the test suite to skip tests that need a large amount of memory:
rather than
|
Ah yes, returning an OOM error is a good idea, thanks. |
91ca95e
to
03e0d60
Compare
Right, I think that's the CI sorted. Might want to re-tag this one as a |
Signed-off-by: Raef Coles <[email protected]>
Due to tool name conflict hampering data reproduction Signed-off-by: Raef Coles <[email protected]>
Signed-off-by: Raef Coles <[email protected]>
Signed-off-by: Raef Coles <[email protected]>
Signed-off-by: Raef Coles <[email protected]>
Signed-off-by: Raef Coles <[email protected]>
Signed-off-by: Raef Coles <[email protected]>
@RcColes looks like there are some test failures in the LMS tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the updates. This looks good to me except for a remaining typo in the code snippets to reproduce test data. I'm approving, but I'd prefer to fix this.
Especially since CI found something I didn't.
The test data was invalid because it had the extra 4-byte prefix for HSS. Regenerate it (which produces completely new signatures since it is randomized). Rearrange the reproduction instructions for the second test case so that it shows more clearly how to generate a second signature with the same private key. Signed-off-by: Gilles Peskine <[email protected]>
Signed-off-by: Gilles Peskine <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With Raef's agreement I've pushed a fix for my last two comments, including the issue that caused test failures. It should be all good now. At least, it looks good to me.
Signed-off-by: Gilles Peskine <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am approving this pull request.
I authored three commits at the end, which someone else needs to review.
I've reviewed Gilles' last 3 commits, and I approve them |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. My concerns have been addressed. It will probably need something to get CI to pass, though.
The failure of |
Description
This adds the LMS stateful-hash asymmetric signature scheme, based on RFC8554 (https://datatracker.ietf.org/doc/html/rfc8554). It also adds the required LM-OTS implementation.
It's intended as a cut-down implementation, which is focused primarily on firmware asset validation (Though it is suitable for many generic purposes). The main limitation is that only one parameter-set is supported (SHA256_H10), with leads to each private key being able to be used for up to 1024 signatures. Supporting only one parameter-set leads to saving in complexity in memory allocation, and excludes the larger parameter-sets which require complex optimizations in order to be used in constrained memory implementations. The parameter-set with a merkle tree-height of 5 was discounted since 32 messages is likely to be too constrained where keys are embedded in devices and cannot be easily changed.
Status
READY
Requires Backporting
NO
Migrations
NO (only additions to the API, no changes)