-
Notifications
You must be signed in to change notification settings - Fork 781
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
[rom] Change the endianness of FORS indices for SPHINCS+. #22953
Conversation
If we find a new archive with KAT tests for the new version, it would be easy to upload it to the cloud storage and use (we would likely upload it alongside the old one, to preserve compatibility for other branches). The archive file in the GCP storage for SPHINCS+ is a bit special compared to the rest of the cryptotest framework. Due to size considerations, the SPHINCS+ archive is manually created by us (which is why the GCP storage is primary, unlike the other algorithms, which use the NIST site as primary and GCP as backup). "Manually created" here just means we un-compressed the archive, removed the KAT tests for all the variations of SPHINCS+ we don't support, and re-compressed it. That original zip came from the NIST round 3 submission available directly on the SPHINCS+ site, and did not involve the SPHINCS+ repo at all. I took a look at the new branch matching the new draft standard, and it is possible to generate the test vectors for this version, but this won't be possible hermetically. We may be able to create a new archive file to store in the GCP using the temporary files generated by |
I generated a new archive file with KAT tests using the |
I updated #21681 to switch the source of the test vectors to the new GCP-backed archive for the |
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 @jadephilipoom. I assume this will break the current rom e2e sigverify_spx
tests.
Is there an equivalent update for opentitantool?
@cfrantz for visibility as this will also require updates on the HSM integration side.
Good point. I looked at the |
Thanks for looking into the host side tooling @jadephilipoom. Should we be considering to do a similar thing to what we did on the device side an maintain our own host-side implementation? It seems that there are still additional changes in the pipeline which are going make it difficult for us to run integration testing. Should we raise this issue to the Software WG? |
Yes, seems like a good topic for Software WG (and good timing too!) |
This issue was discussed in the software working group today. The consensus was that we should write our own Rust wrapper for the reference implementation. |
For visibility: I've cherry-picked the last commit from #23326; this puts the host-side tooling in sync with the device for the endianness swap so that tests work. If it passes CI, I'll just merge this and close #23326,. Since both sets of changes have been reviewed and approved, I don't think it requires any additional review; just wanted to put an explanation for the new commit post-approve. |
There are a couple remaining test failures because (I think) some pre-signed binaries need to be manually re-generated. Can anyone tell me what the procedure is for that? I can see that commit c36ad25 re-generated them due to |
Update: after talking to @cfrantz and @moidx , I understand that none of the pre-signed binaries should need to be regenerated, and the tests are likely failing because the signatures opentitantool are producing are incorrect. |
Re-generating the keys under
Let's see what CI says, and I'll keep investigating in the meantime; I don't really want to leave this as a question mark. Ideally I'll figure out where the switch is and remove the last commit that re-generates the fake keys, but I wanted to pass it through CI to gather some more information. |
Update: CI result has two failing tests, but both appear to be failing on all CI jobs at the moment and I think they're unrelated.
I don't have a CW340, but I can replicate the first one on |
other types of keys: | ||
- To generate ECDSA keys, replace every occurrence of `spx` with `ecdsa`. | ||
- To generate prod or dev keys, replace every occurrenct of `test_key` with `prod_key` or `dev_key`. | ||
- To generate real keys, use the `keys/real` directory instead of `keys/fake`. |
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.
nit: For real keys we recommend using an offline HSM, so this procedure is only applicable to fake keys.
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 have a way of generating those keys ahead of time and checking in simulation that the chip definitely can boot using them, so that we don't end up with a subtle encoding mismatch between the HSM and the ROM?
Okay, I've figured out what's going on. Long story short: we should regenerate the test keys, so I'll leave the commit in. The old Here's a more detailed debugging log:
|
Fixed to address @moidx's comment on real keys and also to re-generate "unauthorized" keys. I'll consider this OK to merge once CI passes, unless anyone objects. |
This backwards-incompatible change is part of the changes between the round 3 SPHINCS+ submission to the NIST PQC competition and the SLH-DSA draft standard. Corresponds to this commit from the SPHINCS+ reference implementation (consistent-basew branch): sphincs/sphincsplus@129b72c Signed-off-by: Jade Philipoom <[email protected]>
The test vectors were re-generated from the `consistent-basew` branch of the reference implementation. Signed-off-by: Jade Philipoom <[email protected]>
Signed-off-by: Jade Philipoom <[email protected]>
Instead of using the pqcrypto crate to indirectly access the reference implementation, we now directly invoke our own bindings for the reference implementation. Signed-off-by: Jade Philipoom <[email protected]>
Also small fixups to the opentitantool instructions so they're easier to follow. Signed-off-by: Jade Philipoom <[email protected]>
Signed-off-by: Jade Philipoom <[email protected]>
This backwards-incompatible change is part of the changes between the round 3 SPHINCS+ submission to the NIST PQC competition and the SLH-DSA draft standard. Part of #21944
Corresponds to this commit from the SPHINCS+ reference implementation (
consistent-basew
branch):sphincs/sphincsplus@129b72c
Test vectors were re-generated from the
consistent-basew
branch of the reference implementation.Note that I think this might break the cryptotest SPHINCS+ setup, because they are right now hard-coded to fetch a specific self-hosted file for the round3 submission:opentitan/third_party/sphincsplus/repos.bzl
Line 19 in 5dbbd25
@RyanTorok @milesdai do either of you know if there is another file there, or how we can update it? I don't think NIST is actually hosting a corresponding KAT file for the draft standard yet, so we could also potentially wait until they release final test vectors (but in that case we should probably add a comment that this setup will fail tests on master, and explain why). The round3 tests are still useful for ES sival.Edit: now addressed, thanks Ryan!