mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 11:17:20 +02:00
mbedtls: Acquire lock before enabling MPI (RSA) hardware
- For ESP32-S3
This commit is contained in:
@ -28,6 +28,7 @@
|
|||||||
#include "soc/system_reg.h"
|
#include "soc/system_reg.h"
|
||||||
#include "soc/periph_defs.h"
|
#include "soc/periph_defs.h"
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
#include "esp_crypto_lock.h"
|
||||||
|
|
||||||
size_t esp_mpi_hardware_words(size_t words)
|
size_t esp_mpi_hardware_words(size_t words)
|
||||||
{
|
{
|
||||||
@ -36,6 +37,8 @@ size_t esp_mpi_hardware_words(size_t words)
|
|||||||
|
|
||||||
void esp_mpi_enable_hardware_hw_op( void )
|
void esp_mpi_enable_hardware_hw_op( void )
|
||||||
{
|
{
|
||||||
|
esp_crypto_mpi_lock_acquire();
|
||||||
|
|
||||||
/* Enable RSA hardware */
|
/* Enable RSA hardware */
|
||||||
periph_module_enable(PERIPH_RSA_MODULE);
|
periph_module_enable(PERIPH_RSA_MODULE);
|
||||||
|
|
||||||
@ -54,6 +57,8 @@ void esp_mpi_disable_hardware_hw_op( void )
|
|||||||
|
|
||||||
/* Disable RSA hardware */
|
/* Disable RSA hardware */
|
||||||
periph_module_disable(PERIPH_RSA_MODULE);
|
periph_module_disable(PERIPH_RSA_MODULE);
|
||||||
|
|
||||||
|
esp_crypto_mpi_lock_release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user