Define a constant for the first driver ID #781

Open
opened 2026-04-27 04:54:41 -05:00 by gilles-peskine-arm · 0 comments
gilles-peskine-arm commented 2026-04-27 04:54:41 -05:00 (Migrated from github.com)

In psa_crypto_driver_wrappers.h, we define constants for each driver. They are used to dispatch to multipart operations. The constants are enumerated by counting starting at 1 in scripts/generate_driver_wrappers.py, based on the order in scripts/data_files/driver_jsons/driverlist.json.

/* BEGIN-driver id definition */
#define PSA_CRYPTO_MBED_TLS_DRIVER_ID (1)
#define MBEDTLS_TEST_OPAQUE_DRIVER_ID (2)
#define MBEDTLS_TEST_TRANSPARENT_DRIVER_ID (3)
#define P256_TRANSPARENT_DRIVER_ID (4)

/* END-driver id */

This is not a problem for integrators who run scripts/generate_driver_wrappers.py, and it's not a problem for integrators who replace psa_crypto_driver_wrappers.h by their own file. But it is a problem for integrators who patch the psa_crypto_driver_wrappers.h that we generate and ship in our release zips.

The goal of this task is to define a symbolic constant TF_PSA_CRYPTO_DRIVER_ID_MAX such that integrators who patch psa_crypto_driver_wrappers.h can assign their driver IDs as TF_PSA_CRYPTO_DRIVER_ID_MAX + 1 and onwards.

In `psa_crypto_driver_wrappers.h`, we define constants for each driver. They are used to dispatch to multipart operations. The constants are enumerated by counting starting at 1 in `scripts/generate_driver_wrappers.py`, based on the order in `scripts/data_files/driver_jsons/driverlist.json`. ``` /* BEGIN-driver id definition */ #define PSA_CRYPTO_MBED_TLS_DRIVER_ID (1) #define MBEDTLS_TEST_OPAQUE_DRIVER_ID (2) #define MBEDTLS_TEST_TRANSPARENT_DRIVER_ID (3) #define P256_TRANSPARENT_DRIVER_ID (4) /* END-driver id */ ``` This is not a problem for integrators who run `scripts/generate_driver_wrappers.py`, and it's not a problem for integrators who replace `psa_crypto_driver_wrappers.h` by their own file. But it is a problem for integrators who patch the `psa_crypto_driver_wrappers.h` that we generate and ship in our release zips. The goal of this task is to define a symbolic constant `TF_PSA_CRYPTO_DRIVER_ID_MAX` such that integrators who patch `psa_crypto_driver_wrappers.h` can assign their driver IDs as `TF_PSA_CRYPTO_DRIVER_ID_MAX + 1` and onwards.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-Mbed-TLS/TF-PSA-Crypto#781
No description provided.