diff --git a/components/esp_hw_support/esp_ds.c b/components/esp_hw_support/esp_ds.c index bbbca64ba2..c567508c0a 100644 --- a/components/esp_hw_support/esp_ds.c +++ b/components/esp_hw_support/esp_ds.c @@ -48,6 +48,10 @@ #include "esp32h4/rom/digital_signature.h" #endif +#if CONFIG_IDF_TARGET_ESP32H2 +#include "esp32h2/rom/digital_signature.h" +#endif + struct esp_ds_context { const ets_ds_data_t *data; diff --git a/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/main/test_ds.c b/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/main/test_ds.c index 5ce8e53c53..580cc7b8dc 100644 --- a/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/main/test_ds.c +++ b/components/esp_hw_support/test_apps/esp_hw_support_unity_tests/main/test_ds.c @@ -29,6 +29,11 @@ #include "esp32c6/rom/digital_signature.h" #include "esp32c6/rom/aes.h" #include "esp32c6/rom/sha.h" +#elif CONFIG_IDF_TARGET_ESP32H2 +#include "esp32h2/rom/efuse.h" +#include "esp32h2/rom/digital_signature.h" +#include "esp32h2/rom/aes.h" +#include "esp32h2/rom/sha.h" #endif #include "esp_ds.h" diff --git a/components/esp_hw_support/test_apps/security_support/esp_hw_support_unity_tests/main/gen_digital_signature_tests.py b/components/esp_hw_support/test_apps/security_support/esp_hw_support_unity_tests/main/gen_digital_signature_tests.py index 9a2b19d487..4b4c90262b 100644 --- a/components/esp_hw_support/test_apps/security_support/esp_hw_support_unity_tests/main/gen_digital_signature_tests.py +++ b/components/esp_hw_support/test_apps/security_support/esp_hw_support_unity_tests/main/gen_digital_signature_tests.py @@ -16,11 +16,12 @@ from cryptography.hazmat.primitives.asymmetric.rsa import _modinv as modinv # t from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from cryptography.utils import int_to_bytes -supported_targets = {'esp32s2', 'esp32c3', 'esp32s3', 'esp32c6'} +supported_targets = {'esp32s2', 'esp32c3', 'esp32s3', 'esp32c6', 'esp32h2'} supported_key_size = {'esp32s2':[4096, 3072, 2048, 1024], 'esp32c3':[3072, 2048, 1024], 'esp32s3':[4096, 3072, 2048, 1024], - 'esp32c6':[3072, 2048, 1024]} + 'esp32c6':[3072, 2048, 1024], + 'esp32h2':[3072, 2048, 1024]} NUM_HMAC_KEYS = 3 NUM_MESSAGES = 10 diff --git a/components/esp_hw_support/test_apps/security_support/esp_hw_support_unity_tests/main/test_ds.c b/components/esp_hw_support/test_apps/security_support/esp_hw_support_unity_tests/main/test_ds.c index 5ce8e53c53..580cc7b8dc 100644 --- a/components/esp_hw_support/test_apps/security_support/esp_hw_support_unity_tests/main/test_ds.c +++ b/components/esp_hw_support/test_apps/security_support/esp_hw_support_unity_tests/main/test_ds.c @@ -29,6 +29,11 @@ #include "esp32c6/rom/digital_signature.h" #include "esp32c6/rom/aes.h" #include "esp32c6/rom/sha.h" +#elif CONFIG_IDF_TARGET_ESP32H2 +#include "esp32h2/rom/efuse.h" +#include "esp32h2/rom/digital_signature.h" +#include "esp32h2/rom/aes.h" +#include "esp32h2/rom/sha.h" #endif #include "esp_ds.h" diff --git a/components/hal/CMakeLists.txt b/components/hal/CMakeLists.txt index ff54776585..8f52010fdc 100644 --- a/components/hal/CMakeLists.txt +++ b/components/hal/CMakeLists.txt @@ -159,6 +159,16 @@ if(NOT BOOTLOADER_BUILD) list(APPEND srcs "apm_hal.c") endif() + if(CONFIG_SOC_HMAC_SUPPORTED AND NOT CONFIG_IDF_TARGET_ESP32S2) + # For ESP32-S2 we do not have HMAC HAL layer implementation yet + list(APPEND srcs "hmac_hal.c") + endif() + + if(CONFIG_SOC_DIG_SIGN_SUPPORTED AND NOT CONFIG_IDF_TARGET_ESP32S2) + # For ESP32-S2 we do not have DS HAL layer implementation yet + list(APPEND srcs "ds_hal.c") + endif() + if(${target} STREQUAL "esp32") list(APPEND srcs "touch_sensor_hal.c" @@ -180,13 +190,11 @@ if(NOT BOOTLOADER_BUILD) if(${target} STREQUAL "esp32s3") list(APPEND srcs - "ds_hal.c" "spi_flash_hal_gpspi.c" "touch_sensor_hal.c" "usb_hal.c" "usb_phy_hal.c" "xt_wdt_hal.c" - "hmac_hal.c" "esp32s3/touch_sensor_hal.c" "esp32s3/rtc_cntl_hal.c" "usb_dwc_hal.c") @@ -194,19 +202,15 @@ if(NOT BOOTLOADER_BUILD) if(${target} STREQUAL "esp32c3") list(APPEND srcs - "ds_hal.c" "spi_flash_hal_gpspi.c" "xt_wdt_hal.c" - "hmac_hal.c" "esp32c3/rtc_cntl_hal.c") endif() if(${target} STREQUAL "esp32h4") list(APPEND srcs - "ds_hal.c" "spi_flash_hal_gpspi.c" "aes_hal.c" - "hmac_hal.c" "esp32h4/rtc_cntl_hal.c") endif() @@ -218,9 +222,7 @@ if(NOT BOOTLOADER_BUILD) if(${target} STREQUAL "esp32c6") list(APPEND srcs - "spi_flash_hal_gpspi.c" - "hmac_hal.c" - "ds_hal.c") + "spi_flash_hal_gpspi.c") endif() diff --git a/components/mbedtls/port/esp_ds/esp_rsa_sign_alt.c b/components/mbedtls/port/esp_ds/esp_rsa_sign_alt.c index c975a407d7..320775d90e 100644 --- a/components/mbedtls/port/esp_ds/esp_rsa_sign_alt.c +++ b/components/mbedtls/port/esp_ds/esp_rsa_sign_alt.c @@ -18,6 +18,8 @@ #include "esp32s3/rom/digital_signature.h" #elif CONFIG_IDF_TARGET_ESP32C6 #include "esp32c6/rom/digital_signature.h" +#elif CONFIG_IDF_TARGET_ESP32H2 +#include "esp32h2/rom/digital_signature.h" #else #error "Selected target does not support esp_rsa_sign_alt (for DS)" #endif