Skip to content

Commit 062835c

Browse files
valeriosettiAnton-TF
authored andcommitted
BL2: use regex instead of external config.py
Using 'config.py' would require the framework submodule to be available in tf-psa-crypto, which might not always be the case (ex: Zephyr). This commit replaces that script with a regex check to verify if the P256-M driver is enabled or not in the BL2's configuration file. Change-Id: Idcbb66086b891cb22c53bf4ebcdba10331bf7ebf Signed-off-by: Valerio Setti <vsetti@baylibre.com>
1 parent 38d15d4 commit 062835c

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

bl2/CMakeLists.txt

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,14 @@ target_include_directories(bl2_crypto_config
4545

4646
# Check if the p256m driver is enabled in the config file, as that will require
4747
# to build some 3rd party specific source code in addition to TF-PSA-Crypto source.
48-
# Note that 0 means SUCCESS here, 1 means FAILURE
49-
set(MBEDTLS_P256M_NOT_FOUND 1)
50-
execute_process(COMMAND
51-
${Python3_EXECUTABLE}
52-
${TF_PSA_CRYPTO_PATH}/scripts/config.py -f "${MCUBOOT_PSA_CRYPTO_CONFIG_FILEPATH}" get MBEDTLS_PSA_P256M_DRIVER_ENABLED
53-
RESULT_VARIABLE MBEDTLS_P256M_NOT_FOUND)
54-
55-
# If the enablement is conditional, the script would still mark it as found
56-
if (${MBEDTLS_P256M_NOT_FOUND} EQUAL 0)
48+
file(STRINGS "${MCUBOOT_PSA_CRYPTO_CONFIG_FILEPATH}" _p256m_line
49+
REGEX "^[ \t]*#define[ \t]+MBEDTLS_PSA_P256M_DRIVER_ENABLED")
50+
if(_p256m_line)
5751
set(MBEDTLS_P256M_ENABLED true)
5852
else()
5953
set(MBEDTLS_P256M_ENABLED false)
6054
endif()
55+
message(VERBOSE "BL2 using P256-M driver: ${MBEDTLS_P256M_ENABLED}")
6156

6257
############################### BL2_CRYPTO #####################################
6358

0 commit comments

Comments
 (0)