mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-03 03:31:41 +03:00
feat(hal): Add countermeasure for ECDSA generate signature
The ECDSA peripheral before ECO5 of esp32h2 does not perform the ECDSA
sign operation in constant time. This allows an attacker to read the
power signature of the ECDSA sign operation and then calculate the
ECDSA key stored inside the eFuse. The commit adds a countermeasure
for this attack. In this case the real ECDSA sign operation is
masked under dummy ECDSA sign operations to hide its real power
signature
This commit is contained in:
@@ -16,11 +16,23 @@
|
||||
#include <stdint.h>
|
||||
#include "hal/ecdsa_types.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if CONFIG_HAL_ECDSA_GEN_SIG_CM
|
||||
|
||||
#define ECDSA_SIGN_MAX_DUMMY_OP_COUNT 0x7
|
||||
|
||||
/* This value defines the maximum dummy operation count for the ECDSA signature countermeasure.
|
||||
Higher the number, better the countermeasure's effectiveness against attacks.
|
||||
At the same time higher number leads to slower performance.
|
||||
After the countermeasure is enabled, hardware ECDSA signature operation
|
||||
shall take time approximately equal to original time multiplied by this number.
|
||||
If you observe that the reduced performance is affecting your use-case then you may try reducing this time to the minimum. */
|
||||
#endif /* CONFIG_HAL_ECDSA_GEN_SIG_CM */
|
||||
/*
|
||||
* ECDSA peripheral config structure
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user