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

Refactor key derivation functions as transparent driver entry points #5479

Open
gilles-peskine-arm opened this issue Jan 31, 2022 · 0 comments
Labels
component-psa PSA keystore/dispatch layer (storage, drivers, …) enhancement size-s Estimated task size: small (~2d)

Comments

@gilles-peskine-arm
Copy link
Contributor

gilles-peskine-arm commented Jan 31, 2022

This a step of the implementation of the interface for key derivation drivers introduced in #5451. It follows #5477 and #5478. The goal of this issue is:

  • Refactor the key derivation code so that it has functions corresponding to the transparent driver entry points defined in the specification: key_derivation_setup (should already be there, or close), key_derivation_output_bytes, key_derivation_abort.
  • Create a new source file psa_crypto_kdf.c and corresponding header.
  • Move the built-in KDF implementations to psa_crypto_kdf.c.

Note that the key derivation code called before key_derivation_setup is not going to have driver alternatives, and is staying in psa_crypto.c for now. Code specific to output_key is also staying in psa_crypto.c for now.

Note that when the algorithm for the operation combines a key agreement step and a KDF step, the driver dispatch code and the driver should only see the KDF step. The pre-driver-setup code takes care of performing the key agreement and passes the resulting secret as an input to the driver.

I think there are enough unit tests for this refactoring, but feel free to add more if you think it's warranted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component-psa PSA keystore/dispatch layer (storage, drivers, …) enhancement size-s Estimated task size: small (~2d)
Projects
None yet
Development

No branches or pull requests

3 participants