Skip to content

Implementation-specific extension: Keys may allow a second algorithm #128

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

Conversation

gilles-peskine-arm
Copy link
Collaborator

Add a second permitted algorithm to key policies, as an implementation-specific feature. This is an experimental feature which may or may not be added to the PSA Crypto API after 1.0.

This is a replay of https://github.com/ARMmbed/mbedtls-psa/pull/266 [private link] on the API branch. Because the development branch and the API branch have diverged (copy key policy, renamed identifiers, changed key creation interface), merging this feature from development to the API branch led to a lot of difficult-to-understand conflicts. Here, I take the commits from https://github.com/ARMmbed/mbedtls-psa/pull/266 one by one and modify them to suit the modern API.

Compared with https://github.com/ARMmbed/mbedtls-psa/pull/266:

  • The order of commits is slightly different, to have preparation commits before feature commits.
  • Commits related to PSA_ECC_CURVE_BITS have already been merged through PSA: EC curve size macro #107.
  • I omitted commits to docs/architecture/mbed-crypto-storage-specification.md because this file has not been modified in the API branch.

Once this PR is merged, the next step is to merge development into psa-api-1.0-beta. This merge will have conflicts but they will be easy to resolve (the merge commit is at https://github.com/gilles-peskine-arm/mbed-crypto/tree/psa-api-1.0-beta-merge_development_20190524, I'll make a PR for it once this one is merged).

Manually cherry-picked from ca5bed7
by taking that patch, replacing KEYPAIR by KEY_PAIR
throughout (renaming applied in this branch), and discarding parts
about import_twice in test_suite_psa_crypto (this test function was
removed from this branch).
In the tests for opening a persistent key after closing it, also read
back and check the key data if permitted by policy, and the key
policy.
@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 24, 2019
@gilles-peskine-arm
Copy link
Collaborator Author

CI passing except for expected failures because the API branch is not up-to-date (use_psa_crypto, ABI check, TLS).

* An operation on a key may indifferently use the algorithm set with
* psa_set_key_algorithm() or with this function.
*
* \param[out] attributes The attribute structure to write to.
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in rebase. No other changes.

AndrzejKurek
AndrzejKurek previously approved these changes May 27, 2019
Copy link
Contributor

@AndrzejKurek AndrzejKurek left a comment

Choose a reason for hiding this comment

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

Only an indentation problem found.

Add a second permitted algorithm to key policies.

This commit includes smoke tests that do not cover psa_copy_key.
The storage format has changed, so update the test data accordingly.
Add parameters to psa_copy_key tests for the enrollment algorithm (alg2).

This commit only tests with alg2=0, which is equivalent to not setting
an enrollment algorithm.
@gilles-peskine-arm gilles-peskine-arm merged commit 6562dd3 into ARMmbed:psa-api-1.0-beta May 29, 2019
@Patater Patater removed the needs: review The pull request is ready for review. This generally means that it has no known issues. label Jul 3, 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.

3 participants