-
Notifications
You must be signed in to change notification settings - Fork 71
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 a TPM provider #75
Conversation
The Possible solutions that I see:
I think 1. and 3. are definitely needed for now and we can look at 2. later. |
#76 addresses point 1 |
Check rust-lang/rust-bindgen#1541 for point 2. |
ee2dd04
to
234df81
Compare
Executed |
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.
👏 Impressive
.expect("ESAPI Context lock poisoned"); | ||
|
||
let len = hash.len(); | ||
if len > 64 { |
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.
Ideally this should take into account the digest size of the hash algorithm that the key is created with - I think we actually have hash algorithms assigned to keys, maybe we can do something between the TPM crate and the provider to be able to get the public definition of the key and deduce from that the correct length
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.
Same for sign, of course
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.
Alternatively, these checks could be left to the crate to do by itself (which it actually is doing atm)
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.
Is not it fine at the moment as we are supporting only one kind of hash algorithm?
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 about that! We actually support any hash algorithm, at least with Mbed Crypto; but it depends on what people want from us
.expect("ESAPI Context lock poisoned"); | ||
|
||
let (key_context, auth_value) = esapi_context | ||
.create_rsa_signing_key(key_size, AUTH_VAL_LEN) |
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 don't know if creating an "RSA key definition structure" and passing that here is more sensible. We should be setting the hash algorithm, for example.
Maybe we could have a method like create_signing_key
which takes in an enum (RSA
or ECC
) and the enum contains the other params as well... Don't know, really
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 think it is fine for now as we are limiting the scope of things that we support.
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.
True. We'll have to see how to manage that for the TPM crate, though
This provider uses the tss-esapi crate to interface with a TSS 2.0 Enhanced System library. Adds new configuration entries to select the TPM provider and which TCTI device to use. The TPM provider currently only supports RSA key, signing and verifying operations. Co-authored-by: Ionut Mihalcea <ionut.mihalcea@arm.com> Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>
key_triple: KeyTriple, | ||
password_context: PasswordContext, | ||
) -> Result<()> { | ||
let error_storing = |e| { |
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.
Nice!!! I actually believe this could be moved to be something surfaced by the KeyIdManager - apart from the text everything seems general, maybe the KIM could do this before returning to the providers?
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.
Same for many of the or_else
handlers in here
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.
The thing is that the KeyIDManager
returns a String
in its Err
variant, so we would still need an or_else
to convert it to ResponseStatus
:/
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.
Yes, but we could do that in the manager itself
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.
Ok, got it now, that is a good idea!
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.
Will create an issue.
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 #77
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.
Yay! Parsec with TPM finally working fo' real 👍
This provider uses the tss-esapi crate to interface with a TSS 2.0
Enhanced System library.
Adds new configuration entries to select the TPM provider and which
TCTI device to use.
The TPM provider currently only supports RSA key, signing and verifying
operations.
Co-authored-by: Ionut Mihalcea ionut.mihalcea@arm.com
Signed-off-by: Hugues de Valon hugues.devalon@arm.com