-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
esp_hw_support: add crypto lock layer for esp32
- Loading branch information
Showing
4 changed files
with
56 additions
and
16 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
components/esp_hw_support/include/soc/esp32/esp_crypto_lock.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 mpi cryptography peripheral. | ||
* | ||
*/ | ||
void esp_crypto_mpi_lock_acquire(void); | ||
|
||
/** | ||
* @brief Release lock for the mpi cryptography peripheral. | ||
* | ||
*/ | ||
void esp_crypto_mpi_lock_release(void); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* 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: | ||
MPI/RSA: independent | ||
*/ | ||
|
||
/* Lock for the MPI/RSA peripheral */ | ||
|
||
static _lock_t s_crypto_mpi_lock; | ||
|
||
void esp_crypto_mpi_lock_acquire(void) | ||
{ | ||
_lock_acquire(&s_crypto_mpi_lock); | ||
} | ||
|
||
void esp_crypto_mpi_lock_release(void) | ||
{ | ||
_lock_release(&s_crypto_mpi_lock); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters