-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Openless PSA crypto APIs implementation #3547
Openless PSA crypto APIs implementation #3547
Conversation
80cc786
to
b53bef4
Compare
b53bef4
to
c21e149
Compare
9b6be96
to
d1f88fc
Compare
The CI is as good as it can. Apart from Mbed OS tests, "merge TLS Testing" and "pr-merge" are falling because of the "ABI-API" testing as expected as this PR changes the definition of API parameter types. |
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.
Approved. I'd prefer to improve the lock/acquire terminology, but since this is purely internal, I'm ok with doing that in a follow-up.
Great. I agree with you that the lock/acquire terminology can and must be improved and I am going to work on it in the coming days. @bensze01 ok to approve on your side as well? |
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've left a couple of suggestions, but they are all just typo fixes in comments.
Since no actual code changes are necessary, I'm approving this PR.
include/psa/crypto_compat.h
Outdated
@@ -34,6 +34,40 @@ | |||
extern "C" { | |||
#endif | |||
|
|||
/* | |||
* To support temporary both openless APIs and psa_open_key(), define |
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.
* To support temporary both openless APIs and psa_open_key(), define | |
* To support both openless APIs and psa_open_key() temporarily, define |
library/psa_crypto_core.h
Outdated
* key slot. | ||
* | ||
* This counter is decremented by one each time a library function stops | ||
* accessing to the key slot and states it by calling 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.
* accessing to the key slot and states it by calling the | |
* accessing the key slot and states it by calling the |
|
||
/* | ||
* Create a new persistent or volatile key. When creating the key, | ||
* one of the description of the previously created persistent 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.
* one of the description of the previously created persistent key | |
* one of the descriptions of the previously created persistent keys |
library/psa_crypto_core.h
Outdated
@@ -38,16 +38,15 @@ typedef struct | |||
psa_core_key_attributes_t attr; | |||
|
|||
/* | |||
* Number of on-going accesses, read and/or write, to the key slot by the | |||
* library. | |||
* Number of locks, read and/or write, to the key slot by the library. |
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.
* Number of locks, read and/or write, to the key slot by the library. | |
* Number of locks on the key slot held by the library. |
library/psa_crypto_core.h
Outdated
* | ||
* A key slot is accessed iff its access counter is strickly greater than | ||
* 0. | ||
* A key slot is locked iff its lock counter is strickly greater than 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.
* A key slot is locked iff its lock counter is strickly greater than 0. | |
* A key slot is locked iff its lock counter is strictly greater than 0. |
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
After a call to psa_get_key_attributes() to retrieve the attributes of a key into a psa_key_attributes_t structure, a call to psa_reset_key_attributes() is mandated to free the resources that may be referenced by the psa_key_attributes_t structure. Not calling psa_reset_key_attributes() may result in a memory leak. When a test function calls psa_get_key_parameters() the associated key attributes are systematically reset in the clean-up part of the function with a comment to emphasize the need for the reset and make it more visible. Signed-off-by: Ronald Cron <ronald.cron@arm.com>
3a4f0e3
eb9a307
to
3a4f0e3
Compare
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.
As before, approved on the condition of a follow-up that improves acquire/lock terminology.
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.
All of my comments were addressed, so I'm approving this PR as well.
CI passed except for expected ABI/API changes ( |
*/ | ||
static inline int mbedtls_svc_key_id_is_null( mbedtls_svc_key_id_t key ) | ||
{ | ||
return( ( key.key_id == 0 ) && ( key.owner == 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.
This should be just key.key_id == 0
, shouldn't it? If a client passes a null key id, owner information will be attached to it, but owner information about a null key id is not relevant. Fixing in #4392.
Description
This PR is the second part of the work related to #3265, the first part being #3527.
This PR implements the openless PSA crypo APIs that take as input or return a key identifier instead of a key handle (see #3265 for details).
Status
Done
Requires Backporting
No, PSA only