Skip to content

Commit 1a760a9

Browse files
committed
Merge branch 'feature/add_ecdsa_p384_support_and_testcases_v5.5' into 'release/v5.5'
feat: add ecdsa-p384 testcases and relative support for ESP32C5 ECO2 (v5.5) See merge request espressif/esp-idf!41274
2 parents 5058b75 + 647e7de commit 1a760a9

File tree

33 files changed

+920
-219
lines changed

33 files changed

+920
-219
lines changed

components/esp-tls/esp_tls.h

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ typedef enum {
9696
ESP_TLS_DYN_BUF_STRATEGY_MAX, /*!< to indicate max */
9797
} esp_tls_dyn_buf_strategy_t;
9898

99+
/**
100+
* @brief ECDSA curve options for TLS connections
101+
*/
102+
typedef enum {
103+
ESP_TLS_ECDSA_CURVE_SECP256R1 = 0, /*!< Use SECP256R1 curve */
104+
#if SOC_ECDSA_SUPPORT_CURVE_P384
105+
ESP_TLS_ECDSA_CURVE_SECP384R1, /*!< Use SECP384R1 curve */
106+
#endif
107+
ESP_TLS_ECDSA_CURVE_MAX, /*!< to indicate max */
108+
} esp_tls_ecdsa_curve_t;
99109

100110
/**
101111
* @brief ESP-TLS configuration parameters
@@ -169,7 +179,11 @@ typedef struct esp_tls_cfg {
169179

170180
bool use_ecdsa_peripheral; /*!< Use the ECDSA peripheral for the private key operations */
171181

172-
uint8_t ecdsa_key_efuse_blk; /*!< The efuse block where the ECDSA key is stored */
182+
uint8_t ecdsa_key_efuse_blk; /*!< The efuse block where ECDSA key is stored. For SECP384R1 curve, if two blocks are used, set this to the low block and use ecdsa_key_efuse_blk_high for the high block. */
183+
184+
uint8_t ecdsa_key_efuse_blk_high; /*!< The high efuse block for ECDSA key (used only for SECP384R1 curve). If not set (0), only ecdsa_key_efuse_blk is used. */
185+
186+
esp_tls_ecdsa_curve_t ecdsa_curve; /*!< ECDSA curve to use (SECP256R1 or SECP384R1) */
173187

174188
bool non_block; /*!< Configure non-blocking mode. If set to true the
175189
underneath socket will be configured in non
@@ -313,7 +327,11 @@ typedef struct esp_tls_cfg_server {
313327

314328
bool use_ecdsa_peripheral; /*!< Use ECDSA peripheral to use private key */
315329

316-
uint8_t ecdsa_key_efuse_blk; /*!< The efuse block where ECDSA key is stored */
330+
uint8_t ecdsa_key_efuse_blk; /*!< The efuse block where ECDSA key is stored. For SECP384R1 curve, if two blocks are used, set this to the low block and use ecdsa_key_efuse_blk_high for the high block. */
331+
332+
uint8_t ecdsa_key_efuse_blk_high; /*!< The high efuse block for ECDSA key (used only for SECP384R1 curve). If not set (0), only ecdsa_key_efuse_blk is used. */
333+
334+
esp_tls_ecdsa_curve_t ecdsa_curve; /*!< ECDSA curve to use (SECP256R1 or SECP384R1) */
317335

318336
bool use_secure_element; /*!< Enable this option to use secure element or
319337
atecc608a chip */

components/esp-tls/esp_tls_mbedtls.c

Lines changed: 68 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020
#include <errno.h>
2121
#include "esp_log.h"
2222
#include "esp_check.h"
23+
#include "soc/soc_caps.h"
2324
#include "mbedtls/esp_mbedtls_dynamic.h"
2425
#ifdef CONFIG_MBEDTLS_HARDWARE_ECDSA_SIGN
26+
#include "mbedtls/ecp.h"
2527
#include "ecdsa/ecdsa_alt.h"
2628
#endif
2729

@@ -58,6 +60,31 @@ static mbedtls_x509_crt *global_cacert = NULL;
5860
#define NEWLIB_NANO_SIZE_T_COMPAT_CAST(size_t_var) size_t_var
5961
#endif
6062

