Skip to content

Commit 73aa19f

Browse files
Vge0rgetomi-font
authored andcommitted
nrf_security: Refactor builtin key handling
This updates the way we handle the configuration MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS so that it follows the same logic as all the other PSA Crypto core configurations. Also does minor cleanups for this option. It also renames the configuration option MBEDTLS_ENABLE_BUILTIN_KEYS->MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS. This is a promptless option so no need to update any sample/application because of this. Ref: NCSDK-29543 Signed-off-by: Georgios Vasilakis <[email protected]> Update subsys/nrf_security/Kconfig Co-authored-by: Tomi Fontanilles <[email protected]>
1 parent 0dba33c commit 73aa19f

File tree

6 files changed

+4
-27
lines changed

6 files changed

+4
-27
lines changed

modules/trusted-firmware-m/tfm_boards/external_core.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ if(TARGET psa_crypto_library_config)
9393
target_compile_definitions(psa_crypto_library_config
9494
INTERFACE
9595
MBEDTLS_PSA_CRYPTO_DRIVERS
96-
MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS
9796
$<$<BOOL:${CRYPTO_TFM_BUILTIN_KEYS_DRIVER}>:PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER>
9897
)
9998
endif()

subsys/nrf_security/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,6 @@ target_compile_definitions(psa_crypto_library_config
117117
# The name and intent of this comes from TF-M distribution
118118
add_library(psa_interface INTERFACE)
119119

120-
if(CONFIG_MBEDTLS_ENABLE_BUILTIN_KEYS)
121-
# Add config files required for PSA crypto interface
122-
target_compile_definitions(psa_interface
123-
INTERFACE
124-
MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS
125-
)
126-
endif()
127-
128120
# Add the includes from nrf_security, Oberon PSA core, and Arm Mbed TLS
129121
# to the psa_interface library
130122
target_include_directories(psa_interface

subsys/nrf_security/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ config PSA_PROMPTLESS
5353

5454
if NRF_SECURITY
5555

56-
config MBEDTLS_ENABLE_BUILTIN_KEYS
56+
config MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS
5757
bool
5858
default y if SOC_SERIES_NRF54LX && (HW_UNIQUE_KEY || IDENTITY_KEY)
5959
default y if SOC_SERIES_NRF54HX && (SOC_NRF54H20_CPUSEC || SOC_NRF54H20_ENGB_CPUSEC)
6060
help
61-
Promptless option used to control if MBEDTLS should have support for builtin keys or not.
61+
Promptless option used to control if the PSA Crypto core should have support for builtin keys or not.
6262

6363
config MBEDTLS_CFG_FILE
6464
string "mbed TLS configuration file"

subsys/nrf_security/cmake/nrf_config.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ kconfig_check_and_set_base(MBEDTLS_PSA_CRYPTO_CLIENT)
1414
kconfig_check_and_set_base(MBEDTLS_PSA_CRYPTO_C)
1515
kconfig_check_and_set_base(MBEDTLS_USE_PSA_CRYPTO)
1616
kconfig_check_and_set_base(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER)
17+
kconfig_check_and_set_base(MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS)
1718

1819
# Platform
1920
kconfig_check_and_set_base(MBEDTLS_PLATFORM_C)

subsys/nrf_security/configs/legacy_crypto_config.h.template

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,22 +1114,6 @@
11141114
*/
11151115
#cmakedefine MBEDTLS_PKCS1_V21
11161116

1117-
/** \def MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS
1118-
*
1119-
* Enable support for platform built-in keys. If you enable this feature,
1120-
* you must implement the function mbedtls_psa_platform_get_builtin_key().
1121-
* See the documentation of that function for more information.
1122-
*
1123-
* Built-in keys are typically derived from a hardware unique key or
1124-
* stored in a secure element.
1125-
*
1126-
* Requires: MBEDTLS_PSA_CRYPTO_C.
1127-
*
1128-
* \warning This interface is experimental and may change or be removed
1129-
* without notice.
1130-
*/
1131-
//#define MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS
1132-
11331117
/** \def MBEDTLS_PSA_CRYPTO_CLIENT
11341118
*
11351119
* Enable support for PSA crypto client.

subsys/nrf_security/configs/nrf-config.h.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#cmakedefine MBEDTLS_PSA_CRYPTO_CLIENT
2424
#cmakedefine MBEDTLS_PSA_CRYPTO_C
2525
#cmakedefine MBEDTLS_USE_PSA_CRYPTO
26+
#cmakedefine MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS
2627
/* Avoid redefinition as TF-M defines this on the command line */
2728
#ifndef MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
2829
#cmakedefine MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER

0 commit comments

Comments
 (0)