mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(mbedtls): fixing ecdsa's dependence on ecc_mult clock
This commit is contained in:
parent
0b920ec08a
commit
92849e660e
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: CC0-1.0
|
||||
*/
|
||||
@ -8,10 +8,12 @@
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "esp_crypto_lock.h"
|
||||
#include "esp_efuse_chip.h"
|
||||
#include "esp_private/esp_crypto_lock_internal.h"
|
||||
#include "esp_random.h"
|
||||
#include "hal/clk_gate_ll.h"
|
||||
#include "hal/ecc_ll.h"
|
||||
#include "hal/ecdsa_hal.h"
|
||||
#include "hal/ecdsa_ll.h"
|
||||
#include "hal/ecdsa_types.h"
|
||||
@ -24,6 +26,13 @@
|
||||
|
||||
static void ecdsa_enable_and_reset(void)
|
||||
{
|
||||
esp_crypto_ecdsa_lock_acquire();
|
||||
|
||||
ECC_RCC_ATOMIC() {
|
||||
ecc_ll_enable_bus_clock(true);
|
||||
ecc_ll_reset_register();
|
||||
}
|
||||
|
||||
ECDSA_RCC_ATOMIC() {
|
||||
ecdsa_ll_enable_bus_clock(true);
|
||||
ecdsa_ll_reset_register();
|
||||
@ -32,9 +41,15 @@ static void ecdsa_enable_and_reset(void)
|
||||
|
||||
static void ecdsa_disable(void)
|
||||
{
|
||||
ECC_RCC_ATOMIC() {
|
||||
ecc_ll_enable_bus_clock(false);
|
||||
}
|
||||
|
||||
ECDSA_RCC_ATOMIC() {
|
||||
ecdsa_ll_enable_bus_clock(false);
|
||||
}
|
||||
|
||||
esp_crypto_ecdsa_lock_release();
|
||||
}
|
||||
|
||||
static void ecc_be_to_le(const uint8_t* be_point, uint8_t *le_point, uint8_t len)
|
||||
|
@ -1,9 +1,10 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <string.h>
|
||||
#include "hal/ecc_ll.h"
|
||||
#include "hal/ecdsa_ll.h"
|
||||
#include "hal/ecdsa_hal.h"
|
||||
#include "esp_crypto_lock.h"
|
||||
@ -25,6 +26,11 @@ static void esp_ecdsa_acquire_hardware(void)
|
||||
{
|
||||
esp_crypto_ecdsa_lock_acquire();
|
||||
|
||||
ECC_RCC_ATOMIC() {
|
||||
ecc_ll_enable_bus_clock(true);
|
||||
ecc_ll_reset_register();
|
||||
}
|
||||
|
||||
ECDSA_RCC_ATOMIC() {
|
||||
ecdsa_ll_enable_bus_clock(true);
|
||||
ecdsa_ll_reset_register();
|
||||
@ -33,6 +39,10 @@ static void esp_ecdsa_acquire_hardware(void)
|
||||
|
||||
static void esp_ecdsa_release_hardware(void)
|
||||
{
|
||||
ECC_RCC_ATOMIC() {
|
||||
ecc_ll_enable_bus_clock(false);
|
||||
}
|
||||
|
||||
ECDSA_RCC_ATOMIC() {
|
||||
ecdsa_ll_enable_bus_clock(false);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user