Merge branch 'bugfix/mbedtls_disable_sha_mpi_v4.1' into 'release/v4.1'

mbedtls: Don't compile hardware MPI & SHA files if disabled in config (v4.1)

See merge request espressif/esp-idf!9403
This commit is contained in:
Mahavir Jain
2020-08-20 21:50:36 +08:00
2 changed files with 25 additions and 9 deletions

View File

@@ -27,15 +27,24 @@ target_sources(mbedtls PRIVATE "${COMPONENT_DIR}/port/mbedtls_debug.c"
"${COMPONENT_DIR}/port/net_sockets.c")
target_sources(mbedcrypto PRIVATE "${COMPONENT_DIR}/port/esp_hardware.c"
"${COMPONENT_DIR}/port/esp_mem.c"
"${COMPONENT_DIR}/port/esp_sha.c"
"${COMPONENT_DIR}/port/esp_sha1.c"
"${COMPONENT_DIR}/port/esp_sha256.c"
"${COMPONENT_DIR}/port/esp_sha512.c"
"${COMPONENT_DIR}/port/esp_timing.c"
"${COMPONENT_DIR}/port/${idf_target}/esp_bignum.c"
"${COMPONENT_DIR}/port/${idf_target}/aes.c"
"${COMPONENT_DIR}/port/${idf_target}/sha.c")
"${COMPONENT_DIR}/port/esp_mem.c"
"${COMPONENT_DIR}/port/esp_timing.c"
"${COMPONENT_DIR}/port/esp_sha.c"
"${COMPONENT_DIR}/port/${idf_target}/aes.c"
)
if(CONFIG_MBEDTLS_HARDWARE_MPI)
target_sources(mbedcrypto PRIVATE "${COMPONENT_DIR}/port/${idf_target}/esp_bignum.c"
)
endif()
if(CONFIG_MBEDTLS_HARDWARE_SHA)
target_sources(mbedcrypto PRIVATE "${COMPONENT_DIR}/port/esp_sha1.c"
"${COMPONENT_DIR}/port/esp_sha256.c"
"${COMPONENT_DIR}/port/esp_sha512.c"
"${COMPONENT_DIR}/port/${idf_target}/sha.c"
)
endif()
foreach(target ${mbedtls_targets})
target_compile_definitions(${target} PUBLIC -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h")

View File

@@ -10,3 +10,10 @@ COMPONENT_OBJEXCLUDE := mbedtls/library/net_sockets.o
COMPONENT_SUBMODULES += mbedtls
ifndef CONFIG_MBEDTLS_HARDWARE_MPI
COMPONENT_OBJEXCLUDE += port/$(IDF_TARGET)/esp_bignum.o
endif
ifndef CONFIG_MBEDTLS_HARDWARE_SHA
COMPONENT_OBJEXCLUDE += port/esp_sha1.o port/esp_sha256.o port/esp_sha512.o port/$(IDF_TARGET)/sha.o
endif