-
Notifications
You must be signed in to change notification settings - Fork 99
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
LMS wolfBoot support. #350
Conversation
Please resolve conflicts. |
config/examples/sim-lms.config
Outdated
# The number of available signatures is: | ||
# N = 2 ** (levels * height) | ||
# | ||
# LMS/HSS Signature sizes are directly proportional to the levels parm, |
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.
Remove parm.
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 reworded it.
config/examples/sim-lms.config
Outdated
IMAGE_SIGNATURE_SIZE=2644 | ||
IMAGE_HEADER_SIZE?=5288 | ||
|
||
# it should be multiple of system page size |
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.
"it" what is "it"?
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.
Outdated comment I copy-pasted from other example configs. Will update it.
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 updated it to be similar to the other sim*.config files.
options.mk
Outdated
@@ -286,6 +286,53 @@ ifeq ($(SIGN),RSA4096) | |||
endif | |||
endif | |||
|
|||
ifeq ($(SIGN),LMS) | |||
# In LMS the signature size is a function of the LMS parameters. |
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.
In -> For
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.
done
fprintf(stderr, "error: fclose returned %d\n", err); | ||
return WC_LMS_RC_WRITE_FAIL; | ||
} | ||
|
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.
What about read back and verify content written matches priv
?
We should show best practices and in this case speed/efficiency isn't priority.
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.
Agree but probably should close and check return first before re-opening and reading to increase likelihood the write has actually reached persistent storage.
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.
Added additional logic to re-open, read and compare priv key data.
tools/lms/lms_siglen
Outdated
@@ -0,0 +1,76 @@ | |||
#!/bin/bash | |||
# |
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.
Do we need GPL boiler plate here? I don't know the answer so I'm asking.
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.
Not sure. The shell scripts in tools/scripts/
don't have GPL, so was using that as ref. But lms_siglen
should probably have .sh
suffix like 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.
I originally experimented with putting the sig len calculation logic in makefile scripts but was too messy. And even if sig len is automatically set, the user will likely still need to manually config the header length for their platform. Hence I settled on this helper script.
tools/lms/lms_siglen
Outdated
# Globals | ||
|
||
# The lm_pub_len is 4 less than the pub len value of 60 | ||
# returned from hash-sigs HSS api. |
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.
api is all caps (API)
@philljj , please add a docs/PQ.md or docs/LMS.md with the details from the PR description. Please include a link to the hash-sigs repo. |
47639ad
to
5d01f38
Compare
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.
Just one little punctuation problem.
docs/PQ.md
Outdated
|
||
Stateful HBS schemes are based on the security of their underlying hash | ||
functions and Merkle trees, which are not expected to be broken by the advent | ||
of cryptographically relevant quantum computers |
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.
Missing period at end of paragraph.
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.
Over to @danielinux
Unfortunately libhss can only be linked on a POSIX-C system and won't work baremetal:
|
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.
Cannot merge until we figure out how to link a cross-compiled hss_lib.a that does not carry POSIX-C, OS system calls and other dependencies.
Also we should have a CI test added for it so the example config is built (including that hash-sigs lib). |
Note: these changes require wolfSSL Also in this last change, the hash-sigs lib is separated like this:
The building of hash-sigs libs/objects is handled automatically with wolfBoot/keytools Makefiles. The keytools build links with |
This last change introduced a small build error on mac m1 clang, fixing now. |
b77ffcb
to
9c7eb99
Compare
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.
POSIX dependencies now solved. Successfully tested on embedded target.
Once the wolfSSL PR is merged, please add non-regression tests + github automations as suggested by @dgarske, and discussed internally.
2205c35
to
08bb217
Compare
Change requests have been addressed
I'm good!! Thank you! |
Description
Adds support for LMS/HSS signatures to wolfBoot.
LMS/HSS is a post-quantum stateful hash-based signature scheme.
Documentation
Added new docs post-quantum readme:
Building
See procedure in
docs/PQ.md
.Config
Added new LMS sim example
The
LMS_LEVELS
,LMS_HEIGHT
, andLMS_WINTERNITZ
,IMAGE_SIGNATURE_SIZE
, and (optionally)IMAGE_HEADER_SIZE
must be set here.In LMS the signature size is a function of the parameters. Use the added helper script
tools/lms/lms_siglen
to calculate your signature length given your LMS parameters:More Info
See these links for more info on LMS and wolfSSL/wolfCrypt: