mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
Merge branch 'feature/esp32h2_eco5_ecc_v5.2' into 'release/v5.2'
feat(ecc): enable ECC constant time mode for ESP32-H2 ECO5 (v5.2) See merge request espressif/esp-idf!36586
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
#include "soc/ecc_mult_reg.h"
|
||||
#include "soc/pcr_struct.h"
|
||||
#include "soc/pcr_reg.h"
|
||||
#include "soc/chip_revision.h"
|
||||
#include "hal/efuse_hal.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -211,6 +213,18 @@ static inline ecc_mod_base_t ecc_ll_get_mod_base(void)
|
||||
return (ecc_mod_base_t)(REG_GET_FIELD(ECC_MULT_CONF_REG, ECC_MULT_MOD_BASE));
|
||||
}
|
||||
|
||||
static inline void ecc_ll_enable_constant_time_point_mul(bool enable)
|
||||
{
|
||||
// ECC constant time point multiplication is supported only on rev 1.2 and above
|
||||
if (ESP_CHIP_REV_ABOVE(efuse_hal_chip_revision(), 102)){
|
||||
if (enable) {
|
||||
REG_SET_BIT(ECC_MULT_CONF_REG, ECC_MULT_SECURITY_MODE);
|
||||
} else {
|
||||
REG_CLR_BIT(ECC_MULT_CONF_REG, ECC_MULT_SECURITY_MODE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void ecc_ll_read_param(ecc_ll_param_t param, uint8_t *buf, uint16_t len)
|
||||
{
|
||||
uint32_t reg;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -9,8 +9,10 @@
|
||||
#include <string.h>
|
||||
#include "hal/assert.h"
|
||||
#include "soc/ecdsa_reg.h"
|
||||
#include "soc/ecdsa_struct.h"
|
||||
#include "soc/pcr_struct.h"
|
||||
#include "hal/ecdsa_types.h"
|
||||
#include "hal/ecc_ll.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -31,7 +33,7 @@ typedef enum {
|
||||
* @brief Interrupt types in ECDSA
|
||||
*/
|
||||
typedef enum {
|
||||
ECDSA_INT_CALC_DONE,
|
||||
ECDSA_INT_PREP_DONE,
|
||||
ECDSA_INT_SHA_RELEASE,
|
||||
} ecdsa_ll_intr_type_t;
|
||||
|
||||
@@ -97,8 +99,8 @@ static inline void ecdsa_ll_reset_register(void)
|
||||
static inline void ecdsa_ll_enable_intr(ecdsa_ll_intr_type_t type)
|
||||
{
|
||||
switch (type) {
|
||||
case ECDSA_INT_CALC_DONE:
|
||||
REG_SET_FIELD(ECDSA_INT_ENA_REG, ECDSA_CALC_DONE_INT_ENA, 1);
|
||||
case ECDSA_INT_PREP_DONE:
|
||||
REG_SET_FIELD(ECDSA_INT_ENA_REG, ECDSA_PREP_DONE_INT_ENA, 1);
|
||||
break;
|
||||
case ECDSA_INT_SHA_RELEASE:
|
||||
REG_SET_FIELD(ECDSA_INT_ENA_REG, ECDSA_SHA_RELEASE_INT_ENA, 1);
|
||||
@@ -117,8 +119,8 @@ static inline void ecdsa_ll_enable_intr(ecdsa_ll_intr_type_t type)
|
||||
static inline void ecdsa_ll_disable_intr(ecdsa_ll_intr_type_t type)
|
||||
{
|
||||
switch (type) {
|
||||
case ECDSA_INT_CALC_DONE:
|
||||
REG_SET_FIELD(ECDSA_INT_ENA_REG, ECDSA_CALC_DONE_INT_ENA, 0);
|
||||
case ECDSA_INT_PREP_DONE:
|
||||
REG_SET_FIELD(ECDSA_INT_ENA_REG, ECDSA_PREP_DONE_INT_ENA, 0);
|
||||
break;
|
||||
case ECDSA_INT_SHA_RELEASE:
|
||||
REG_SET_FIELD(ECDSA_INT_ENA_REG, ECDSA_SHA_RELEASE_INT_ENA, 0);
|
||||
@@ -137,8 +139,8 @@ static inline void ecdsa_ll_disable_intr(ecdsa_ll_intr_type_t type)
|
||||
static inline void ecdsa_ll_clear_intr(ecdsa_ll_intr_type_t type)
|
||||
{
|
||||
switch (type) {
|
||||
case ECDSA_INT_CALC_DONE:
|
||||
REG_SET_FIELD(ECDSA_INT_CLR_REG, ECDSA_CALC_DONE_INT_CLR, 1);
|
||||
case ECDSA_INT_PREP_DONE:
|
||||
REG_SET_FIELD(ECDSA_INT_CLR_REG, ECDSA_PREP_DONE_INT_CLR, 1);
|
||||
break;
|
||||
case ECDSA_INT_SHA_RELEASE:
|
||||
REG_SET_FIELD(ECDSA_INT_CLR_REG, ECDSA_SHA_RELEASE_INT_CLR, 1);
|
||||
|
||||
Reference in New Issue
Block a user