mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
feat(esp_tee): Support ECDSA secp384r1 keys in TEE secure storage
This commit is contained in:
@@ -47,6 +47,9 @@
|
||||
#define MBEDTLS_ASN1_WRITE_C
|
||||
#define MBEDTLS_ASN1_PARSE_C
|
||||
#define MBEDTLS_BIGNUM_C
|
||||
#if CONFIG_SECURE_TEE_SEC_STG_SUPPORT_SECP384R1_SIGN
|
||||
#define MBEDTLS_ECP_DP_SECP384R1_ENABLED
|
||||
#endif
|
||||
#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
|
||||
#if CONFIG_SECURE_TEE_SEC_STG_SUPPORT_SECP192R1_SIGN
|
||||
#define MBEDTLS_ECP_DP_SECP192R1_ENABLED
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -829,7 +829,14 @@ int esp_ecdsa_tee_load_pubkey(mbedtls_ecp_keypair *keypair, const char *tee_key_
|
||||
} else if (keypair->MBEDTLS_PRIVATE(grp).id == MBEDTLS_ECP_DP_SECP192R1) {
|
||||
len = ECDSA_KEY_LEN_P192;
|
||||
key_type = ESP_SEC_STG_KEY_ECDSA_SECP192R1;
|
||||
} else {
|
||||
}
|
||||
#if SOC_ECDSA_SUPPORT_CURVE_P384
|
||||
else if (keypair->MBEDTLS_PRIVATE(grp).id == MBEDTLS_ECP_DP_SECP384R1) {
|
||||
len = ECDSA_KEY_LEN_P384;
|
||||
key_type = ESP_SEC_STG_KEY_ECDSA_SECP384R1;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
return MBEDTLS_ERR_ECP_BAD_INPUT_DATA;
|
||||
}
|
||||
|
||||
@@ -947,7 +954,14 @@ static int esp_ecdsa_tee_sign(mbedtls_ecp_group *grp, mbedtls_mpi* r, mbedtls_mp
|
||||
} else if (grp->id == MBEDTLS_ECP_DP_SECP192R1) {
|
||||
len = ECDSA_KEY_LEN_P192;
|
||||
key_type = ESP_SEC_STG_KEY_ECDSA_SECP192R1;
|
||||
} else {
|
||||
}
|
||||
#if SOC_ECDSA_SUPPORT_CURVE_P384
|
||||
else if (grp->id == MBEDTLS_ECP_DP_SECP384R1) {
|
||||
len = ECDSA_KEY_LEN_P384;
|
||||
key_type = ESP_SEC_STG_KEY_ECDSA_SECP384R1;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
return MBEDTLS_ERR_ECP_BAD_INPUT_DATA;
|
||||
}
|
||||
|
||||
@@ -966,7 +980,7 @@ static int esp_ecdsa_tee_sign(mbedtls_ecp_group *grp, mbedtls_mpi* r, mbedtls_mp
|
||||
esp_tee_sec_storage_ecdsa_sign_t sign = {};
|
||||
esp_err_t err = esp_tee_sec_storage_ecdsa_sign(&cfg, (uint8_t *)msg, msg_len, &sign);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to get signature");
|
||||
ESP_LOGE(TAG, "Failed to get signature: 0x%08lx", err);
|
||||
return MBEDTLS_ERR_ECP_BAD_INPUT_DATA;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user