mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(esp_hw_support): Add esp_crypto_lock layer for esp32c2
This commit is contained in:
parent
7a32d72409
commit
710b9d228b
@ -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)
|
||||
|
||||
list(APPEND srcs "sar_periph_ctrl.c")
|
||||
list(APPEND srcs "esp_crypto_lock.c"
|
||||
"sar_periph_ctrl.c")
|
||||
|
||||
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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user