63+
#ifdef CONFIG_MBEDTLS_HARDWARE_ECDSA_SIGN
64+
/**
65+
* @brief Convert ESP-TLS ECDSA curve enum to mbedTLS group ID
66+
* @param curve ESP-TLS ECDSA curve enum value
67+
* @param grp_id Pointer to store the converted mbedTLS group ID
68+
* @return ESP_OK on success, ESP_ERR_INVALID_ARG on invalid curve
69+
*/
70+
static esp_err_t esp_tls_ecdsa_curve_to_mbedtls_group_id(esp_tls_ecdsa_curve_t curve, mbedtls_ecp_group_id *grp_id)
71+
{
72+
switch (curve) {
73+
case ESP_TLS_ECDSA_CURVE_SECP256R1:
74+
*grp_id = MBEDTLS_ECP_DP_SECP256R1;
75+
break;
76+
#if SOC_ECDSA_SUPPORT_CURVE_P384
77+
case ESP_TLS_ECDSA_CURVE_SECP384R1:
78+
*grp_id = MBEDTLS_ECP_DP_SECP384R1;
79+
break;
80+
#endif
81+
default:
82+
return ESP_ERR_INVALID_ARG;
83+
}
84+
return ESP_OK;
85+
}
86+
#endif
87+
6188
/* This function shall return the error message when appropriate log level has been set, otherwise this function shall do nothing */
6289
static void mbedtls_print_error_msg(int error)
6390
{
@@ -566,10 +593,18 @@ static esp_err_t set_pki_context(esp_tls_t *tls, const esp_tls_pki_t *pki)
566593
#endif
567594
#ifdef CONFIG_MBEDTLS_HARDWARE_ECDSA_SIGN
568595
if (tls->use_ecdsa_peripheral) {
596+
// Determine the curve group ID based on user preference
597+
mbedtls_ecp_group_id grp_id;
598+
esp_err_t esp_ret = esp_tls_ecdsa_curve_to_mbedtls_group_id(tls->ecdsa_curve, &grp_id);
599+
if (esp_ret != ESP_OK) {
600+
return esp_ret;
601+
}
602+
569603
esp_ecdsa_pk_conf_t conf = {
570-
.grp_id = MBEDTLS_ECP_DP_SECP256R1,
604+
.grp_id = grp_id,
571605
.efuse_block = tls->ecdsa_efuse_blk,
572606
};
607+
573608
ret = esp_ecdsa_set_pk_context(pki->pk_key, &conf);
574609
if (ret != ESP_OK) {
575610
ESP_LOGE(TAG, "Failed to initialize pk context for ecdsa peripheral with the key stored in efuse block %d", tls->ecdsa_efuse_blk);
@@ -754,7 +789,12 @@ static esp_err_t set_server_config(esp_tls_cfg_server_t *cfg, esp_tls_t *tls)
754789
} else if (cfg->use_ecdsa_peripheral) {
755790
#ifdef CONFIG_MBEDTLS_HARDWARE_ECDSA_SIGN
756791
tls->use_ecdsa_peripheral = cfg->use_ecdsa_peripheral;
792+
#if SOC_ECDSA_SUPPORT_CURVE_P384
793+
tls->ecdsa_efuse_blk = HAL_ECDSA_COMBINE_KEY_BLOCKS(cfg->ecdsa_key_efuse_blk_high, cfg->ecdsa_key_efuse_blk);
794+
#else
757795
tls->ecdsa_efuse_blk = cfg->ecdsa_key_efuse_blk;
796+
#endif
797+
tls->ecdsa_curve = cfg->ecdsa_curve;
758798
esp_tls_pki_t pki = {
759799
.public_cert = &tls->servercert,
760800
.pk_key = &tls->serverkey,
@@ -1001,7 +1041,12 @@ esp_err_t set_client_config(const char *hostname, size_t hostlen, esp_tls_cfg_t
10011041
} else if (cfg->use_ecdsa_peripheral) {
10021042
#ifdef CONFIG_MBEDTLS_HARDWARE_ECDSA_SIGN
10031043
tls->use_ecdsa_peripheral = cfg->use_ecdsa_peripheral;
1044+
#if SOC_ECDSA_SUPPORT_CURVE_P384
1045+
tls->ecdsa_efuse_blk = HAL_ECDSA_COMBINE_KEY_BLOCKS(cfg->ecdsa_key_efuse_blk_high, cfg->ecdsa_key_efuse_blk);
1046+
#else
10041047
tls->ecdsa_efuse_blk = cfg->ecdsa_key_efuse_blk;
1048+
#endif
1049+
tls->ecdsa_curve = cfg->ecdsa_curve;
10051050
esp_tls_pki_t pki = {
10061051
.public_cert = &tls->clientcert,
10071052
.pk_key = &tls->clientkey,
@@ -1017,13 +1062,30 @@ esp_err_t set_client_config(const char *hostname, size_t hostlen, esp_tls_cfg_t
10171062
ESP_LOGE(TAG, "Failed to set client pki context");
10181063
return esp_ret;
10191064
}
1020-
static const int ecdsa_peripheral_supported_ciphersuites[] = {
1021-
MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
1065+
1066+
mbedtls_ecp_group_id grp_id;
1067+
esp_ret = esp_tls_ecdsa_curve_to_mbedtls_group_id(tls->ecdsa_curve, &grp_id);
1068+
if (esp_ret != ESP_OK) {
1069+
return esp_ret;
1070+
}
1071+
1072+
// Create dynamic ciphersuite array based on curve
1073+
static int ecdsa_peripheral_supported_ciphersuites[4] = {0}; // Max 4 elements
1074+
int ciphersuite_count = 0;
1075+
1076+
if (grp_id == MBEDTLS_ECP_DP_SECP384R1) {
1077+
ecdsa_peripheral_supported_ciphersuites[ciphersuite_count++] = MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384;
1078+
} else {
1079+
ecdsa_peripheral_supported_ciphersuites[ciphersuite_count++] = MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256;
1080+
}
1081+
10221082
#if CONFIG_MBEDTLS_SSL_PROTO_TLS1_3
1023-
MBEDTLS_TLS1_3_AES_128_GCM_SHA256,
1083+
if (grp_id == MBEDTLS_ECP_DP_SECP384R1) {
1084+
ecdsa_peripheral_supported_ciphersuites[ciphersuite_count++] = MBEDTLS_TLS1_3_AES_256_GCM_SHA384;
1085+
} else {
1086+
ecdsa_peripheral_supported_ciphersuites[ciphersuite_count++] = MBEDTLS_TLS1_3_AES_128_GCM_SHA256;
1087+
}
10241088
#endif
1025-
0
1026-
};
10271089

10281090
ESP_LOGD(TAG, "Set the ciphersuites list");
10291091
mbedtls_ssl_conf_ciphersuites(&tls->conf, ecdsa_peripheral_supported_ciphersuites);

components/esp-tls/private_include/esp_tls_private.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ struct esp_tls {
6767
#ifdef CONFIG_MBEDTLS_HARDWARE_ECDSA_SIGN
6868
bool use_ecdsa_peripheral; /*!< Use the ECDSA peripheral for the private key operations. */
6969
uint8_t ecdsa_efuse_blk; /*!< The efuse block number where the ECDSA key is stored. */
70+
esp_tls_ecdsa_curve_t ecdsa_curve; /*!< ECDSA curve to use (SECP256R1 or SECP384R1) */
7071
#endif
7172
#if CONFIG_MBEDTLS_SSL_PROTO_TLS1_3 && CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS
7273
unsigned char *client_session; /*!< Pointer for the serialized client session ticket context. */

components/esp_http_client/esp_http_client.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ ESP_STATIC_ASSERT((int)ESP_HTTP_CLIENT_TLS_VER_ANY == (int)ESP_TLS_VER_ANY, "Enu
3636
ESP_STATIC_ASSERT((int)ESP_HTTP_CLIENT_TLS_VER_MAX <= (int)ESP_TLS_VER_TLS_MAX, "HTTP client supported TLS is not supported in esp-tls");
3737
ESP_STATIC_ASSERT((int)HTTP_TLS_DYN_BUF_RX_STATIC == (int)ESP_TLS_DYN_BUF_RX_STATIC, "Enum mismatch in esp_http_client and esp-tls");
3838
ESP_STATIC_ASSERT((int)HTTP_TLS_DYN_BUF_STRATEGY_MAX <= (int)ESP_TLS_DYN_BUF_STRATEGY_MAX, "HTTP client supported TLS is not supported in esp-tls");
39+
ESP_STATIC_ASSERT((int)ESP_HTTP_CLIENT_ECDSA_CURVE_MAX <= (int)ESP_TLS_ECDSA_CURVE_MAX, "HTTP client supported ECDSA curve is not supported in esp-tls");
3940

4041
#if CONFIG_ESP_HTTP_CLIENT_EVENT_POST_TIMEOUT == -1
4142
#define ESP_HTTP_CLIENT_EVENT_POST_TIMEOUT portMAX_DELAY
@@ -889,7 +890,13 @@ esp_http_client_handle_t esp_http_client_init(const esp_http_client_config_t *co
889890
}
890891
#ifdef CONFIG_MBEDTLS_HARDWARE_ECDSA_SIGN
891892
if (config->use_ecdsa_peripheral) {
893+
#if SOC_ECDSA_SUPPORT_CURVE_P384
894+
esp_transport_ssl_set_client_key_ecdsa_peripheral_extended(ssl, config->ecdsa_key_efuse_blk, config->ecdsa_key_efuse_blk_high);
895+
#else
892896
esp_transport_ssl_set_client_key_ecdsa_peripheral(ssl, config->ecdsa_key_efuse_blk);
897+
#endif
898+
// Set the ECDSA curve
899+
esp_transport_ssl_set_ecdsa_curve(ssl, config->ecdsa_curve);
893900
}
894901
#endif
895902
if (config->client_key_password && config->client_key_password_len > 0) {

components/esp_http_client/include/esp_http_client.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,17 @@ typedef enum {
9595

9696
typedef esp_err_t (*http_event_handle_cb)(esp_http_client_event_t *evt);
9797

98+
/**
99+
* @brief ECDSA curve options for TLS connections
100+
*/
101+
typedef enum {
102+
ESP_HTTP_CLIENT_ECDSA_CURVE_SECP256R1 = 0, /*!< Use SECP256R1 curve */
103+
#if SOC_ECDSA_SUPPORT_CURVE_P384
104+
ESP_HTTP_CLIENT_ECDSA_CURVE_SECP384R1, /*!< Use SECP384R1 curve */
105+
#endif
106+
ESP_HTTP_CLIENT_ECDSA_CURVE_MAX, /*!< to indicate max */
107+
} esp_http_client_ecdsa_curve_t;
108+
98109
/**
99110
* @brief HTTP method
100111
*/
@@ -176,7 +187,9 @@ typedef struct {
176187
esp_http_client_proto_ver_t tls_version; /*!< TLS protocol version of the connection, e.g., TLS 1.2, TLS 1.3 (default - no preference) */
177188
#ifdef CONFIG_MBEDTLS_HARDWARE_ECDSA_SIGN
178189
bool use_ecdsa_peripheral; /*!< Use ECDSA peripheral to use private key. */
179-
uint8_t ecdsa_key_efuse_blk; /*!< The efuse block where ECDSA key is stored. */
190+
uint8_t ecdsa_key_efuse_blk; /*!< The efuse block where ECDSA key is stored. For SECP384R1 curve, if two blocks are used, set this to the low block and use ecdsa_key_efuse_blk_high for the high block. */
191+
uint8_t ecdsa_key_efuse_blk_high; /*!< The high efuse block for ECDSA key (used only for SECP384R1 curve). If not set (0), only ecdsa_key_efuse_blk is used. */
192+
esp_http_client_ecdsa_curve_t ecdsa_curve; /*!< ECDSA curve to use (SECP256R1 or SECP384R1) */
180193
#endif
181194
const char *user_agent; /*!< The User Agent string to send with HTTP requests */
182195
esp_http_client_method_t method; /*!< HTTP Method */

components/esp_https_server/include/esp_https_server.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2018-2023 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2018-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -100,9 +100,15 @@ struct httpd_ssl_config {
100100
/** Use ECDSA peripheral to use private key */
101101
bool use_ecdsa_peripheral;
102102

103-
/** The efuse block where ECDSA key is stored */
103+
/** The efuse block where ECDSA key is stored. For SECP384R1 curve, if two blocks are used, set this to the low block and use ecdsa_key_efuse_blk_high for the high block. */
104104
uint8_t ecdsa_key_efuse_blk;
105105

106+
/** The high efuse block for ECDSA key (used only for SECP384R1 curve). If not set (0), only ecdsa_key_efuse_blk is used. */
107+
uint8_t ecdsa_key_efuse_blk_high;
108+
109+
/** ECDSA curve to use (SECP256R1 or SECP384R1) */
110+
esp_tls_ecdsa_curve_t ecdsa_curve;
111+
106112
/** Transport Mode (default secure) */
107113
httpd_ssl_transport_mode_t transport_mode;
108114

@@ -186,6 +192,8 @@ typedef struct httpd_ssl_config httpd_ssl_config_t;
186192
.prvtkey_len = 0, \
187193
.use_ecdsa_peripheral = false, \
188194
.ecdsa_key_efuse_blk = 0, \
195+
.ecdsa_key_efuse_blk_high = 0, \
196+
.ecdsa_curve = ESP_TLS_ECDSA_CURVE_SECP256R1, \
189197
.transport_mode = HTTPD_SSL_TRANSPORT_SECURE, \
190198
.port_secure = 443, \
191199
.port_insecure = 80, \

components/esp_https_server/src/https_server.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,10 @@ static esp_err_t create_secure_context(const struct httpd_ssl_config *config, ht
333333
#ifdef CONFIG_MBEDTLS_HARDWARE_ECDSA_SIGN
334334
(*ssl_ctx)->tls_cfg->use_ecdsa_peripheral = config->use_ecdsa_peripheral;
335335
(*ssl_ctx)->tls_cfg->ecdsa_key_efuse_blk = config->ecdsa_key_efuse_blk;
336+
#if SOC_ECDSA_SUPPORT_CURVE_P384
337+
(*ssl_ctx)->tls_cfg->ecdsa_key_efuse_blk_high = config->ecdsa_key_efuse_blk_high;
338+
#endif
339+
(*ssl_ctx)->tls_cfg->ecdsa_curve = config->ecdsa_curve;
336340
#else
337341
ESP_LOGE(TAG, "Please enable the support for signing using ECDSA peripheral in menuconfig.");
338342
ret = ESP_ERR_NOT_SUPPORTED;

components/hal/ecdsa_hal.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121

2222
#define ECDSA_HAL_P192_COMPONENT_LEN 24
2323
#define ECDSA_HAL_P256_COMPONENT_LEN 32
24+
#if SOC_ECDSA_SUPPORT_CURVE_P384
25+
#define ECDSA_HAL_P384_COMPONENT_LEN 48
26+
#endif /* SOC_ECDSA_SUPPORT_CURVE_P384 */
2427

2528
static void configure_ecdsa_periph(ecdsa_hal_config_t *conf)
2629
{
@@ -133,7 +136,11 @@ __attribute__((optimize("O0"))) static void ecdsa_hal_gen_signature_with_counter
133136
void ecdsa_hal_gen_signature(ecdsa_hal_config_t *conf, const uint8_t *hash,
134137
uint8_t *r_out, uint8_t *s_out, uint16_t len)
135138
{
136-
if (len != ECDSA_HAL_P192_COMPONENT_LEN && len != ECDSA_HAL_P256_COMPONENT_LEN) {
139+
if (len != ECDSA_HAL_P192_COMPONENT_LEN && len != ECDSA_HAL_P256_COMPONENT_LEN
140+
#if SOC_ECDSA_SUPPORT_CURVE_P384
141+
&& len != ECDSA_HAL_P384_COMPONENT_LEN
142+
#endif /* SOC_ECDSA_SUPPORT_CURVE_P384 */
143+
) {
137144
HAL_ASSERT(false && "Incorrect length");
138145
}
139146

@@ -166,7 +173,11 @@ void ecdsa_hal_gen_signature(ecdsa_hal_config_t *conf, const uint8_t *hash,
166173
int ecdsa_hal_verify_signature(ecdsa_hal_config_t *conf, const uint8_t *hash, const uint8_t *r, const uint8_t *s,
167174
const uint8_t *pub_x, const uint8_t *pub_y, uint16_t len)
168175
{
169-
if (len != ECDSA_HAL_P192_COMPONENT_LEN && len != ECDSA_HAL_P256_COMPONENT_LEN) {
176+
if (len != ECDSA_HAL_P192_COMPONENT_LEN && len != ECDSA_HAL_P256_COMPONENT_LEN
177+
#if SOC_ECDSA_SUPPORT_CURVE_P384
178+
&& len != ECDSA_HAL_P384_COMPONENT_LEN
179+
#endif /* SOC_ECDSA_SUPPORT_CURVE_P384 */
180+
) {
170181
HAL_ASSERT(false && "Incorrect length");
171182
}
172183

@@ -202,7 +213,11 @@ int ecdsa_hal_verify_signature(ecdsa_hal_config_t *conf, const uint8_t *hash, co
202213
#ifdef SOC_ECDSA_SUPPORT_EXPORT_PUBKEY
203214
void ecdsa_hal_export_pubkey(ecdsa_hal_config_t *conf, uint8_t *pub_x, uint8_t *pub_y, uint16_t len)
204215
{
205-
if (len != ECDSA_HAL_P192_COMPONENT_LEN && len != ECDSA_HAL_P256_COMPONENT_LEN) {
216+
if (len != ECDSA_HAL_P192_COMPONENT_LEN && len != ECDSA_HAL_P256_COMPONENT_LEN
217+
#if SOC_ECDSA_SUPPORT_CURVE_P384
218+
&& len != ECDSA_HAL_P384_COMPONENT_LEN
219+
#endif /* SOC_ECDSA_SUPPORT_CURVE_P384 */
220+
) {
206221
HAL_ASSERT(false && "Incorrect length");
207222
}
208223

components/hal/esp32c5/include/hal/efuse_ll.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,23 @@ __attribute__((always_inline)) static inline uint32_t efuse_ll_get_chip_ver_pkg(
9696

9797
__attribute__((always_inline)) static inline void efuse_ll_set_ecdsa_key_blk(ecdsa_curve_t curve, int efuse_blk)
9898
{
99+
uint8_t efuse_blk_low = 0;
100+
uint8_t efuse_blk_high = 0;
101+
99102
switch (curve) {
100103
case ECDSA_CURVE_SECP192R1:
101104
EFUSE.ecdsa.cfg_ecdsa_p192_blk = efuse_blk;
102105
break;
103106
case ECDSA_CURVE_SECP256R1:
104107
EFUSE.ecdsa.cfg_ecdsa_p256_blk = efuse_blk;
105108
break;
109+
case ECDSA_CURVE_SECP384R1:
110+
// ECDSA-p384 uses two efuse blocks to store the key. These two blocks are stored in a single integer
111+
// where the least significant 4 bits store the low key block number and the next 4 more significant bits store the high key block number.
112+
HAL_ECDSA_EXTRACT_KEY_BLOCKS(efuse_blk, efuse_blk_high, efuse_blk_low);
113+
EFUSE.ecdsa.cfg_ecdsa_p384_h_blk = efuse_blk_high;
114+
EFUSE.ecdsa.cfg_ecdsa_p384_l_blk = efuse_blk_low;
115+
break;
106116
default:
107117
HAL_ASSERT(false && "Unsupported curve");
108118
break;

components/hal/include/hal/ecdsa_hal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ typedef struct {
4040
ecdsa_mode_t mode; /* Mode of operation */
4141
ecdsa_curve_t curve; /* Curve to use for operation */
4242
ecdsa_sha_mode_t sha_mode; /* Source of SHA that needs to be signed */
43-
int efuse_key_blk; /* Efuse block to use as ECDSA key (The purpose of the efuse block must be ECDSA_KEY) */
43+
int efuse_key_blk; /*!< The efuse block where ECDSA key is stored. If two blocks are used to store the key, then the macro HAL_ECDSA_COMBINE_KEY_BLOCKS() can be used to combine them. The macro is defined in hal/ecdsa_types.h */
4444
bool use_km_key; /* Use an ECDSA key from the Key Manager peripheral */
4545
ecdsa_sign_type_t sign_type; /* Type of signature generation */
4646
uint16_t loop_number; /* Determines the loop number value in deterministic derivation algorithm to derive K.

0 commit comments

Comments
 (0)