Skip to content

Commit b92d4dd

Browse files
committed
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]>
1 parent 9fa0c6b commit b92d4dd

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

boot/zephyr/CMakeLists.txt

+17-15
Original file line numberDiff line numberDiff line change
@@ -197,31 +197,33 @@ if(CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256 OR CONFIG_BOOT_ENCRYPT_EC256)
197197
)
198198
endif()
199199
if(CONFIG_BOOT_USE_TINYCRYPT)
200-
# When using ECDSA signatures, pull in our copy of the tinycrypt library.
201-
zephyr_library_include_directories(
202-
${BOOT_DIR}/zephyr/include
203-
${TINYCRYPT_DIR}/include
200+
# When using ECDSA signatures, pull in our copy of the tinycrypt library.
201+
zephyr_library_include_directories(
202+
${BOOT_DIR}/zephyr/include
203+
${TINYCRYPT_DIR}/include
204204
)
205-
zephyr_include_directories(${TINYCRYPT_DIR}/include)
205+
zephyr_include_directories(${TINYCRYPT_DIR}/include)
206206

207-
zephyr_library_sources(
208-
${TINYCRYPT_DIR}/source/ecc.c
209-
${TINYCRYPT_DIR}/source/ecc_dsa.c
210-
${TINYCRYPT_DIR}/source/sha256.c
211-
${TINYCRYPT_DIR}/source/utils.c
207+
zephyr_library_sources(
208+
${TINYCRYPT_DIR}/source/ecc.c
209+
${TINYCRYPT_DIR}/source/ecc_dsa.c
210+
${TINYCRYPT_DIR}/source/sha256.c
211+
${TINYCRYPT_DIR}/source/utils.c
212212
)
213213
elseif(CONFIG_BOOT_USE_NRF_CC310_BL)
214214
zephyr_library_sources(${NRF_DIR}/cc310_glue.c)
215215
zephyr_library_include_directories(${NRF_DIR})
216216
zephyr_link_libraries(nrfxlib_crypto)
217217
endif()
218218

219-
# Since here we are not using Zephyr's mbedTLS but rather our own, we need
220-
# to set MBEDTLS_CONFIG_FILE ourselves. When using Zephyr's copy, this
221-
# variable is set by its Kconfig in the Zephyr codebase.
222-
zephyr_library_compile_definitions(
223-
MBEDTLS_CONFIG_FILE="${CONFIG_MBEDTLS_CFG_FILE}"
219+
if(CONFIG_MBEDTLS_CFG_FILE)
220+
# Since here we are not using Zephyr's mbedTLS but rather our own, we need
221+
# to set MBEDTLS_CONFIG_FILE ourselves. When using Zephyr's copy, this
222+
# variable is set by its Kconfig in the Zephyr codebase.
223+
zephyr_library_compile_definitions(
224+
MBEDTLS_CONFIG_FILE="${CONFIG_MBEDTLS_CFG_FILE}"
224225
)
226+
endif()
225227
elseif(CONFIG_BOOT_SIGNATURE_TYPE_NONE)
226228
zephyr_library_include_directories(
227229
${BOOT_DIR}/zephyr/include

0 commit comments

Comments
 (0)