Date: Tue, 24 Nov 2026 21:24:13 +0100
From: Gilles Peskine <gilles.peskine@arm.com>
Subject: [mbed-tls] Re: Infineon drivers on TF-PSA-Crypto: questions
about planned driver-interface work
To: Ivan.Kozemchuk@infineon.com, mbed-tls@lists.trustedfirmware.org
Cc: Bohdan.Hunko@infineon.com, Hennadiy.Kytsun@infineon.com
Message-ID: <b90be9e5-0bcf-4d89-b22c-b7f2328b8caa@arm.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
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)
>
> 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?
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 which
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)
>
> 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.
https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/739 is still the
technical plan. All it's missing is the coding (especially testing) and
review bandwidth.
> 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?
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.
> 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?
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 and
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.
> 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?
As above, I've just migrated the issue. It needs a task breakdown, an
implementation, and most problematically review bandwidth.
> 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?
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 or in the PSA working group.
> 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?
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.
> 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?
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.
--
Best regards,
Gilles Peskine