mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-23 09:20:30 +00:00
feat: add ecdsa-p384 testcases and relative support for ESP32C5 ECO2
This commit adds testcases in crypto/hal and mbedtls testapps.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "mbedtls/pk.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "hal/ecdsa_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -19,6 +20,22 @@ extern "C" {
|
||||
|
||||
#define USE_ECDSA_KEY_FROM_KEY_MANAGER INT_MAX
|
||||
|
||||
/* ECDSA key block combination macros - aliases to HAL macros */
|
||||
|
||||
/**
|
||||
* @brief Macro to combine two key blocks into a single integer
|
||||
* @note Least significant 4 bits stores block number of the low key block, and the next 4 more significant bits store the high key block number.
|
||||
* @note example: HAL_ECDSA_COMBINE_KEY_BLOCKS(blk_high, blk_low)
|
||||
*/
|
||||
#define MBEDTLS_ECDSA_COMBINE_KEY_BLOCKS HAL_ECDSA_COMBINE_KEY_BLOCKS
|
||||
|
||||
/**
|
||||
* @brief Macro to extract high and low key block numbers from a combined integer
|
||||
* @note Extracts high block from bits 4-7 and low block from bits 0-3
|
||||
* @note example: HAL_ECDSA_EXTRACT_KEY_BLOCKS(combined_blk, blk_high, blk_low)
|
||||
*/
|
||||
#define MBEDTLS_ECDSA_EXTRACT_KEY_BLOCKS HAL_ECDSA_EXTRACT_KEY_BLOCKS
|
||||
|
||||
/**
|
||||
* @brief ECDSA private key context initialization config structure
|
||||
* @note Contains configuration information like the efuse key block that should be used as the private key,
|
||||
@@ -50,7 +67,7 @@ typedef struct {
|
||||
*
|
||||
* @param keypair The mbedtls ECP key-pair structure
|
||||
* @param efuse_blk The efuse key block that should be used as the private key.
|
||||
* The key purpose of this block must be ECDSA_KEY
|
||||
* The efuse block where ECDSA key is stored. If two blocks are used to store the key, then the macro MBEDTLS_ECDSA_COMBINE_KEY_BLOCKS() can be used to combine them. The macro is defined in this header file.
|
||||
* @return - 0 if successful
|
||||
* - MBEDTLS_ERR_ECP_BAD_INPUT_DATA if invalid ecp group id specified
|
||||
* - MBEDTLS_ERR_ECP_INVALID_KEY if efuse block with purpose ECDSA_KEY is not found
|
||||
@@ -70,7 +87,7 @@ int esp_ecdsa_load_pubkey(mbedtls_ecp_keypair *keypair, int efuse_blk);
|
||||
* @param key The MPI in which this functions stores the hardware context.
|
||||
* This must be uninitialized
|
||||
* @param efuse_blk The efuse key block that should be used as the private key.
|
||||
* The key purpose of this block must be ECDSA_KEY
|
||||
* The efuse block where ECDSA key is stored. If two blocks are used to store the key, then the macro MBEDTLS_ECDSA_COMBINE_KEY_BLOCKS() can be used to combine them. The macro is defined in this header file.
|
||||
*
|
||||
* @return - 0 if successful
|
||||
* - -1 otherwise
|
||||
@@ -86,7 +103,7 @@ int esp_ecdsa_privkey_load_mpi(mbedtls_mpi *key, int efuse_blk);
|
||||
* @param key_ctx The context in which this functions stores the hardware context.
|
||||
* This must be uninitialized
|
||||
* @param efuse_blk The efuse key block that should be used as the private key.
|
||||
* The key purpose of this block must be ECDSA_KEY
|
||||
* The efuse block where ECDSA key is stored. If two blocks are used to store the key, then the macro MBEDTLS_ECDSA_COMBINE_KEY_BLOCKS() can be used to combine them. The macro is defined in this header file.
|
||||
*
|
||||
* @return - 0 if successful
|
||||
* - -1 otherwise
|
||||
|
Reference in New Issue
Block a user