Skip to content
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

Cherry-pick to earlgrey_1.0.0: [hsmtool] Add a SPX+ implementation for PKCS11 Elementary Files #25515

Merged
merged 6 commits into from
Dec 17, 2024

Conversation

cfrantz
Copy link
Contributor

@cfrantz cfrantz commented Dec 5, 2024

This is a manual cherry-pick of #25379 to earlgrey_1.0.0.

@cfrantz cfrantz requested a review from a team as a code owner December 5, 2024 01:14
@cfrantz cfrantz removed the request for review from a team December 5, 2024 01:15
Signed-off-by: Chris Frantz <[email protected]>
(cherry picked from commit dfd9f08)
- Rust `cryptoki` doesn't know about CKO_PROFILE objects.
- The `sc-hsm-embedded` PKCS#11 provider does not expose the profile
  object, however it also doesn't support CKO_DATA objects.  It does
  support RSA3K keys, which were used in the ES chip.
- The `opensc-pkcs11` provider does expose the profile object and does
  support CKO_DATA objects.  It does _not_ support RSA3K keys.

This hack adds support to `cryptoki` for the profile object (e.g. it
simply recognizes the object).  This allows the use of the
`opensc-pkcs11` provider which will permit using CKO_DATA objects from
`hsmtool`.

Signed-off-by: Chris Frantz <[email protected]>
(cherry picked from commit 7c0210c)
1. Add support for `CKO_DATA` objects (aka "elementary files").

Signed-off-by: Chris Frantz <[email protected]>
(cherry picked from commit bdab355)
1. Create an `SpxInterace` trait.
2. Refactor the acorn library to implement the trait.

Signed-off-by: Chris Frantz <[email protected]>
(cherry picked from commit 54e4af9)
Create a SPHINCS+ implementation that uses key material from PKCS#11
Elementary Files (aka CKO_DATA objects).

This implementation stores key material on a secure token, and loads the
key material to perform the sphincs+ operations.  This is not as secure
as signing within an HSM security boundary, but it provides
token-protected storage for key material when an HSM-based
implementation is not available.

Signed-off-by: Chris Frantz <[email protected]>
(cherry picked from commit 6a0c877)
Prepare data according to the input format (plain-text, sha256-hash,
etc) and the sphincs+ signing domain (none, pure, prehashedsha256).

Signed-off-by: Chris Frantz <[email protected]>
(cherry picked from commit fbd2358)
@cfrantz cfrantz merged commit a7b4f23 into lowRISC:earlgrey_1.0.0 Dec 17, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants