Skip to content

Commit 85b9eb3

Browse files
committed
nrf_security: rename *_DIR CMake variables
Make sure to reuse the same name for already-existing CMake variables (ZEPHYR_*_MODULE_DIR). It makes it more easily understandable to use the standard names. Also rename NRF_SECURITY_ROOT to NRF_SECURITY_DIR so that all variable names end in _DIR. Update nrfxlib revision at the same time to align the variable naming. Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
1 parent 730da41 commit 85b9eb3

19 files changed

Lines changed: 94 additions & 94 deletions

File tree

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if(TARGET tfm_api_ns)
2222
set(EXTERNAL_CRYPTO_CORE_HANDLED_TFM_API_NS True)
2323
target_include_directories(tfm_api_ns
2424
PUBLIC
25-
${OBERON_PSA_CORE_PATH}/include
25+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include
2626
${INTERFACE_INC_DIR}/crypto_keys
2727
)
2828
endif()
@@ -38,14 +38,14 @@ if(TARGET psa_interface)
3838
set(EXTERNAL_CRYPTO_CORE_HANDLED_PSA_INTERFACE True)
3939
target_include_directories(psa_interface
4040
INTERFACE
41-
${NRF_SECURITY_ROOT}/include
42-
$<BUILD_INTERFACE:${OBERON_PSA_CORE_PATH}/include>
41+
${NRF_SECURITY_DIR}/include
42+
$<BUILD_INTERFACE:${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include>
4343
# Oberon library
44-
${OBERON_PSA_CORE_PATH}/library
44+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/library
4545
# Mbed TLS (mbedcrypto) PSA headers
46-
${ARM_MBEDTLS_PATH}/library
47-
${ARM_MBEDTLS_PATH}/include
48-
${ARM_MBEDTLS_PATH}/include/library
46+
${ZEPHYR_MBEDTLS_MODULE_DIR}/library
47+
${ZEPHYR_MBEDTLS_MODULE_DIR}/include
48+
${ZEPHYR_MBEDTLS_MODULE_DIR}/include/library
4949
)
5050
endif()
5151

@@ -66,8 +66,8 @@ if(TARGET psa_crypto_config)
6666
target_include_directories(psa_crypto_config
6767
INTERFACE
6868
${PSA_CRYPTO_CONFIG_INTERFACE_PATH}
69-
${NRF_SECURITY_ROOT}/include
70-
${OBERON_PSA_CORE_PATH}/include
69+
${NRF_SECURITY_DIR}/include
70+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include
7171
${NRF_DIR}/include/tfm
7272
)
7373
endif()
@@ -85,8 +85,8 @@ if(TARGET psa_crypto_library_config)
8585
target_include_directories(psa_crypto_library_config
8686
INTERFACE
8787
${PSA_CRYPTO_CONFIG_LIBRARY_PATH}
88-
${NRF_SECURITY_ROOT}/include
89-
${OBERON_PSA_CORE_PATH}/include
88+
${NRF_SECURITY_DIR}/include
89+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include
9090
${NRF_DIR}/include/tfm
9191
)
9292

@@ -111,7 +111,7 @@ if(TARGET ${MBEDTLS_TARGET_PREFIX}mbedcrypto)
111111
target_include_directories(${MBEDTLS_TARGET_PREFIX}mbedcrypto
112112
PUBLIC
113113
# The following is required for psa/error.h
114-
$<BUILD_INTERFACE:${OBERON_PSA_CORE_PATH}/include>
114+
$<BUILD_INTERFACE:${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include>
115115
)
116116
endif()
117117

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

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,32 @@ endif()
55

66
install(
77
FILES
8-
${OBERON_PSA_CORE_PATH}/include/psa/build_info.h
9-
${OBERON_PSA_CORE_PATH}/include/psa/crypto_adjust_auto_enabled.h
10-
${OBERON_PSA_CORE_PATH}/include/psa/crypto_adjust_config_key_pair_types.h
11-
${OBERON_PSA_CORE_PATH}/include/psa/crypto_adjust_config_synonyms.h
12-
${OBERON_PSA_CORE_PATH}/include/psa/crypto_compat.h
13-
${OBERON_PSA_CORE_PATH}/include/psa/crypto_driver_common.h
14-
${OBERON_PSA_CORE_PATH}/include/psa/crypto_extra.h
15-
${OBERON_PSA_CORE_PATH}/include/psa/crypto_legacy.h
16-
${OBERON_PSA_CORE_PATH}/include/psa/crypto_platform.h
17-
${OBERON_PSA_CORE_PATH}/include/psa/crypto_se_driver.h
18-
${OBERON_PSA_CORE_PATH}/include/psa/crypto_sizes.h
19-
${OBERON_PSA_CORE_PATH}/include/psa/crypto_struct.h
20-
${OBERON_PSA_CORE_PATH}/include/psa/crypto_types.h
21-
${OBERON_PSA_CORE_PATH}/include/psa/crypto_values.h
22-
${OBERON_PSA_CORE_PATH}/include/psa/crypto.h
8+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include/psa/build_info.h
9+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include/psa/crypto_adjust_auto_enabled.h
10+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include/psa/crypto_adjust_config_key_pair_types.h
11+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include/psa/crypto_adjust_config_synonyms.h
12+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include/psa/crypto_compat.h
13+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include/psa/crypto_driver_common.h
14+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include/psa/crypto_extra.h
15+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include/psa/crypto_legacy.h
16+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include/psa/crypto_platform.h
17+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include/psa/crypto_se_driver.h
18+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include/psa/crypto_sizes.h
19+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include/psa/crypto_struct.h
20+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include/psa/crypto_types.h
21+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include/psa/crypto_values.h
22+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include/psa/crypto.h
2323
# The driver contexts are taken from nrf_security
24-
${NRF_SECURITY_ROOT}/include/psa/crypto_driver_contexts_key_derivation.h
25-
${NRF_SECURITY_ROOT}/include/psa/crypto_driver_contexts_primitives.h
26-
${NRF_SECURITY_ROOT}/include/psa/crypto_driver_contexts_composites.h
24+
${NRF_SECURITY_DIR}/include/psa/crypto_driver_contexts_key_derivation.h
25+
${NRF_SECURITY_DIR}/include/psa/crypto_driver_contexts_primitives.h
26+
${NRF_SECURITY_DIR}/include/psa/crypto_driver_contexts_composites.h
2727
DESTINATION ${INSTALL_INTERFACE_INC_DIR}/psa
2828
)
2929

3030
install(
3131
FILES
32-
${OBERON_PSA_CORE_PATH}/include/mbedtls/build_info.h
33-
${OBERON_PSA_CORE_PATH}/include/mbedtls/config_psa.h
32+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include/mbedtls/build_info.h
33+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include/mbedtls/config_psa.h
3434
DESTINATION
3535
${INSTALL_INTERFACE_INC_DIR}/mbedtls
3636
)

subsys/nrf_security/CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ endif()
3535

3636
if(CONFIG_BUILD_WITH_TFM)
3737
# Execute Cmake logic to forward configurations to TF-M build
38-
include(${NRF_SECURITY_ROOT}/cmake/config_to_tf-m.cmake)
38+
include(${NRF_SECURITY_DIR}/cmake/config_to_tf-m.cmake)
3939
endif()
4040

4141
if(CONFIG_BUILD_WITH_TFM OR CONFIG_PSA_SSF_CRYPTO_CLIENT)
@@ -44,7 +44,7 @@ if(CONFIG_BUILD_WITH_TFM OR CONFIG_PSA_SSF_CRYPTO_CLIENT)
4444

4545
# Add replacement platform.c for NS build
4646
list(APPEND src_zephyr
47-
${ARM_MBEDTLS_PATH}/library/platform.c
47+
${ZEPHYR_MBEDTLS_MODULE_DIR}/library/platform.c
4848
)
4949

5050
# The current version of the mbed TLS deliverables requires mbedcrypto built
@@ -121,16 +121,16 @@ add_library(psa_interface INTERFACE)
121121
target_include_directories(psa_interface
122122
INTERFACE
123123
# Oberon PSA headers
124-
${OBERON_PSA_CORE_PATH}/include
125-
${OBERON_PSA_CORE_PATH}/library
124+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/include
125+
${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR}/library
126126
# Mbed TLS (mbedcrypto) PSA headers
127-
${ARM_MBEDTLS_PATH}/library
128-
${ARM_MBEDTLS_PATH}/include
129-
${ARM_MBEDTLS_PATH}/include/library
127+
${ZEPHYR_MBEDTLS_MODULE_DIR}/library
128+
${ZEPHYR_MBEDTLS_MODULE_DIR}/include
129+
${ZEPHYR_MBEDTLS_MODULE_DIR}/include/library
130130
)
131131

132132
# Finally adding the crypto lib
133-
add_subdirectory(${NRFXLIB_DIR}/crypto crypto_copy)
133+
add_subdirectory(${ZEPHYR_NRFXLIB_MODULE_DIR}/crypto crypto_copy)
134134

135135
# Add mbed TLS Libraries
136136
add_subdirectory(src)

subsys/nrf_security/cmake/config_to_tf-m.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set_property(TARGET zephyr_property_target
1010
PROPERTY TFM_CMAKE_OPTIONS
1111
-DNRF_SECURITY_SETTINGS=\"ZEPHYR_DOTCONFIG=${DOTCONFIG}
1212
GCC_M_CPU=${GCC_M_CPU}
13-
ARM_MBEDTLS_PATH=${ARM_MBEDTLS_PATH}
13+
ZEPHYR_MBEDTLS_MODULE_DIR=${ZEPHYR_MBEDTLS_MODULE_DIR}
1414
ZEPHYR_AUTOCONF=${AUTOCONF_H}\"
1515
)
1616

subsys/nrf_security/cmake/generate_configs.cmake

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ macro(generate_mbedcrypto_interface_configs)
4646

4747
# Generate MBEDCRYPTO_CONFIG_FILE
4848
if(CONFIG_MBEDTLS_LEGACY_CRYPTO_C)
49-
include(${NRF_SECURITY_ROOT}/cmake/legacy_crypto_config.cmake)
49+
include(${NRF_SECURITY_DIR}/cmake/legacy_crypto_config.cmake)
5050
else()
51-
include(${NRF_SECURITY_ROOT}/cmake/nrf_config.cmake)
51+
include(${NRF_SECURITY_DIR}/cmake/nrf_config.cmake)
5252
endif()
5353

5454
# Generate the PSA_CRYPTO_CONFIG_FILE (PSA_WANT_XXXX configurations)
55-
include(${NRF_SECURITY_ROOT}/cmake/psa_crypto_want_config.cmake)
55+
include(${NRF_SECURITY_DIR}/cmake/psa_crypto_want_config.cmake)
5656

5757
# Note: Interface doesn't need PSA_CRYPTO_USER_CONFIG_FILE
5858

@@ -127,16 +127,16 @@ macro(generate_mbedcrypto_library_configs)
127127

128128
# Generate MBEDCRYPTO_CONFIG_FILE
129129
if(CONFIG_MBEDTLS_LEGACY_CRYPTO_C)
130-
include(${NRF_SECURITY_ROOT}/cmake/legacy_crypto_config.cmake)
130+
include(${NRF_SECURITY_DIR}/cmake/legacy_crypto_config.cmake)
131131
else()
132-
include(${NRF_SECURITY_ROOT}/cmake/nrf_config.cmake)
132+
include(${NRF_SECURITY_DIR}/cmake/nrf_config.cmake)
133133
endif()
134134

135135
# Generate the PSA_CRYPTO_CONFIG_FILE (PSA_WANT_XXXX configurations)
136-
include(${NRF_SECURITY_ROOT}/cmake/psa_crypto_want_config.cmake)
136+
include(${NRF_SECURITY_DIR}/cmake/psa_crypto_want_config.cmake)
137137

138138
# Generate the PSA_CRYPTO_USER_CONFIG_FILE (PSA_NEED configurations)
139-
include(${NRF_SECURITY_ROOT}/cmake/psa_crypto_config.cmake)
139+
include(${NRF_SECURITY_DIR}/cmake/psa_crypto_config.cmake)
140140

141141
# Restore the backup configurations
142142
kconfig_restore_backup_config(CONFIG_MBEDTLS_PSA_CRYPTO_C)

subsys/nrf_security/cmake/legacy_crypto_config.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,6 @@ kconfig_check_and_set_base_depends(MBEDTLS_SHA224_C
269269
MBEDTLS_SHA256_C
270270
)
271271

272-
configure_file(${NRF_SECURITY_ROOT}/configs/legacy_crypto_config.h.template
272+
configure_file(${NRF_SECURITY_DIR}/configs/legacy_crypto_config.h.template
273273
${generated_include_path}/${CONFIG_MBEDTLS_CONFIG_FILE}
274274
)

subsys/nrf_security/cmake/nrf_config.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,6 @@ endif()
162162
kconfig_check_and_set_base(MBEDTLS_PSA_CRYPTO_CONFIG)
163163

164164
# Generate the Mbed TLS config file (default nrf-config.h)
165-
configure_file(${NRF_SECURITY_ROOT}/configs/nrf-config.h.template
165+
configure_file(${NRF_SECURITY_DIR}/configs/nrf-config.h.template
166166
${generated_include_path}/${CONFIG_MBEDTLS_CONFIG_FILE}
167167
)

subsys/nrf_security/cmake/psa_crypto_config.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,6 @@ kconfig_check_and_set_base_int(MBEDTLS_PSA_KEY_SLOT_COUNT)
512512
kconfig_check_and_set_base_to_one(MBEDTLS_PSA_STATIC_KEY_SLOTS)
513513

514514
# Generate the PSA config file (default nrf-psa-crypto-config.h)
515-
configure_file(${NRF_SECURITY_ROOT}/configs/psa_crypto_config.h.template
515+
configure_file(${NRF_SECURITY_DIR}/configs/psa_crypto_config.h.template
516516
${generated_include_path}/${CONFIG_TF_PSA_CRYPTO_USER_CONFIG_FILE}
517517
)

subsys/nrf_security/cmake/psa_crypto_want_config.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,6 @@ kconfig_check_and_set_base_to_one(PSA_WANT_ALG_AES_KWP)
136136
kconfig_check_and_set_base_int(PSA_MAX_RSA_KEY_BITS)
137137

138138
# Create the Mbed TLS PSA crypto config file (Contains all the PSA_WANT definitions)
139-
configure_file(${NRF_SECURITY_ROOT}/configs/psa_crypto_want_config.h.template
139+
configure_file(${NRF_SECURITY_DIR}/configs/psa_crypto_want_config.h.template
140140
${generated_include_path}/${CONFIG_TF_PSA_CRYPTO_CONFIG_FILE}
141141
)

subsys/nrf_security/configs/config_extra.cmake.in

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ set(PSA_CRYPTO_EXTERNAL_CORE ON CACHE BOOL "Enable buil
1111
# This file is populated with paths needed building nrf_security with and without TF-M
1212
# It is added to circumvent issues with install-targets inside TF-M and to unify the
1313
# CMake code with Zephyr builds
14-
set(NRFXLIB_DIR ${ZEPHYR_NRFXLIB_MODULE_DIR} CACHE STRING "nrfxlib folder")
15-
set(NRF_SECURITY_ROOT ${NRF_DIR}/subsys/nrf_security CACHE STRING "nrf_security root folder")
16-
set(OBERON_PSA_CORE_PATH ${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR} CACHE STRING "oberon-psa-core folder")
17-
set(ARM_MBEDTLS_PATH ${ZEPHYR_MBEDTLS_MODULE_DIR} CACHE STRING "Mbed TLS folder")
18-
set(NRF_DIR ${NRF_DIR} CACHE STRING "NRF folder")
19-
set(TFM_BOARDS_NRF_DIR ${NRF_DIR}/modules/trusted-firmware-m/tfm_boards CACHE STRING "tfm_boards folder")
14+
set(NRF_DIR ${NRF_DIR} CACHE STRING "nrf folder")
15+
set(NRF_SECURITY_DIR ${NRF_DIR}/subsys/nrf_security CACHE STRING "nrf_security folder")
16+
set(TFM_BOARDS_NRF_DIR ${NRF_DIR}/modules/trusted-firmware-m/tfm_boards CACHE STRING "tfm_boards folder")
17+
set(ZEPHYR_NRFXLIB_MODULE_DIR ${ZEPHYR_NRFXLIB_MODULE_DIR} CACHE STRING "nrfxlib folder")
18+
set(ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR ${ZEPHYR_OBERON_PSA_CRYPTO_MODULE_DIR} CACHE STRING "oberon-psa-crypto folder")
19+
set(ZEPHYR_MBEDTLS_MODULE_DIR ${ZEPHYR_MBEDTLS_MODULE_DIR} CACHE STRING "mbedtls folder")
2020

2121
# This file is populated with the Mbed TLS config file names
2222
set(CONFIG_MBEDTLS_CONFIG_FILE ${CONFIG_MBEDTLS_CONFIG_FILE} CACHE STRING "Mbed TLS config file")

0 commit comments

Comments
 (0)