Skip to content

Commit

Permalink
secure_storage: re-add MbedTLS backend
Browse files Browse the repository at this point in the history
Re-add the option to use the MbedTLS ITS backend on posix. This backend
is much simpler to setup than the Zephyr backends in a testing
environment. This was previously removed in:
  #82319

Signed-off-by: Jordan Yates <[email protected]>
  • Loading branch information
JordanYates committed Feb 17, 2025
1 parent ff4dc62 commit e464430
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/mbedtls/configs/config-tls-generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,11 @@
#define MBEDTLS_PSA_CRYPTO_STORAGE_C
#endif

#if defined(CONFIG_SECURE_STORAGE_ITS_IMPLEMENTATION_MBEDTLS)
#define MBEDTLS_PSA_ITS_FILE_C
#define MBEDTLS_FS_IO
#endif

#endif /* CONFIG_MBEDTLS_PSA_CRYPTO_C */

#if defined(CONFIG_MBEDTLS_PSA_STATIC_KEY_SLOTS)
Expand Down
6 changes: 6 additions & 0 deletions subsys/secure_storage/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ source "subsys/logging/Kconfig.template.log_config"
choice SECURE_STORAGE_ITS_IMPLEMENTATION
prompt "Internal Trusted Storage (ITS) API implementation"

config SECURE_STORAGE_ITS_IMPLEMENTATION_MBEDTLS
bool "MbedTLS ITS implementation"
depends on ARCH_POSIX
help
Use MbedTLS's implementation of the ITS API.

config SECURE_STORAGE_ITS_IMPLEMENTATION_ZEPHYR
bool "Zephyr's ITS implementation"
select SECURE_STORAGE_ITS_TRANSFORM_MODULE
Expand Down
1 change: 1 addition & 0 deletions tests/bsim/bluetooth/mesh/overlay_pst.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_SECURE_STORAGE=y
CONFIG_SECURE_STORAGE_ITS_IMPLEMENTATION_ZEPHYR=y

CONFIG_BT_PERIPHERAL=y
CONFIG_BT_MESH_GATT_PROXY=y
Expand Down
11 changes: 11 additions & 0 deletions tests/subsys/secure_storage/psa/crypto/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) 2025 Embeint Inc
# SPDX-License-Identifier: Apache-2.0

# We explicitly don't want SECURE_STORAGE_ITS_IMPLEMENTATION_MBEDTLS here
# as it implements `psa_ps_*` and not the underlying `secure_storage_its_*`.
choice SECURE_STORAGE_ITS_IMPLEMENTATION
default SECURE_STORAGE_ITS_IMPLEMENTATION_ZEPHYR
default SECURE_STORAGE_ITS_IMPLEMENTATION_CUSTOM
endchoice

source "Kconfig.zephyr"
10 changes: 10 additions & 0 deletions tests/subsys/secure_storage/psa/its/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright (c) 2025 Embeint Inc
# SPDX-License-Identifier: Apache-2.0

# We explicitly don't want SECURE_STORAGE_ITS_IMPLEMENTATION_MBEDTLS here
choice SECURE_STORAGE_ITS_IMPLEMENTATION
default SECURE_STORAGE_ITS_IMPLEMENTATION_ZEPHYR
default SECURE_STORAGE_ITS_IMPLEMENTATION_CUSTOM
endchoice

source "Kconfig.zephyr"

0 comments on commit e464430

Please sign in to comment.