Skip to content
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

Merged

Conversation

gilles-peskine-arm
Copy link
Collaborator

Require PSA_KEY_USAGE_COPY in psa_copy_key.

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.
@gilles-peskine-arm gilles-peskine-arm added enhancement New feature or request needs: review The pull request is ready for review. This generally means that it has no known issues. api-spec Issue or PR about the PSA specifications labels May 14, 2019
* 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
Copy link
Contributor

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I updated the documentation.

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

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

psa_copy_key()

*
* 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
Copy link
Contributor

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.
@gilles-peskine-arm gilles-peskine-arm added this to the api-1.0-beta-3 milestone May 15, 2019
@gilles-peskine-arm gilles-peskine-arm added the needs: ci Needs a passing full CI run label May 15, 2019
Copy link
Collaborator

@yanesca yanesca left a 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.

@yanesca yanesca removed the needs: review The pull request is ready for review. This generally means that it has no known issues. label May 16, 2019
@Patater
Copy link
Contributor

Patater commented May 16, 2019

CI failure is ABI job (known to fail until Mbed-TLS/mbedtls#2636 lands in the development branch) and USE_PSA_CRYPTO, which doesn't work on the API branch.

@Patater Patater merged commit 76be7f9 into ARMmbed:psa-api-1.0-beta May 16, 2019
@Patater Patater removed the needs: ci Needs a passing full CI run label May 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-spec Issue or PR about the PSA specifications enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants