mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(hal/ecc): Support ECC hardware constant-time point multiplication operations
This commit is contained in:
parent
3000402fcf
commit
2bf6a3cf8b
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -177,3 +177,10 @@ int ecc_hal_read_mod_op_result(uint8_t *r, uint16_t len)
|
||||
}
|
||||
|
||||
#endif /* SOC_ECC_EXTENDED_MODES_SUPPORTED */
|
||||
|
||||
#ifdef SOC_ECC_CONSTANT_TIME_POINT_MUL
|
||||
void ecc_hal_enable_constant_time_point_mul(bool enable)
|
||||
{
|
||||
ecc_ll_enable_constant_time_point_mul(enable);
|
||||
}
|
||||
#endif /* SOC_ECC_CONSTANT_TIME_POINT_MUL */
|
||||
|
@ -148,6 +148,15 @@ static inline void ecc_ll_set_mod_base(ecc_mod_base_t base)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void ecc_ll_enable_constant_time_point_mul(bool enable)
|
||||
{
|
||||
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_write_param(ecc_ll_param_t param, const uint8_t *buf, uint16_t len)
|
||||
{
|
||||
uint32_t reg;
|
||||
|
@ -148,6 +148,15 @@ static inline void ecc_ll_set_mod_base(ecc_mod_base_t base)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void ecc_ll_enable_constant_time_point_mul(bool enable)
|
||||
{
|
||||
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_write_param(ecc_ll_param_t param, const uint8_t *buf, uint16_t len)
|
||||
{
|
||||
uint32_t reg;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -195,6 +195,15 @@ int ecc_hal_read_mod_op_result(uint8_t *r, uint16_t len);
|
||||
|
||||
#endif /* SOC_ECC_EXTENDED_MODES_SUPPORTED */
|
||||
|
||||
#ifdef SOC_ECC_CONSTANT_TIME_POINT_MUL
|
||||
/**
|
||||
* @brief Enable constant time multiplication operations
|
||||
*
|
||||
* @param true: enable; false: disable
|
||||
*/
|
||||
void ecc_hal_enable_constant_time_point_mul(bool enable);
|
||||
#endif /* SOC_ECC_CONSTANT_TIME_POINT_MUL */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -935,6 +935,10 @@ config SOC_SHA_SUPPORT_SHA256
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_ECC_CONSTANT_TIME_POINT_MUL
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_ECDSA_SUPPORT_EXPORT_PUBKEY
|
||||
bool
|
||||
default y
|
||||
|
@ -395,6 +395,9 @@
|
||||
#define SOC_SHA_SUPPORT_SHA224 (1)
|
||||
#define SOC_SHA_SUPPORT_SHA256 (1)
|
||||
|
||||
/*--------------------------- ECC CAPS ---------------------------------------*/
|
||||
#define SOC_ECC_CONSTANT_TIME_POINT_MUL 1
|
||||
|
||||
/*--------------------------- ECDSA CAPS ---------------------------------------*/
|
||||
#define SOC_ECDSA_SUPPORT_EXPORT_PUBKEY (1)
|
||||
|
||||
|
@ -515,6 +515,10 @@ config SOC_SHA_SUPPORT_SHA256
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_ECC_CONSTANT_TIME_POINT_MUL
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_ECDSA_SUPPORT_EXPORT_PUBKEY
|
||||
bool
|
||||
default y
|
||||
|
@ -289,6 +289,9 @@
|
||||
#define SOC_SHA_SUPPORT_SHA224 (1)
|
||||
#define SOC_SHA_SUPPORT_SHA256 (1)
|
||||
|
||||
/*--------------------------- ECC CAPS ---------------------------------------*/
|
||||
#define SOC_ECC_CONSTANT_TIME_POINT_MUL 1
|
||||
|
||||
/*--------------------------- ECDSA CAPS ---------------------------------------*/
|
||||
#define SOC_ECDSA_SUPPORT_EXPORT_PUBKEY (1)
|
||||
#define SOC_ECDSA_SUPPORT_DETERMINISTIC_MODE (1)
|
||||
|
Loading…
Reference in New Issue
Block a user