From c125d21c718670c0070f2b9b83a90b1ae5dc3c1d Mon Sep 17 00:00:00 2001 From: "harshal.patil" Date: Mon, 8 Jul 2024 15:09:03 +0530 Subject: [PATCH] change(esp_security): Move anti-DPA configuration into the security component --- components/esp_hw_support/CMakeLists.txt | 4 ---- components/esp_security/CMakeLists.txt | 10 ++++++++++ .../include/esp_dpa_protection.h | 0 .../src/crypto}/esp_dpa_protection.c | 0 4 files changed, 10 insertions(+), 4 deletions(-) rename components/{esp_hw_support => esp_security}/include/esp_dpa_protection.h (100%) rename components/{esp_hw_support => esp_security/src/crypto}/esp_dpa_protection.c (100%) diff --git a/components/esp_hw_support/CMakeLists.txt b/components/esp_hw_support/CMakeLists.txt index b897c05c34..f15fd33ed8 100644 --- a/components/esp_hw_support/CMakeLists.txt +++ b/components/esp_hw_support/CMakeLists.txt @@ -119,10 +119,6 @@ if(NOT BOOTLOADER_BUILD) list(APPEND srcs "esp_etm.c") endif() - if(CONFIG_SOC_CRYPTO_DPA_PROTECTION_SUPPORTED) - list(APPEND srcs "esp_dpa_protection.c") - endif() - if(CONFIG_SOC_DIG_SIGN_SUPPORTED) list(APPEND srcs "esp_ds.c") endif() diff --git a/components/esp_security/CMakeLists.txt b/components/esp_security/CMakeLists.txt index 59bd2ea3ee..62b15c11fb 100644 --- a/components/esp_security/CMakeLists.txt +++ b/components/esp_security/CMakeLists.txt @@ -6,9 +6,19 @@ if(NOT BOOTLOADER_BUILD) list(APPEND srcs "src/crypto/${IDF_TARGET}/clk.c") endif() + if(CONFIG_SOC_CRYPTO_DPA_PROTECTION_SUPPORTED) + list(APPEND srcs "src/crypto/esp_dpa_protection.c") + endif() + list(APPEND priv_requires "soc") endif() idf_component_register(SRCS ${srcs} INCLUDE_DIRS "include" PRIV_REQUIRES ${priv_requires}) + +if(NOT BOOTLOADER_BUILD) + if(CONFIG_SOC_CRYPTO_DPA_PROTECTION_SUPPORTED) + target_link_libraries(${COMPONENT_LIB} PRIVATE "-u esp_crypto_dpa_prot_include_impl") + endif() +endif() diff --git a/components/esp_hw_support/include/esp_dpa_protection.h b/components/esp_security/include/esp_dpa_protection.h similarity index 100% rename from components/esp_hw_support/include/esp_dpa_protection.h rename to components/esp_security/include/esp_dpa_protection.h diff --git a/components/esp_hw_support/esp_dpa_protection.c b/components/esp_security/src/crypto/esp_dpa_protection.c similarity index 100% rename from components/esp_hw_support/esp_dpa_protection.c rename to components/esp_security/src/crypto/esp_dpa_protection.c