Hello,
We're building Infineon drivers on top of TF-PSA-Crypto, including one for the Secure Enclave (SE) of PSOC Edge, an isolated on-chip core with its own key storage. For the driver spec [1] it is an opaque driver with internal key storage, it plays the role of a "secure element". Most of what we need is already in your driver spec or in open issues. We'd like to know what is planned, and where we could help.
General (all drivers)
1. Plugging in drivers [2] [3] - The wrapper generator already accepts another JSON directory and output directory, but it can't combine the built-in and vendor driver sets, and it doesn't generate the operation-context unions in crypto_driver_contexts_*.h. So a multipart driver still needs patches; TF-M's cc3xx patches both the context headers and the generated wrappers. #783 [2] proposes extending the generator. Another option would be two small build-time hooks: - one optional macro per context union (e.g. ..._EXTRA_HASH_CONTEXTS), defined in a vendor header chosen at build time, through which a driver adds its context members; - a build option to use wrapper outputs (psa_crypto_driver_wrappers.h and psa_crypto_driver_wrappers_no_static.c) generated outside the source tree, also when pre-generated copies are present (release archives, generation turned off). Which way do you prefer?
Opaque drivers (Secure Enclave)
2. Keys stored in the SE [4] [5] - Our SE stores keys itself. Deleting them, and cleaning up after a failed creation, needs the power-failure-safe design from #739 [5]. Is #739 planned? For persistent keys our SE accepts a key ID chosen in advance (the PSA key ID and owner), so implementing allocate_key looks feasible.
3. mac_verify [6] - Our SE checks a MAC without giving the real MAC to the core. mbedtls#8043 is marked help-wanted. Should we send the PR to TF-PSA-Crypto? Should the issue be moved there first?
4. Key derivation in the SE [7] [8] [9] [10] [11] - Our SE can derive keys internally. Is the design in these issues still valid? Is it planned? If we help, which issue should we start with?
5. Key agreement with SE keys [12] - Still present on development: psa_raw_key_agreement() and psa_key_derivation_key_agreement() reject SE keys, even though the driver could handle them. Another SE driver developer hit this too. May we re-file it in TF-PSA-Crypto and send a fix?
6. IV/nonce made by the driver [13] [14] - Our SE must generate the IV/nonce itself (it is still returned to the caller). Are driver entry points for this still planned? Only for SE (opaque) drivers, or for all drivers?
7. Location numbers [2] - Our SE and TF-M's built-in key loader both use location 0x800001. Who should assign these numbers? Is the vendor registry from the spec [1] still planned? Should the generator report it when two selected drivers use the same number?
8. Keys provisioned into the SE outside PSA [15] [16] - Some keys are provisioned into our SE out of band, and the SE keeps their metadata. Is mbedtls_psa_register_opaque_key (#9255) the intended way to register them with the core? Is it planned?
Where something isn't planned, we're happy to contribute. Please tell us what would be welcome.
References [1] PSA driver interface specification (proposed) - https://github.com/Mbed-TLS/TF-PSA-Crypto/blob/development/docs/proposed/psa... [2] TF-PSA-Crypto#783 - Enhance the JSON-to-C generator to support linking drivers from TF-PSA-Crypto-Drivers to TF-PSA-Crypto - https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/783 [3] TF-PSA-Crypto#699 - Test the driver dispatch layer - https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/699 [4] TF-PSA-Crypto#738 - psa_destroy_key does not dispatch to opaque driver's destroy_key entry point - https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/738 [5] TF-PSA-Crypto#739 - Stateful secure element drivers are not resilient - https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/739 [6] mbedtls#8043 - Implement mac_verify driver entry point - https://github.com/Mbed-TLS/mbedtls/issues/8043 [7] mbedtls#5480 - Move key derivation driver dispatch to the template code - https://github.com/Mbed-TLS/mbedtls/issues/5480 [8] mbedtls#5484 - Add support for key derivation in opaque drivers - https://github.com/Mbed-TLS/mbedtls/issues/5484 [9] mbedtls#5486 - Support key derivation entirely inside a secure element - https://github.com/Mbed-TLS/mbedtls/issues/5486 [10] mbedtls#5487 - Implement key_derivation_set_capacity driver entry point - https://github.com/Mbed-TLS/mbedtls/issues/5487 [11] mbedtls#5491 - Add support for key agreement inside a secure element - https://github.com/Mbed-TLS/mbedtls/issues/5491 [12] mbedtls#8747 - psa_raw_key_agreement() and psa_key_derivation_key_agreement() don't work with opaque drivers - https://github.com/Mbed-TLS/mbedtls/issues/8747 [13] mbedtls#4571 - Support PSA opaque drivers with generate_iv or generate_nonce entry points - https://github.com/Mbed-TLS/mbedtls/issues/4571 [14] mbedtls#3653 - Should a transparent driver have a cipher_generate_iv entry point? - https://github.com/Mbed-TLS/mbedtls/issues/3653 [15] mbedtls#9255 - Make mbedtls_psa_register_se_key usable with opaque drivers - https://github.com/Mbed-TLS/mbedtls/issues/9255 [16] TF-PSA-Crypto PR #191 - Make mbedtls_psa_register_se_key usable with opaque drivers - https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/191
Best regards, Ivan Kozemchuk
I would expect that nowadays if somebody needs TLS in their product, they just tell Claude what they want and Claude will grab the relevant parts of MbedTLS, fix known bugs, replace some extremely slow code with the latest arm32-assembler versions (10x to 100x speedup on EC, IIRC, reportedly) and instead of having 200k+ code in your product you have just what you need.
Of course this means that if your customer demands MbedTLS version xx.xx (the very latest) then you are a bit stuffed. But that is the way with all open source code, whose devs eventually move on and abandon the project. LWIP was de facto abandoned > 10 years ago but remains a great chunk of code. Same with FatFS, FreeRTOS, etc.
Peter (owner of a small industrial electronics company)
Hello,
We're building Infineon drivers on top of TF-PSA-Crypto, including one for the Secure Enclave (SE) of PSOC Edge, an isolated on-chip core with its own key storage. For the driver spec [1] it is an opaque driver with internal key storage, it plays the role of a "secure element". Most of what we need is already in your driver spec or in open issues. We'd like to know what is planned, and where we could help.
General (all drivers)
- Plugging in drivers [2] [3] - The wrapper generator already accepts another JSON directory and output directory, but it can't combine the built-in and vendor driver sets, and it doesn't generate the operation-context unions in crypto_driver_contexts_*.h. So a multipart driver still needs patches; TF-M's cc3xx patches both the context headers and the generated wrappers. #783 [2] proposes extending the generator. Another option would be two small build-time hooks:
- one optional macro per context union (e.g. ..._EXTRA_HASH_CONTEXTS), defined in a vendor header chosen at build time, through which a driver adds its context members;
- a build option to use wrapper outputs (psa_crypto_driver_wrappers.h and psa_crypto_driver_wrappers_no_static.c) generated outside the source tree, also when pre-generated copies are present (release archives, generation turned off).
Which way do you prefer?
Opaque drivers (Secure Enclave)
Keys stored in the SE [4] [5] - Our SE stores keys itself. Deleting them, and cleaning up after a failed creation, needs the power-failure-safe design from #739 [5]. Is #739 planned? For persistent keys our SE accepts a key ID chosen in advance (the PSA key ID and owner), so implementing allocate_key looks feasible.
mac_verify [6] - Our SE checks a MAC without giving the real MAC to the core. mbedtls#8043 is marked help-wanted. Should we send the PR to TF-PSA-Crypto? Should the issue be moved there first?
Key derivation in the SE [7] [8] [9] [10] [11] - Our SE can derive keys internally. Is the design in these issues still valid? Is it planned? If we help, which issue should we start with?
Key agreement with SE keys [12] - Still present on development: psa_raw_key_agreement() and psa_key_derivation_key_agreement() reject SE keys, even though the driver could handle them. Another SE driver developer hit this too. May we re-file it in TF-PSA-Crypto and send a fix?
IV/nonce made by the driver [13] [14] - Our SE must generate the IV/nonce itself (it is still returned to the caller). Are driver entry points for this still planned? Only for SE (opaque) drivers, or for all drivers?
Location numbers [2] - Our SE and TF-M's built-in key loader both use location 0x800001. Who should assign these numbers? Is the vendor registry from the spec [1] still planned? Should the generator report it when two selected drivers use the same number?
Keys provisioned into the SE outside PSA [15] [16] - Some keys are provisioned into our SE out of band, and the SE keeps their metadata. Is mbedtls_psa_register_opaque_key (#9255) the intended way to register them with the core? Is it planned?
Where something isn't planned, we're happy to contribute. Please tell us what would be welcome.
References [1] PSA driver interface specification (proposed) - https://github.com/Mbed-TLS/TF-PSA-Crypto/blob/development/docs/proposed/psa... [2] TF-PSA-Crypto#783 - Enhance the JSON-to-C generator to support linking drivers from TF-PSA-Crypto-Drivers to TF-PSA-Crypto - https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/783 [3] TF-PSA-Crypto#699 - Test the driver dispatch layer - https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/699 [4] TF-PSA-Crypto#738 - psa_destroy_key does not dispatch to opaque driver's destroy_key entry point - https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/738 [5] TF-PSA-Crypto#739 - Stateful secure element drivers are not resilient - https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/739 [6] mbedtls#8043 - Implement mac_verify driver entry point - https://github.com/Mbed-TLS/mbedtls/issues/8043 [7] mbedtls#5480 - Move key derivation driver dispatch to the template code - https://github.com/Mbed-TLS/mbedtls/issues/5480 [8] mbedtls#5484 - Add support for key derivation in opaque drivers - https://github.com/Mbed-TLS/mbedtls/issues/5484 [9] mbedtls#5486 - Support key derivation entirely inside a secure element - https://github.com/Mbed-TLS/mbedtls/issues/5486 [10] mbedtls#5487 - Implement key_derivation_set_capacity driver entry point - https://github.com/Mbed-TLS/mbedtls/issues/5487 [11] mbedtls#5491 - Add support for key agreement inside a secure element - https://github.com/Mbed-TLS/mbedtls/issues/5491 [12] mbedtls#8747 - psa_raw_key_agreement() and psa_key_derivation_key_agreement() don't work with opaque drivers - https://github.com/Mbed-TLS/mbedtls/issues/8747 [13] mbedtls#4571 - Support PSA opaque drivers with generate_iv or generate_nonce entry points - https://github.com/Mbed-TLS/mbedtls/issues/4571 [14] mbedtls#3653 - Should a transparent driver have a cipher_generate_iv entry point? - https://github.com/Mbed-TLS/mbedtls/issues/3653 [15] mbedtls#9255 - Make mbedtls_psa_register_se_key usable with opaque drivers - https://github.com/Mbed-TLS/mbedtls/issues/9255 [16] TF-PSA-Crypto PR #191 - Make mbedtls_psa_register_se_key usable with opaque drivers - https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/191
Best regards, Ivan Kozemchuk
Hi Ivan,
I'm a maintainer of TF-PSA-Crypto and the architect of most features related to the PSA API and driver support. I'll do my best to answer your questions, but there are a lot of unknowns when it comes to plannning, due to a lack of manpower.
First, note that the draft of the PSA driver interface that's in TF-PSA-Crypto is now frozen. The interface is now being standardized by a working group for eventual publication via GlobalPlatform (who now own the PSA specifications). We chat on the TrustedFirmware discord (https://discord.gg/Chy4RHUtT) and meet on alternate Mondays. Participation is open to core implementers, driver implementers and integrators even if they aren't members of GlobalPlatform or TrustedFirmware.
On 24/11/2026 09:48, Ivan.Kozemchuk--- via mbed-tls wrote:
Hello,
We're building Infineon drivers on top of TF-PSA-Crypto, including one for the Secure Enclave (SE) of PSOC Edge, an isolated on-chip core with its own key storage. For the driver spec [1] it is an opaque driver with internal key storage, it plays the role of a "secure element". Most of what we need is already in your driver spec or in open issues. We'd like to know what is planned, and where we could help.
General (all drivers)
- Plugging in drivers [2] [3] - The wrapper generator already accepts another JSON directory and output directory, but it can't combine the built-in and vendor driver sets, and it doesn't generate the operation-context unions in crypto_driver_contexts_*.h. So a multipart driver still needs patches; TF-M's cc3xx patches both the context headers and the generated wrappers. #783 [2] proposes extending the generator. Another option would be two small build-time hooks:
- one optional macro per context union (e.g. ..._EXTRA_HASH_CONTEXTS), defined in a vendor header chosen at build time, through which a driver adds its context members;
- a build option to use wrapper outputs (psa_crypto_driver_wrappers.h and psa_crypto_driver_wrappers_no_static.c) generated outside the source tree, also when pre-generated copies are present (release archives, generation turned off).
Which way do you prefer?
This is not settled, and I don't have a strong preference. My personal preference would actually be to make crypto_driver_contexts_*.h fully generated from the JSON, however that would make it harder for integrators who don't want to involve python at any stage. Barring that, I have a weak preference against non-hygienic uses of macros, i.e. against your first proposal.
Regarding the location of wrapper outputs, note that we'll hopefully soon have https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/809%C2%A0which allows customizing the location of psa_crypto_driver_wrappers_no_static.h . A logical next stage would be to allow customizing the location of other files, including the context definition headers, which at least solves the problem for integrators who want to fully write their own wrapper code.
Opaque drivers (Secure Enclave)
- Keys stored in the SE [4] [5] - Our SE stores keys itself. Deleting them, and cleaning up after a failed creation, needs the power-failure-safe design from #739 [5]. Is #739 planned? For persistent keys our SE accepts a key ID chosen in advance (the PSA key ID and owner), so implementing allocate_key looks feasible.
https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/739%C2%A0is still the technical plan. All it's missing is the coding (especially testing) and review bandwidth.
- mac_verify [6] - Our SE checks a MAC without giving the real MAC to the core. mbedtls#8043 is marked help-wanted. Should we send the PR to TF-PSA-Crypto? Should the issue be moved there first?
Feel free to make a PR to TF-PSA-Crypto. Although this looks too big for a single PR if you include the testing, so we should perhaps start with a task breakdown. Again, unfortunately, I can't promise review bandwidth.
We're currently migrating issues to the TF-PSA-Crypto repository on an ad hoc basis if they're still relevant to TF-PSA-Crypto but no longer relevant to Mbed TLS. I've just migrated this one.
- Key derivation in the SE [7] [8] [9] [10] [11] - Our SE can derive keys internally. Is the design in these issues still valid? Is it planned? If we help, which issue should we start with?
For key derivation, we're going to change the interface to use Oberon's proposal, which has been shared in https://discord.com/channels/1106321706588577904/1417530000575561891%C2%A0an... will be standardized in the upcoming PSA crypto driver specification. Here we're waiting on a spec write-up, then we'll need a new task breakdown.
- Key agreement with SE keys [12] - Still present on development: psa_raw_key_agreement() and psa_key_derivation_key_agreement() reject SE keys, even though the driver could handle them. Another SE driver developer hit this too. May we re-file it in TF-PSA-Crypto and send a fix?
As above, I've just migrated the issue. It needs a task breakdown, an implementation, and most problematically review bandwidth.
- IV/nonce made by the driver [13] [14] - Our SE must generate the IV/nonce itself (it is still returned to the caller). Are driver entry points for this still planned? Only for SE (opaque) drivers, or for all drivers?
For opaque driver, this is definitely needed, and I've just transferred https://github.com/Mbed-TLS/mbedtls/issues/4571 to TF-PSA-Crypto. I'd prefer to have a specification draft first though.
For transparent drivers, I don't think this is needed. If you see a need, please comment on https://github.com/Mbed-TLS/mbedtls/issues/3653%C2%A0or in the PSA working group.
- Location numbers [2] - Our SE and TF-M's built-in key loader both use location 0x800001. Who should assign these numbers? Is the vendor registry from the spec [1] still planned? Should the generator report it when two selected drivers use the same number?
I'm not aware of any concrete plan for a vendor registry: every time it gets discussed, nobody seems to really want it.
It would be nice if the generator script could report when two drivers use the same number. However, if one driver uses ACME_DRIVER_NUMBER and another one uses YOYODYNE_DRIVER_NUMBER, the script would have no way to know if these happen to be C preprocessor constants with the same value. So I'd expect that a clash in driver numbers would lead to a complaint from the C compiler about repeated values in a switch.
- Keys provisioned into the SE outside PSA [15] [16] - Some keys are provisioned into our SE out of band, and the SE keeps their metadata. Is mbedtls_psa_register_opaque_key (#9255) the intended way to register them with the core? Is it planned?
The interface(s) for “built-in keys” or “pre-provisioned keys”, including whether these are the same thing, seem to be hotly debated every time they come up. I'd prefer to have a concrete specification from the PSA driver working group before implementing something in that space. (I don't mind if it's a draft, but I do want some confidence that it's unlikely to change radically.) There's a very clear need, so I think that will be high priority once we know precisely what to do.
Where something isn't planned, we're happy to contribute. Please tell us what would be welcome.
Mbed TLS, and now TF-PSA-Crypto, have always struggled due to a lack of review bandwidth. (We're not willing to compromise on our high quality bar.) This is even more acute now that LLM can produce passable code with moderate guidance, but they haven't reached a point where they do good reviews. What would help the most would be to have more maintainers who have both some experience with the project, and who we can count on to be available on a long term basis.
mbed-tls@lists.trustedfirmware.org