mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-03 10:30:58 +02:00
Merge branch 'change/ecdsa_does_not_use_mpi_esp32h2_eco5' into 'master'
The ECDSA module of ESP32-H2 ECO5 does not use the MPI module See merge request espressif/esp-idf!41156
This commit is contained in:
@@ -47,6 +47,9 @@ static _lock_t s_crypto_ecc_lock;
|
||||
#ifdef SOC_ECDSA_SUPPORTED
|
||||
/* Lock for ECDSA peripheral */
|
||||
static _lock_t s_crypto_ecdsa_lock;
|
||||
#if SOC_ECDSA_USES_MPI
|
||||
#include "hal/ecdsa_ll.h"
|
||||
#endif /* SOC_ECDSA_USES_MPI */
|
||||
#endif /* SOC_ECDSA_SUPPORTED */
|
||||
|
||||
#ifdef SOC_KEY_MANAGER_SUPPORTED
|
||||
@@ -138,14 +141,18 @@ void esp_crypto_ecdsa_lock_acquire(void)
|
||||
_lock_acquire(&s_crypto_ecdsa_lock);
|
||||
esp_crypto_ecc_lock_acquire();
|
||||
#ifdef SOC_ECDSA_USES_MPI
|
||||
esp_crypto_mpi_lock_acquire();
|
||||
if (ecdsa_ll_is_mpi_required()) {
|
||||
esp_crypto_mpi_lock_acquire();
|
||||
}
|
||||
#endif /* SOC_ECDSA_USES_MPI */
|
||||
}
|
||||
|
||||
void esp_crypto_ecdsa_lock_release(void)
|
||||
{
|
||||
#ifdef SOC_ECDSA_USES_MPI
|
||||
esp_crypto_mpi_lock_release();
|
||||
if (ecdsa_ll_is_mpi_required()) {
|
||||
esp_crypto_mpi_lock_release();
|
||||
}
|
||||
#endif /* SOC_ECDSA_USES_MPI */
|
||||
esp_crypto_ecc_lock_release();
|
||||
_lock_release(&s_crypto_ecdsa_lock);
|
||||
|
@@ -418,6 +418,14 @@ static inline bool ecdsa_ll_is_deterministic_mode_supported(void)
|
||||
return ESP_CHIP_REV_ABOVE(efuse_hal_chip_revision(), 102);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the ECDSA peripheral uses MPI module's memory
|
||||
*/
|
||||
static inline bool ecdsa_ll_is_mpi_required(void)
|
||||
{
|
||||
return !ESP_CHIP_REV_ABOVE(efuse_hal_chip_revision(), 102);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -443,6 +443,14 @@ static inline bool ecdsa_ll_is_deterministic_mode_supported(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the ECDSA peripheral uses MPI module's memory
|
||||
*/
|
||||
static inline bool ecdsa_ll_is_mpi_required(void)
|
||||
{
|
||||
return true; // TODO: IDF-13523
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -38,14 +38,18 @@ static void ecdsa_enable_and_reset(void)
|
||||
esp_crypto_ecdsa_enable_periph_clk(true);
|
||||
esp_crypto_ecc_enable_periph_clk(true);
|
||||
#ifdef SOC_ECDSA_USES_MPI
|
||||
esp_crypto_mpi_enable_periph_clk(true);
|
||||
if (ecdsa_ll_is_mpi_required()) {
|
||||
esp_crypto_mpi_enable_periph_clk(true);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ecdsa_disable(void)
|
||||
{
|
||||
#ifdef SOC_ECDSA_USES_MPI
|
||||
esp_crypto_mpi_enable_periph_clk(false);
|
||||
if (ecdsa_ll_is_mpi_required()) {
|
||||
esp_crypto_mpi_enable_periph_clk(false);
|
||||
}
|
||||
#endif
|
||||
esp_crypto_ecc_enable_periph_clk(false);
|
||||
esp_crypto_ecdsa_enable_periph_clk(false);
|
||||
|
@@ -76,10 +76,12 @@ static void esp_ecdsa_acquire_hardware(void)
|
||||
esp_crypto_ecc_enable_periph_clk(true);
|
||||
|
||||
#if SOC_ECDSA_USES_MPI
|
||||
if (ecdsa_ll_is_mpi_required()) {
|
||||
/* We need to reset the MPI peripheral because ECDSA peripheral
|
||||
* of some targets use the MPI peripheral as well.
|
||||
*/
|
||||
esp_crypto_mpi_enable_periph_clk(true);
|
||||
esp_crypto_mpi_enable_periph_clk(true);
|
||||
}
|
||||
#endif /* SOC_ECDSA_USES_MPI */
|
||||
}
|
||||
|
||||
@@ -90,7 +92,9 @@ static void esp_ecdsa_release_hardware(void)
|
||||
esp_crypto_ecc_enable_periph_clk(false);
|
||||
|
||||
#if SOC_ECDSA_USES_MPI
|
||||
esp_crypto_mpi_enable_periph_clk(false);
|
||||
if (ecdsa_ll_is_mpi_required()) {
|
||||
esp_crypto_mpi_enable_periph_clk(false);
|
||||
}
|
||||
#endif /* SOC_ECDSA_USES_MPI */
|
||||
|
||||
esp_crypto_ecdsa_lock_release();
|
||||
|
Reference in New Issue
Block a user