ThePassionate opened a new pull request, #4133:
URL: https://github.com/apache/nuttx-apps/pull/4133

   ## Summary
   
   Adds a PSA secure element driver that routes PSA key management through the 
NuttX cryptodev interface, so applications using the PSA Crypto API can keep 
their keys in the cryptodev key store (the software swkey backend today, a 
hardware secure element driver when one registers) instead of plaintext files.
   
   * **PSA secure element and ITS prefix options**: `MBEDTLS_PSA_CRYPTO_SE_C` 
and `PSA_ITS_STORAGE_PREFIX` Kconfig entries with their config.h mappings.
   * **route PSA key management through cryptodev**: registers a secure element 
driver at `PSA_KEY_LOCATION_LOCAL_CRYPTODEV` whose key management callbacks 
(allocate, validate, import, generate, export, export_public, destroy) 
translate to the `CIOCKEY` ioctls the cryptodev core already exposes 
(`CRK_ALLOCATE_KEY`, `CRK_IMPORT_KEY`, ...). PSA metadata lives in ITS files; 
the key material lives in the cryptodev key store.
   
   Compared to the Vela original this fixes three contract errors found while 
porting: the AES generation now passes the key length the kernel interface 
requires (Vela passed one parameter where cryptodev validates two, so the call 
always failed with EINVAL), the export callback sets the output length the PSA 
core contract requires, and kernel errnos are mapped to PSA status values 
instead of leaking into the PSA status space.
   
   The PSA external RNG routing (`mbedtls_psa_external_get_random`) is already 
upstream (9a1a8d3ca3). The SE driver interface this builds on is marked 
deprecated by Mbed TLS 3.6 in favor of the PSA driver interface, so the port 
deliberately stays minimal.
   
   ## Impact
   
   Both new options default n. `MBEDTLS_PSA_CRYPTODEV_ALT` lives in the 
`CRYPTO_CRYPTODEV` block and selects `MBEDTLS_ALT`.
   
   ## Testing
   
   Built from a fresh checkout state (distclean + refetch) with sim:nsh + 
`CONFIG_CRYPTO_MBEDTLS` + `CONFIG_OPENSSL_MBEDTLS_WRAPPER` + 
`MBEDTLS_PSA_CRYPTO_SE_C` + `MBEDTLS_PSA_CRYPTODEV_ALT`: 0 warnings, 0 errors, 
with the new translation units present in libapps.a (the sim ELF gc-sections 
them out, as nothing calls the registration API there). The full crypto 
regression - 12 tests including the PKCS12 cmocka suite - is byte-identical to 
the plain master baseline.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to