mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 19:24:33 +02:00
feat(esp_hw_support): Add esp_crypto_lock layer for esp32c2
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Acquire lock for the ECC cryptography peripheral.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void esp_crypto_ecc_lock_acquire(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Release lock for the ECC cryptography peripheral.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void esp_crypto_ecc_lock_release(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
@@ -7,7 +7,8 @@ set(srcs "rtc_clk_init.c"
|
|||||||
|
|
||||||
if(NOT BOOTLOADER_BUILD)
|
if(NOT BOOTLOADER_BUILD)
|
||||||
|
|
||||||
list(APPEND srcs "sar_periph_ctrl.c")
|
list(APPEND srcs "esp_crypto_lock.c"
|
||||||
|
"sar_periph_ctrl.c")
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
26
components/esp_hw_support/port/esp32c2/esp_crypto_lock.c
Normal file
26
components/esp_hw_support/port/esp32c2/esp_crypto_lock.c
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/lock.h>
|
||||||
|
|
||||||
|
#include "esp_crypto_lock.h"
|
||||||
|
|
||||||
|
/* Lock overview:
|
||||||
|
ECC: independent
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Lock for ECC peripheral */
|
||||||
|
static _lock_t s_crypto_ecc_lock;
|
||||||
|
|
||||||
|
void esp_crypto_ecc_lock_acquire(void)
|
||||||
|
{
|
||||||
|
_lock_acquire(&s_crypto_ecc_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
void esp_crypto_ecc_lock_release(void)
|
||||||
|
{
|
||||||
|
_lock_release(&s_crypto_ecc_lock);
|
||||||
|
}
|
Reference in New Issue
Block a user