File tree Expand file tree Collapse file tree 6 files changed +35
-1
lines changed Expand file tree Collapse file tree 6 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,14 @@ Mbed TLS
3636 :kconfig:option: `CONFIG_MBEDTLS_PSA_CRYPTO_LEGACY_RNG `. This helps in reducing
3737 ROM/RAM footprint of the Mbed TLS library.
3838
39+ * The newly-added Kconfig option :kconfig:option: `CONFIG_MBEDTLS_PSA_KEY_SLOT_COUNT `
40+ allows to specify the number of key slots available in the PSA Crypto core.
41+ Previously this value was not explicitly set, so Mbed TLS's default value of
42+ 32 was used. The new Kconfig option defaults to 16 instead in order to find
43+ a reasonable compromise between RAM consumption and most common use cases.
44+ It can be further trimmed down to reduce RAM consumption if the final
45+ application doesn't need that many key slots simultaneously.
46+
3947Trusted Firmware-M
4048==================
4149
Original file line number Diff line number Diff line change @@ -273,6 +273,12 @@ Libraries / Subsystems
273273 (or remove, if no other component makes use of it) heap memory requirements
274274 from the final application.
275275
276+ * The Kconfig symbol :kconfig:option: `CONFIG_MBEDTLS_PSA_KEY_SLOT_COUNT ` was
277+ added to allow selecting the number of key slots available in the Mbed TLS
278+ implementation of the PSA Crypto core. It defaults to 16. Since each
279+ slot consumes RAM memory even if unused, this value can be tweaked in order
280+ to minimize RAM usage.
281+
276282* CMSIS-NN
277283
278284* FPGA
Original file line number Diff line number Diff line change @@ -585,6 +585,19 @@ config MBEDTLS_PSA_STATIC_KEY_SLOTS
585585 contain the largest asymmetric/symmetric key type enabled in the build
586586 through PSA_WANT symbols.
587587
588+ config MBEDTLS_PSA_KEY_SLOT_COUNT
589+ int "Number of key slots in PSA Crypto core"
590+ default 16
591+ help
592+ Set the number of key slots that are available in the PSA Crypto core.
593+ Be aware that each slot, even if unused, increases RAM consumption
594+ by ~40 bytes plus:
595+ * the length of the largest asymmetric/symmetric key type enabled in
596+ the build through PSA_WANT symbols, if MBEDTLS_PSA_STATIC_KEY_SLOTS
597+ is set. (This is all defined statically at build time).
598+ * the heap-allocated memory to store the key material of a given slot,
599+ if it is used and MBEDTLS_PSA_STATIC_KEY_SLOTS is not set.
600+
588601endif # MBEDTLS_PSA_CRYPTO_C
589602
590603config MBEDTLS_SSL_DTLS_CONNECTION_ID
Original file line number Diff line number Diff line change 483483#endif
484484
485485#if defined(CONFIG_ARCH_POSIX ) && !defined(CONFIG_PICOLIBC )
486- #define MBEDTLS_PSA_KEY_SLOT_COUNT 64 /* for BLE Mesh tests */
487486#define MBEDTLS_PSA_ITS_FILE_C
488487#define MBEDTLS_FS_IO
489488#endif
498497#define MBEDTLS_PSA_STATIC_KEY_SLOTS
499498#endif
500499
500+ #if defined(CONFIG_MBEDTLS_PSA_KEY_SLOT_COUNT )
501+ #define MBEDTLS_PSA_KEY_SLOT_COUNT CONFIG_MBEDTLS_PSA_KEY_SLOT_COUNT
502+ #endif
503+
501504#if defined(CONFIG_MBEDTLS_USE_PSA_CRYPTO )
502505#define MBEDTLS_USE_PSA_CRYPTO
503506#endif
Original file line number Diff line number Diff line change 11# Enable PSA as a crypto backend in host
22CONFIG_BT_USE_PSA_API=y
33
4+ # Increase the number of key slots in PSA Crypto core
5+ CONFIG_MBEDTLS_PSA_KEY_SLOT_COUNT=64
6+
47# Enable mbedTLS PSA as a crypto backend
58CONFIG_BT_MESH_USES_MBEDTLS_PSA=y
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ CONFIG_MBEDTLS=y
22CONFIG_MBEDTLS_PSA_CRYPTO_C=y
33CONFIG_MBEDTLS_PSA_P256M_DRIVER_ENABLED=y
44CONFIG_MBEDTLS_PSA_STATIC_KEY_SLOTS=y
5+ CONFIG_MBEDTLS_PSA_KEY_SLOT_COUNT=2
56
67CONFIG_PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT=y
78CONFIG_PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE=y
You can’t perform that action at this time.
0 commit comments