Current behavior
The actual JSON-to-C generator parse JSON files from scripts\data_files\driver_jsons as a default and also supports user-provided JSON files as inputs. However the current implementation does not fully support an automatic and flexible integration flow for vendor drivers provided by TF-PSA-Crypto-Drivers.
This request would enhance the generator that it can better support dynamic location handling, and selective generation of driver during the prebuild step of an application that use TF-PSA-Crypto and TF-PSA-Crypto-Drivers.
At present:
- The JSON-to-C generator parses JSON files from scripts/data_files/driver_jsons as its default setup.
- It can also accept user JSON files as arguments.
- The driver location is defined in the JSON file using a numeric value such as '0x7fffff'
- The driver ID is auto-generated by the script and the Jinja template:
#define PSA_CRYPTO_MBED_TLS_DRIVER_ID (1)
{% for driver in drivers -%}
#define {{(driver.prefix + "_" + driver.type + "_driver_id").upper()}} ({{ loop.index + 1 }})
{% endfor %}
/* END-driver id */
Suggested enhancement
Dynamic location handling for opaque drivers
The JSON-to-C generator would support a macro-based location instead of requiring a numeric value in the JSON file.
- The location field in the JSON file would accept a macro name such as
PSA_CRYPTO_DRIVER_NAME_LOCATION.
- This macro would then be used by the user application to invoke the driver.
This would improve portability and allow driver locations to be defined more flexibly across build environments and automatically manage driver location values to avoid driver location conflicts from different vendors.
JSON parsing for both default and vendor driver sets
The generator would be able to parse:
- The default JSON files from TF-PSA-Crypto
- The vendor JSON files from TF-PSA-Crypto-Drivers
Selective driver generation
The generator would generate entry points only for the drivers selected by the user during the pre-build step.
- The script would accept as input a list of selected drivers.
- The selection format would be simple and user-friendly, using the driver name or prefix rather than the JSON filename.
Justification
This enhancement would help TF-PSA-Crypto automatically link vendor drivers from TF-PSA-Crypto-Drivers during the pre-build step.
It would provide:
- Better integration between TF-PSA-Crypto and vendor driver packages
- More flexible handling of opaque drivers
- A simpler and more maintainable build flow
- Reduced manual configuration effort for users
Current behavior
The actual JSON-to-C generator parse JSON files from
scripts\data_files\driver_jsonsas a default and also supports user-provided JSON files as inputs. However the current implementation does not fully support an automatic and flexible integration flow for vendor drivers provided by TF-PSA-Crypto-Drivers.This request would enhance the generator that it can better support dynamic location handling, and selective generation of driver during the prebuild step of an application that use TF-PSA-Crypto and TF-PSA-Crypto-Drivers.
At present:
Suggested enhancement
Dynamic location handling for opaque drivers
The JSON-to-C generator would support a macro-based location instead of requiring a numeric value in the JSON file.
PSA_CRYPTO_DRIVER_NAME_LOCATION.This would improve portability and allow driver locations to be defined more flexibly across build environments and automatically manage driver location values to avoid driver location conflicts from different vendors.
JSON parsing for both default and vendor driver sets
The generator would be able to parse:
Selective driver generation
The generator would generate entry points only for the drivers selected by the user during the pre-build step.
Justification
This enhancement would help TF-PSA-Crypto automatically link vendor drivers from TF-PSA-Crypto-Drivers during the pre-build step.
It would provide: