Mbed TLS v4.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
crypto_adjust_config_support.h
Go to the documentation of this file.
1
11
/*
12
* Copyright The Mbed TLS Contributors
13
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
14
*/
15
16
#ifndef TF_PSA_CRYPTO_PRIVATE_CRYPTO_ADJUST_CONFIG_SUPPORT_H
17
#define TF_PSA_CRYPTO_PRIVATE_CRYPTO_ADJUST_CONFIG_SUPPORT_H
18
19
/* Ideally, we'd set those as defaults in crypto_config.h, but
20
* putting an #ifdef _WIN32 in crypto_config.h would confuse config.py.
21
*
22
* So, adjust it here.
23
* Not related to crypto, but this is the bottom of the stack. */
24
#if defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER <= 1900)
25
#if !defined(MBEDTLS_PLATFORM_SNPRINTF_ALT) && \
26
!defined(MBEDTLS_PLATFORM_SNPRINTF_MACRO)
27
#define MBEDTLS_PLATFORM_SNPRINTF_ALT
28
#endif
29
#if !defined(MBEDTLS_PLATFORM_VSNPRINTF_ALT) && \
30
!defined(MBEDTLS_PLATFORM_VSNPRINTF_MACRO)
31
#define MBEDTLS_PLATFORM_VSNPRINTF_ALT
32
#endif
33
#endif
/* _MINGW32__ || (_MSC_VER && (_MSC_VER <= 1900)) */
34
35
/* If MBEDTLS_PSA_CRYPTO_C is defined, make sure MBEDTLS_PSA_CRYPTO_CLIENT
36
* is defined as well to include all PSA code.
37
*/
38
#if defined(MBEDTLS_PSA_CRYPTO_C)
39
#define MBEDTLS_PSA_CRYPTO_CLIENT
40
/* Enable MBEDTLS_ENTROPY_C in not client-only builds without an
41
* external entropy source. */
42
#if !defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
43
#define MBEDTLS_ENTROPY_C
44
#endif
45
#endif
/* MBEDTLS_PSA_CRYPTO_C */
46
47
/* PKCS5 needs MD. */
48
#if defined(MBEDTLS_PKCS5_C)
49
#define MBEDTLS_MD_C
50
#endif
51
52
/* Auto-enable MBEDTLS_MD_LIGHT based on MBEDTLS_MD_C.
53
* This allows checking for MD_LIGHT rather than MD_LIGHT || MD_C.
54
*/
55
#if defined(MBEDTLS_MD_C)
56
#define MBEDTLS_MD_LIGHT
57
#endif
58
59
/* Auto-enable MBEDTLS_MD_LIGHT if needed by a module that didn't require it
60
* in a previous release, to ensure backwards compatibility.
61
*/
62
#if defined(MBEDTLS_ECJPAKE_C) || \
63
defined(MBEDTLS_PEM_PARSE_C) || \
64
defined(MBEDTLS_ENTROPY_C) || \
65
defined(MBEDTLS_PK_C) || \
66
defined(MBEDTLS_RSA_C)
67
#define MBEDTLS_MD_LIGHT
68
#endif
69
70
#if defined(MBEDTLS_MD_LIGHT)
71
/*
72
* - MBEDTLS_MD_xxx_VIA_PSA is defined if the md module may perform xxx via PSA
73
* (see below).
74
* - MBEDTLS_MD_SOME_PSA is defined if at least one algorithm may be performed
75
* via PSA (see below).
76
* - MBEDTLS_MD_SOME_LEGACY is defined if at least one algorithm may be performed
77
* via a direct legacy call (see below).
78
*
79
* The md module performs an algorithm via PSA if there is a PSA hash
80
* accelerator and the PSA driver subsytem is initialized at the time the
81
* operation is started, and makes a direct legacy call otherwise.
82
*/
83
84
/* PSA accelerated implementations */
85
#if defined(MBEDTLS_PSA_CRYPTO_C)
86
87
#if defined(MBEDTLS_PSA_ACCEL_ALG_MD5)
88
#define MBEDTLS_MD_MD5_VIA_PSA
89
#define MBEDTLS_MD_SOME_PSA
90
#endif
91
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_1)
92
#define MBEDTLS_MD_SHA1_VIA_PSA
93
#define MBEDTLS_MD_SOME_PSA
94
#endif
95
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_224)
96
#define MBEDTLS_MD_SHA224_VIA_PSA
97
#define MBEDTLS_MD_SOME_PSA
98
#endif
99
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_256)
100
#define MBEDTLS_MD_SHA256_VIA_PSA
101
#define MBEDTLS_MD_SOME_PSA
102
#endif
103
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_384)
104
#define MBEDTLS_MD_SHA384_VIA_PSA
105
#define MBEDTLS_MD_SOME_PSA
106
#endif
107
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_512)
108
#define MBEDTLS_MD_SHA512_VIA_PSA
109
#define MBEDTLS_MD_SOME_PSA
110
#endif
111
#if defined(MBEDTLS_PSA_ACCEL_ALG_RIPEMD160)
112
#define MBEDTLS_MD_RIPEMD160_VIA_PSA
113
#define MBEDTLS_MD_SOME_PSA
114
#endif
115
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_224)
116
#define MBEDTLS_MD_SHA3_224_VIA_PSA
117
#define MBEDTLS_MD_SOME_PSA
118
#endif
119
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_256)
120
#define MBEDTLS_MD_SHA3_256_VIA_PSA
121
#define MBEDTLS_MD_SOME_PSA
122
#endif
123
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_384)
124
#define MBEDTLS_MD_SHA3_384_VIA_PSA
125
#define MBEDTLS_MD_SOME_PSA
126
#endif
127
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA3_512)
128
#define MBEDTLS_MD_SHA3_512_VIA_PSA
129
#define MBEDTLS_MD_SOME_PSA
130
#endif
131
132
#elif defined(MBEDTLS_PSA_CRYPTO_CLIENT)
133
134
#if defined(PSA_WANT_ALG_MD5)
135
#define MBEDTLS_MD_MD5_VIA_PSA
136
#define MBEDTLS_MD_SOME_PSA
137
#endif
138
#if defined(PSA_WANT_ALG_SHA_1)
139
#define MBEDTLS_MD_SHA1_VIA_PSA
140
#define MBEDTLS_MD_SOME_PSA
141
#endif
142
#if defined(PSA_WANT_ALG_SHA_224)
143
#define MBEDTLS_MD_SHA224_VIA_PSA
144
#define MBEDTLS_MD_SOME_PSA
145
#endif
146
#if defined(PSA_WANT_ALG_SHA_256)
147
#define MBEDTLS_MD_SHA256_VIA_PSA
148
#define MBEDTLS_MD_SOME_PSA
149
#endif
150
#if defined(PSA_WANT_ALG_SHA_384)
151
#define MBEDTLS_MD_SHA384_VIA_PSA
152
#define MBEDTLS_MD_SOME_PSA
153
#endif
154
#if defined(PSA_WANT_ALG_SHA_512)
155
#define MBEDTLS_MD_SHA512_VIA_PSA
156
#define MBEDTLS_MD_SOME_PSA
157
#endif
158
#if defined(PSA_WANT_ALG_RIPEMD160)
159
#define MBEDTLS_MD_RIPEMD160_VIA_PSA
160
#define MBEDTLS_MD_SOME_PSA
161
#endif
162
#if defined(PSA_WANT_ALG_SHA3_224)
163
#define MBEDTLS_MD_SHA3_224_VIA_PSA
164
#define MBEDTLS_MD_SOME_PSA
165
#endif
166
#if defined(PSA_WANT_ALG_SHA3_256)
167
#define MBEDTLS_MD_SHA3_256_VIA_PSA
168
#define MBEDTLS_MD_SOME_PSA
169
#endif
170
#if defined(PSA_WANT_ALG_SHA3_384)
171
#define MBEDTLS_MD_SHA3_384_VIA_PSA
172
#define MBEDTLS_MD_SOME_PSA
173
#endif
174
#if defined(PSA_WANT_ALG_SHA3_512)
175
#define MBEDTLS_MD_SHA3_512_VIA_PSA
176
#define MBEDTLS_MD_SOME_PSA
177
#endif
178
179
#endif
/* !MBEDTLS_PSA_CRYPTO_CLIENT && !MBEDTLS_PSA_CRYPTO_C */
180
181
/* Built-in implementations */
182
#if defined(MBEDTLS_MD5_C) || \
183
defined(MBEDTLS_SHA1_C) || \
184
defined(MBEDTLS_SHA224_C) || \
185
defined(MBEDTLS_SHA256_C) || \
186
defined(MBEDTLS_SHA384_C) || \
187
defined(MBEDTLS_SHA512_C) || \
188
defined(MBEDTLS_RIPEMD160_C)
189
#define MBEDTLS_MD_SOME_LEGACY
190
#endif
191
192
#endif
/* MBEDTLS_MD_LIGHT */
193
194
/* Backward compatibility: after #8740 the RSA module offers functions to parse
195
* and write RSA private/public keys without relying on the PK one. Of course
196
* this needs ASN1 support to do so, so we enable it here. */
197
#if defined(MBEDTLS_RSA_C)
198
#define MBEDTLS_ASN1_PARSE_C
199
#define MBEDTLS_ASN1_WRITE_C
200
#endif
201
202
/* MBEDTLS_PK_PARSE_EC_COMPRESSED is introduced in Mbed TLS version 3.5, while
203
* in previous version compressed points were automatically supported as long
204
* as PK_PARSE_C and ECP_C were enabled. As a consequence, for backward
205
* compatibility, we auto-enable PK_PARSE_EC_COMPRESSED when these conditions
206
* are met. */
207
#if defined(MBEDTLS_PK_PARSE_C) && defined(MBEDTLS_ECP_C)
208
#define MBEDTLS_PK_PARSE_EC_COMPRESSED
209
#endif
210
211
#endif
/* TF_PSA_CRYPTO_PRIVATE_CRYPTO_ADJUST_CONFIG_SUPPORT_H */
tf-psa-crypto
include
tf-psa-crypto
private
crypto_adjust_config_support.h
Generated on
for Mbed TLS v4.1.1 by
1.17.0