esp32h2: enable DS peripheral support in driver and test application

This commit is contained in:
Mahavir Jain 2023-02-10 10:29:21 +05:30
parent 13c8407a19
commit e4e4ffa3f4
No known key found for this signature in database
GPG Key ID: 99324EF4A00734E0
6 changed files with 30 additions and 11 deletions

View File

@ -48,6 +48,10 @@
#include "esp32h4/rom/digital_signature.h" #include "esp32h4/rom/digital_signature.h"
#endif #endif
#if CONFIG_IDF_TARGET_ESP32H2
#include "esp32h2/rom/digital_signature.h"
#endif
struct esp_ds_context { struct esp_ds_context {
const ets_ds_data_t *data; const ets_ds_data_t *data;

View File

@ -29,6 +29,11 @@
#include "esp32c6/rom/digital_signature.h" #include "esp32c6/rom/digital_signature.h"
#include "esp32c6/rom/aes.h" #include "esp32c6/rom/aes.h"
#include "esp32c6/rom/sha.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 #endif
#include "esp_ds.h" #include "esp_ds.h"

View File

@ -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.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.utils import int_to_bytes 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], supported_key_size = {'esp32s2':[4096, 3072, 2048, 1024],
'esp32c3':[3072, 2048, 1024], 'esp32c3':[3072, 2048, 1024],
'esp32s3':[4096, 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_HMAC_KEYS = 3
NUM_MESSAGES = 10 NUM_MESSAGES = 10

View File

@ -29,6 +29,11 @@
#include "esp32c6/rom/digital_signature.h" #include "esp32c6/rom/digital_signature.h"
#include "esp32c6/rom/aes.h" #include "esp32c6/rom/aes.h"
#include "esp32c6/rom/sha.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 #endif
#include "esp_ds.h" #include "esp_ds.h"

View File

@ -159,6 +159,16 @@ if(NOT BOOTLOADER_BUILD)
list(APPEND srcs "apm_hal.c") list(APPEND srcs "apm_hal.c")
endif() 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") if(${target} STREQUAL "esp32")
list(APPEND srcs list(APPEND srcs
"touch_sensor_hal.c" "touch_sensor_hal.c"
@ -180,13 +190,11 @@ if(NOT BOOTLOADER_BUILD)
if(${target} STREQUAL "esp32s3") if(${target} STREQUAL "esp32s3")
list(APPEND srcs list(APPEND srcs
"ds_hal.c"
"spi_flash_hal_gpspi.c" "spi_flash_hal_gpspi.c"
"touch_sensor_hal.c" "touch_sensor_hal.c"
"usb_hal.c" "usb_hal.c"
"usb_phy_hal.c" "usb_phy_hal.c"
"xt_wdt_hal.c" "xt_wdt_hal.c"
"hmac_hal.c"
"esp32s3/touch_sensor_hal.c" "esp32s3/touch_sensor_hal.c"
"esp32s3/rtc_cntl_hal.c" "esp32s3/rtc_cntl_hal.c"
"usb_dwc_hal.c") "usb_dwc_hal.c")
@ -194,19 +202,15 @@ if(NOT BOOTLOADER_BUILD)
if(${target} STREQUAL "esp32c3") if(${target} STREQUAL "esp32c3")
list(APPEND srcs list(APPEND srcs
"ds_hal.c"
"spi_flash_hal_gpspi.c" "spi_flash_hal_gpspi.c"
"xt_wdt_hal.c" "xt_wdt_hal.c"
"hmac_hal.c"
"esp32c3/rtc_cntl_hal.c") "esp32c3/rtc_cntl_hal.c")
endif() endif()
if(${target} STREQUAL "esp32h4") if(${target} STREQUAL "esp32h4")
list(APPEND srcs list(APPEND srcs
"ds_hal.c"
"spi_flash_hal_gpspi.c" "spi_flash_hal_gpspi.c"
"aes_hal.c" "aes_hal.c"
"hmac_hal.c"
"esp32h4/rtc_cntl_hal.c") "esp32h4/rtc_cntl_hal.c")
endif() endif()
@ -218,9 +222,7 @@ if(NOT BOOTLOADER_BUILD)
if(${target} STREQUAL "esp32c6") if(${target} STREQUAL "esp32c6")
list(APPEND srcs list(APPEND srcs
"spi_flash_hal_gpspi.c" "spi_flash_hal_gpspi.c")
"hmac_hal.c"
"ds_hal.c")
endif() endif()

View File

@ -18,6 +18,8 @@
#include "esp32s3/rom/digital_signature.h" #include "esp32s3/rom/digital_signature.h"
#elif CONFIG_IDF_TARGET_ESP32C6 #elif CONFIG_IDF_TARGET_ESP32C6
#include "esp32c6/rom/digital_signature.h" #include "esp32c6/rom/digital_signature.h"
#elif CONFIG_IDF_TARGET_ESP32H2
#include "esp32h2/rom/digital_signature.h"
#else #else
#error "Selected target does not support esp_rsa_sign_alt (for DS)" #error "Selected target does not support esp_rsa_sign_alt (for DS)"
#endif #endif