Skip to content

Commit dd65770

Browse files
committed
[nrf fromtree] boot: zephyr: Only supply MBEDTLS config file path if set
Fixes an issue where the variable might not be set and be empty, and would still be included which would cause a compiler include empty file error Signed-off-by: Jamie McCrae <[email protected]> (cherry picked from commit b92d4dd)
1 parent 03d9b4f commit dd65770

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

boot/zephyr/CMakeLists.txt

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -200,18 +200,18 @@ if(CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256 OR CONFIG_BOOT_ENCRYPT_EC256)
200200
)
201201
endif()
202202
if(CONFIG_BOOT_USE_TINYCRYPT)
203-
# When using ECDSA signatures, pull in our copy of the tinycrypt library.
204-
zephyr_library_include_directories(
205-
${BOOT_DIR}/zephyr/include
206-
${TINYCRYPT_DIR}/include
203+
# When using ECDSA signatures, pull in our copy of the tinycrypt library.
204+
zephyr_library_include_directories(
205+
${BOOT_DIR}/zephyr/include
206+
${TINYCRYPT_DIR}/include
207207
)
208-
zephyr_include_directories(${TINYCRYPT_DIR}/include)
208+
zephyr_include_directories(${TINYCRYPT_DIR}/include)
209209

210-
zephyr_library_sources(
211-
${TINYCRYPT_DIR}/source/ecc.c
212-
${TINYCRYPT_DIR}/source/ecc_dsa.c
213-
${TINYCRYPT_DIR}/source/sha256.c
214-
${TINYCRYPT_DIR}/source/utils.c
210+
zephyr_library_sources(
211+
${TINYCRYPT_DIR}/source/ecc.c
212+
${TINYCRYPT_DIR}/source/ecc_dsa.c
213+
${TINYCRYPT_DIR}/source/sha256.c
214+
${TINYCRYPT_DIR}/source/utils.c
215215
)
216216
elseif(CONFIG_BOOT_USE_NRF_CC310_BL)
217217
zephyr_library_sources(${MCUBOOT_NRF_EXT_DIR}/cc310_glue.c)
@@ -221,12 +221,14 @@ if(CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256 OR CONFIG_BOOT_ENCRYPT_EC256)
221221
zephyr_include_directories(${BL_CRYPTO_DIR}/../include)
222222
endif()
223223

224-
# Since here we are not using Zephyr's mbedTLS but rather our own, we need
225-
# to set MBEDTLS_CONFIG_FILE ourselves. When using Zephyr's copy, this
226-
# variable is set by its Kconfig in the Zephyr codebase.
227-
zephyr_library_compile_definitions(
228-
MBEDTLS_CONFIG_FILE="${CONFIG_MBEDTLS_CFG_FILE}"
224+
if(CONFIG_MBEDTLS_CFG_FILE)
225+
# Since here we are not using Zephyr's mbedTLS but rather our own, we need
226+
# to set MBEDTLS_CONFIG_FILE ourselves. When using Zephyr's copy, this
227+
# variable is set by its Kconfig in the Zephyr codebase.
228+
zephyr_library_compile_definitions(
229+
MBEDTLS_CONFIG_FILE="${CONFIG_MBEDTLS_CFG_FILE}"
229230
)
231+
endif()
230232
elseif(CONFIG_BOOT_SIGNATURE_TYPE_NONE)
231233
zephyr_library_include_directories(
232234
${BOOT_DIR}/zephyr/include

0 commit comments

Comments
 (0)