Mbed-TLS / mbedtls

An open source, portable, easy to use, readable and flexible TLS library, and reference implementation of the PSA Cryptography API. Releases are on a varying cadence, typically around 3 - 6 months between releases.
https://www.trustedfirmware.org/projects/mbed-tls/
Other
5.24k stars 2.56k forks source link

Make mbedtls_psa_register_se_key usable with opaque drivers #9255

Open gilles-peskine-arm opened 3 months ago

gilles-peskine-arm commented 3 months ago

The function mbedtls_psa_register_se_key creates a PSA key object that is backed by a secure element. It is currently only implemented only for dynamic secure element drivers (the feature enabled by MBEDTLS_PSA_CRYPTO_SE_C), which are going away in TF-PSA-Crypto 1.0 (i.e. Mbed TLS 4.0). But it would be useful for the new kind of opaque drivers too. It needs a new interface for that, to specify the key material (with dynamic secure elements, that comes from the slot_number parameter in the attributes).

We'll want to fix https://github.com/Mbed-TLS/mbedtls/issues/9254 while we're at it. Thus the new prototype should probably be:

int mbedtls_psa_register_se_key(
    const psa_key_attributes_t *attributes,
    const uint8_t *data, size_t data_length,
    mbedtls_svc_key_id_t *key_id);