ESP-IDF
Select one of the symbols to view example projects that use it.
Symbol previews are coming soon...
Outline
#include <sys/lock.h>
#include "esp_crypto_lock.h"
s_crypto_mpi_lock
s_crypto_sha_aes_lock
esp_crypto_sha_aes_lock_acquire()
esp_crypto_sha_aes_lock_release()
esp_crypto_mpi_lock_acquire()
esp_crypto_mpi_lock_release()
Files
loading (2/5)...
SourceVu
ESP-IDF Framework and Examples
ESP-IDF
components/esp_security/src/esp_crypto_lock.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* ... */
#include
<
sys
/
lock.h>
#include
"
esp_crypto_lock.h"
/* Lock overview:
SHA: peripheral independent, but DMA is shared with AES
AES: peripheral independent, but DMA is shared with SHA
MPI/RSA: independent
ECC: independent
HMAC: needs SHA
DS: needs HMAC (which needs SHA), AES and MPI
ECDSA: needs ECC and MPI
*/
/* ... */
#ifdef
SOC_DIG_SIGN_SUPPORTED
/* Lock for DS peripheral */
static
_lock_t
s_crypto_ds_lock
;
/* ... */
#endif
/* SOC_DIG_SIGN_SUPPORTED */
#ifdef
SOC_HMAC_SUPPORTED
/* Lock for HMAC peripheral */
static
_lock_t
s_crypto_hmac_lock
;
/* ... */
#endif
/* SOC_HMAC_SUPPORTED */
#ifdef
SOC_MPI_SUPPORTED
/* Lock for the MPI/RSA peripheral, also used by the DS peripheral */
static
_lock_t
s_crypto_mpi_lock
;
/* ... */
#endif
/* SOC_MPI_SUPPORTED */
#if
defined
(
SOC_SHA_SUPPORTED
)
||
defined
(
SOC_AES_SUPPORTED
)
/* Single lock for SHA and AES, sharing a reserved GDMA channel */
static
_lock_t
s_crypto_sha_aes_lock
;
/* ... */
#endif
/* defined(SOC_SHA_SUPPORTED) || defined(SOC_AES_SUPPORTED) */
#ifdef
SOC_ECC_SUPPORTED
/* Lock for ECC peripheral */
static
_lock_t
s_crypto_ecc_lock
;
/* ... */
#endif
/* SOC_ECC_SUPPORTED */
#ifdef
SOC_ECDSA_SUPPORTED
/* Lock for ECDSA peripheral */
static
_lock_t
s_crypto_ecdsa_lock
;
/* ... */
#endif
/* SOC_ECDSA_SUPPORTED */
#ifdef
SOC_KEY_MANAGER_SUPPORTED
/* Lock for Key Manager peripheral */
static
_lock_t
s_crypto_key_manager_lock
;
/* ... */
#endif
/* SOC_KEY_MANAGER_SUPPORTED */
#ifdef
SOC_HMAC_SUPPORTED
void
esp_crypto_hmac_lock_acquire
(
void
)
{
_lock_acquire
(
&
s_crypto_hmac_lock
)
;
esp_crypto_sha_aes_lock_acquire
(
)
;
}
{...}
void
esp_crypto_hmac_lock_release
(
void
)
{
esp_crypto_sha_aes_lock_release
(
)
;
_lock_release
(
&
s_crypto_hmac_lock
)
;
}
{...}
/* ... */
#endif
/* SOC_HMAC_SUPPORTED */
#ifdef
SOC_DIG_SIGN_SUPPORTED
void
esp_crypto_ds_lock_acquire
(
void
)
{
_lock_acquire
(
&
s_crypto_ds_lock
)
;
esp_crypto_hmac_lock_acquire
(
)
;
esp_crypto_mpi_lock_acquire
(
)
;
}
{...}
void
esp_crypto_ds_lock_release
(
void
)
{
esp_crypto_mpi_lock_release
(
)
;
esp_crypto_hmac_lock_release
(
)
;
_lock_release
(
&
s_crypto_ds_lock
)
;
}
{...}
/* ... */
#endif
/* SOC_DIG_SIGN_SUPPORTED */
#if
defined
(
SOC_SHA_SUPPORTED
)
||
defined
(
SOC_AES_SUPPORTED
)
void
esp_crypto_sha_aes_lock_acquire
(
void
)
{
_lock_acquire
(
&
s_crypto_sha_aes_lock
)
;
}
{ ... }
void
esp_crypto_sha_aes_lock_release
(
void
)
{
_lock_release
(
&
s_crypto_sha_aes_lock
)
;
}
{ ... }
#endif
/* ... */
/* defined(SOC_SHA_SUPPORTED) || defined(SOC_AES_SUPPORTED) */
#if
defined
(
SOC_SHA_CRYPTO_DMA
)
||
defined
(
SOC_AES_CRYPTO_DMA
)
void
esp_crypto_dma_lock_acquire
(
void
)
{
_lock_acquire
(
&
s_crypto_sha_aes_lock
)
;
}
{...}
void
esp_crypto_dma_lock_release
(
void
)
{
_lock_release
(
&
s_crypto_sha_aes_lock
)
;
}
{...}
/* ... */
#endif
/* defined(SOC_SHA_CRYPTO_DMA) || defined(SOC_AES_CRYPTO_DMA) */
#ifdef
SOC_MPI_SUPPORTED
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
)
;
}
{ ... }
#endif
/* ... */
/* SOC_MPI_SUPPORTED */
#ifdef
SOC_ECC_SUPPORTED
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
)
;
}
{...}
/* ... */
#endif
/* SOC_ECC_SUPPORTED */
#ifdef
SOC_ECDSA_SUPPORTED
void
esp_crypto_ecdsa_lock_acquire
(
void
)
{
_lock_acquire
(
&
s_crypto_ecdsa_lock
)
;
esp_crypto_ecc_lock_acquire
(
)
;
#ifdef
SOC_ECDSA_USES_MPI
esp_crypto_mpi_lock_acquire
(
)
;
#endif
/* SOC_ECDSA_USES_MPI */
}
{...}
void
esp_crypto_ecdsa_lock_release
(
void
)
{
#ifdef
SOC_ECDSA_USES_MPI
esp_crypto_mpi_lock_release
(
)
;
#endif
/* SOC_ECDSA_USES_MPI */
esp_crypto_ecc_lock_release
(
)
;
_lock_release
(
&
s_crypto_ecdsa_lock
)
;
}
{...}
/* ... */
#endif
/* SOC_ECDSA_SUPPORTED */
#ifdef
SOC_KEY_MANAGER_SUPPORTED
void
esp_crypto_key_manager_lock_acquire
(
void
)
{
_lock_acquire
(
&
s_crypto_key_manager_lock
)
;
}
{...}
void
esp_crypto_key_manager_lock_release
(
void
)
{
_lock_release
(
&
s_crypto_key_manager_lock
)
;
}
{...}
/* ... */
#endif
/* SOC_KEY_MANAGER_SUPPORTED */
Details
Show:
from
Types:
Columns:
All items filtered out
All items filtered out
This file uses the notable symbols shown below. Click anywhere in the file to view more details.
_lock_release()
_lock_acquire()
esp_crypto_mpi_lock_acquire()
esp_crypto_mpi_lock_release()
esp_crypto_sha_aes_lock_acquire()
esp_crypto_sha_aes_lock_release()
SOC_MPI_SUPPORTED
SOC_SHA_SUPPORTED
SOC_AES_SUPPORTED
s_crypto_mpi_lock
s_crypto_sha_aes_lock