-
Notifications
You must be signed in to change notification settings - Fork 792
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
[hsmtool] Add a SPX+ implementation for PKCS11 Elementary Files #25379
Conversation
e299dbe
to
8019579
Compare
sw/host/hsmtool/src/util/shredder.rs
Outdated
unsafe { | ||
for v in self.as_mut_vec().iter_mut() { | ||
*v = rng.gen(); | ||
} | ||
} | ||
self.truncate(0); |
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 C, this would be the place where the compiler helpfully removes the random writes because the string is later freed without being read again so they're "unnecessary". Might be worth a check to see if this compiled with the writes, unless Rust/unsafe
provides some guarantees about this kind of thing?
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 deleted the Shreddable trait and opted to use the zeroize
crate. The zeroize crate specifically claims that it will zero out data without being defeated by the optimizer.
Signed-off-by: Chris Frantz <[email protected]>
- 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]>
1. Add support for `CKO_DATA` objects (aka "elementary files"). Signed-off-by: Chris Frantz <[email protected]>
1. Create an `SpxInterace` trait. 2. Refactor the acorn library to implement the trait. Signed-off-by: Chris Frantz <[email protected]>
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]>
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]>
8019579
to
fbd2358
Compare
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.