Skip to content

Support for slots to handles crypto API changes under SPM #16

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

Merged

Conversation

itayzafrir
Copy link
Contributor

Support for the API changes from slots to handles under SPM (code separation between SPE and NSPE).
Same idea as in https://github.com/ARMmbed/mbed-crypto/blob/development/library/psa_crypto.c#L29-L42

Copy link
Contributor

@Patater Patater left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code comment added seems better suited as a commit message. Consider moving it into the commit message description, or having it in both places, whichever you think is best. We do need something in the commit message description, though, to justify why this change is necessary and give some context to it.

* In case MBEDTLS_PSA_CRYPTO_SPM is defined the code is built for SPM (Secure
* Partition Manager) integration which separate the code into two parts
* NSPE (Non-Secure Process Environment) and SPE (Secure Process Environment).
* In this mode an additional header file should be included.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we change this to the following?

When MBEDTLS_PSA_CRYPTO_SPM is defined, the code is being build for SPM (Secure Partition Manager) integration which separates the code into two parts: NSPE (Non-Secure Processing Element) and SPE (Secure Processing Element). When building for the SPE, an additional header file should be included.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this still says "Environment" instead of "Element".

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see where “environment” should be changed to “element”. (N)SPE is (Non-)Secure Processing Environment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs I've seen refer to SPE as Secure Processing Environment. As Gilles approved this I'm leaving it as is for now, please let me know if you still want the change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I've been confusing two different terms. PE is processing element. SPE is not secure processing element, but whatever PSA says it is, which is Environment as you've written. In ARMv8-M PE's with the security extension, the "secure world" is called the "secure state".

*/
#if defined(MBEDTLS_PSA_CRYPTO_SPM)
/*
* PSA_CRYPTO_SECURE means that this file is compiled to the SPE side.
Copy link
Contributor

@Patater Patater Jan 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- compiled to the SPE side.
+ compiled for the SPE.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

#if defined(MBEDTLS_PSA_CRYPTO_SPM)
/*
* PSA_CRYPTO_SECURE means that this file is compiled to the SPE side.
* some headers will be affected by this flag.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- some headers will be affected by this flag.
+ Some headers will be affected by this flag.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

@itayzafrir
Copy link
Contributor Author

@Patater I'll change the commit message and code comment, no problem. But what about https://github.com/ARMmbed/mbed-crypto/blob/development/library/psa_crypto.c#L29-L42, I copy pasted from there... Would you like me to update it as well?

@Patater
Copy link
Contributor

Patater commented Jan 14, 2019

If you wouldn't mind, it'd help to have another commit to update the other comment block. Thanks.

itayzafrir added 2 commits January 16, 2019 11:13
When MBEDTLS_PSA_CRYPTO_SPM is defined, the code is being built for SPM (Secure Partition Manager)
integration which separates the code into two parts: NSPE (Non-Secure Processing Environment) and SPE
(Secure Processing Environment). When building for the SPE, an additional header file should be included.
@itayzafrir itayzafrir force-pushed the spm-support-crypto-handles-api branch from f21f8e2 to 14e7678 Compare January 16, 2019 09:17
@itayzafrir
Copy link
Contributor Author

@Patater I've updated the the code comments, commit message title and description, I also added a new commit to update existing SPM documentation in the code.
Please take another look.

@itayzafrir itayzafrir added the DO NOT MERGE The PR is not intended to be merged (yet). Usually used for a review of worked in progress. label Jan 23, 2019
@itayzafrir itayzafrir removed the DO NOT MERGE The PR is not intended to be merged (yet). Usually used for a review of worked in progress. label Jan 23, 2019
@Patater Patater merged commit cfb7ae9 into ARMmbed:development Jan 23, 2019
itayzafrir pushed a commit to itayzafrir/mbed-os that referenced this pull request Jan 24, 2019
…Mmbed/mbed-crypto#16

This should be part of the mbed-crypto update into mbed-os!!!
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