-
Notifications
You must be signed in to change notification settings - Fork 98
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 policy usage flag to copy a key #108
Add policy usage flag to copy a key #108
Conversation
Document the new flag and allow its use.
Pass the new flag to the existing tests and add a few more test cases to explore more variations of flag sets.
Implement the check and add a negative test.
include/psa/crypto.h
Outdated
* The policy on the source key must have the usage flag | ||
* #PSA_KEY_USAGE_COPY set. | ||
* In addition, some lifetimes also require the source key to have the | ||
* usage flag #PSA_KEY_USAGE_EXPORT, because otherwise the source key |
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 wording isn't completely clear, for example:
- who is doing the "locking inside"? - presume this is the SE designer, but better to avoid unnamed actors in the documentation.
- Is the use case here one where a key is being copied out of the SE into a volatile key (for example), and the SE design defaults to denying this operation unless the key is extractable? - presumably a copy within the SE would only require COPY policy in this set up?
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 the documentation.
include/psa/crypto_values.h
Outdated
@@ -1459,6 +1459,20 @@ | |||
*/ | |||
#define PSA_KEY_USAGE_EXPORT ((psa_key_usage_t)0x00000001) | |||
|
|||
/** Whether the key may be copied. | |||
* | |||
* This flag allows the use of psa_crypto_copy() to make a copy of the key |
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.
psa_copy_key()
include/psa/crypto_values.h
Outdated
* | ||
* For some lifetimes, copying a key also requires the usage flag | ||
* #PSA_KEY_USAGE_EXPORT, because otherwise the source key | ||
* is locked inside a secure processing environment and cannot be |
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.
Clarify use case? - as above
Be more clear about when EXPORT is also required.
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.
@athoelke 's comments have been addressed, looks good to me.
CI failure is ABI job (known to fail until Mbed-TLS/mbedtls#2636 lands in the development branch) and |
Require
PSA_KEY_USAGE_COPY
inpsa_copy_key
.