feat: enabled ECDSA-P192 support for ESP32H2

This commit is contained in:
nilesh.kale
2025-06-16 13:13:03 +08:00
committed by Nilesh Kale
parent 908ff6e5df
commit 2d5d7b819f
15 changed files with 138 additions and 43 deletions
+12 -1
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -7,6 +7,7 @@
#include <sys/param.h>
#include "sdkconfig.h"
#include "soc/soc_caps.h"
#include "soc/chip_revision.h"
#include "hal/assert.h"
#include "hal/efuse_hal.h"
#include "hal/efuse_ll.h"
@@ -79,6 +80,16 @@ void efuse_hal_rs_calculate(const void *data, void *rs_values)
ets_efuse_rs_calculate(data, rs_values);
}
uint32_t efuse_hal_get_ecdsa_curve_mode(void)
{
if (ESP_CHIP_REV_ABOVE(efuse_hal_chip_revision(), 102)) {
return efuse_ll_get_ecdsa_curve_mode();
} else {
// Curve mode is not configurable for previous versions
return 0;
}
}
/******************* eFuse control functions *************************/
bool efuse_hal_is_coding_error_in_block(unsigned block)
@@ -378,6 +378,16 @@ static inline int ecdsa_ll_get_operation_result(void)
return REG_GET_BIT(ECDSA_RESULT_REG, ECDSA_OPERATION_RESULT);
}
/**
* @brief Check if the ECDSA curves configuration is supported
* The ECDSA curves configuration is only avliable in chip version
* above 1.2 in ESP32-H2
*/
static inline bool ecdsa_ll_is_configurable_curve_supported(void)
{
return ESP_CHIP_REV_ABOVE(efuse_hal_chip_revision(), 102);
}
#ifdef __cplusplus
}
#endif
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -54,6 +54,13 @@ void efuse_hal_program(uint32_t block);
*/
void efuse_hal_rs_calculate(const void *data, void *rs_values);
/**
* @brief Get ECDSA curve mode
*
* @return ECDSA curve mode
*/
uint32_t efuse_hal_get_ecdsa_curve_mode(void);
/**
* @brief Checks coding error in a block
*
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -21,6 +21,11 @@ extern "C" {
/******************* eFuse fields *************************/
__attribute__((always_inline)) static inline uint32_t efuse_ll_get_ecdsa_curve_mode(void)
{
return EFUSE.rd_repeat_data0.ecdsa_curve_mode;
}
__attribute__((always_inline)) static inline uint32_t efuse_ll_get_flash_crypt_cnt(void)
{
return EFUSE.rd_repeat_data1.spi_boot_crypt_cnt;