mbedtls: use soc capability macros in build CMakeLists
@@ -110,18 +110,27 @@ endif()
target_sources(mbedtls PRIVATE ${mbedtls_target_sources})
# Choose perihperal type
-if(CONFIG_IDF_TARGET_ESP32)
- set(SHA_PERIPHERAL_TYPE "parallel_engine")
- set(AES_PERIPHERAL_TYPE "block")
-else()
+
+if(CONFIG_SOC_SHA_SUPPORTED)
+ if(CONFIG_SOC_SHA_SUPPORT_DMA)
set(SHA_PERIPHERAL_TYPE "dma")
+ else()
+ set(SHA_PERIPHERAL_TYPE "parallel_engine")
+ endif()
+endif()
+
+if(CONFIG_SOC_AES_SUPPORTED)
+ if(CONFIG_SOC_AES_SUPPORT_DMA)
set(AES_PERIPHERAL_TYPE "dma")
+ else()
+ set(AES_PERIPHERAL_TYPE "block")
+ endif()
endif()
if(SHA_PERIPHERAL_TYPE STREQUAL "dma")
target_include_directories(mbedcrypto PRIVATE "${COMPONENT_DIR}/port/sha/dma/include")
- if(CONFIG_IDF_TARGET_ESP32S2)
+ if(NOT CONFIG_SOC_SHA_GDMA)
set(SHA_DMA_SRCS "${COMPONENT_DIR}/port/sha/dma/esp_sha_crypto_dma_impl.c")
else()
set(SHA_DMA_SRCS "${COMPONENT_DIR}/port/sha/dma/esp_sha_gdma_impl.c"
@@ -132,7 +141,7 @@ endif()
if(AES_PERIPHERAL_TYPE STREQUAL "dma")
- if(CONFIG_IDF_TARGET_ESP32S2)
+ if(NOT CONFIG_SOC_AES_GDMA)
set(AES_DMA_SRCS "${COMPONENT_DIR}/port/aes/dma/esp_aes_crypto_dma_impl.c")
else()
set(AES_DMA_SRCS "${COMPONENT_DIR}/port/aes/dma/esp_aes_gdma_impl.c")
@@ -145,12 +154,20 @@ endif()
target_sources(mbedcrypto PRIVATE "${COMPONENT_DIR}/port/esp_hardware.c"
"${COMPONENT_DIR}/port/esp_mem.c"
"${COMPONENT_DIR}/port/esp_timing.c"
- "${COMPONENT_DIR}/port/sha/esp_sha.c"
- "${COMPONENT_DIR}/port/aes/esp_aes_xts.c"
+)
+
+if(CONFIG_SOC_AES_SUPPORTED)
+ target_sources(mbedcrypto PRIVATE "${COMPONENT_DIR}/port/aes/esp_aes_xts.c"
"${COMPONENT_DIR}/port/aes/esp_aes_common.c"
"${COMPONENT_DIR}/port/aes/${AES_PERIPHERAL_TYPE}/esp_aes.c"
+ )
+endif()
+
+if(CONFIG_SOC_SHA_SUPPORTED)
+ target_sources(mbedcrypto PRIVATE "${COMPONENT_DIR}/port/sha/esp_sha.c"
"${COMPONENT_DIR}/port/sha/${SHA_PERIPHERAL_TYPE}/sha.c"
)
+endif()
# CONFIG_ESP_TLS_USE_DS_PERIPHERAL can be enabled only for the supported targets.
if(CONFIG_ESP_TLS_USE_DS_PERIPHERAL)
