Mistake on this page?
Report an issue in GitHub or email us
pal_crypto_config.h
Go to the documentation of this file.
1 /** @file
2  * Copyright (c) 2019, Arm Limited or its affiliates. All rights reserved.
3  * SPDX-License-Identifier : Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16 **/
17 
18 /*
19  * \file pal_crypto_config.h
20  *
21  * \brief Configuration options for crypto tests (set of defines)
22  *
23  * This set of compile-time options may be used to enable
24  * or disable features selectively for crypto test suite
25  */
26 
27 #ifndef _PAL_CRYPTO_CONFIG_H_
28 #define _PAL_CRYPTO_CONFIG_H_
29 
30 #include "mbedtls/config.h"
31 
32 /**
33  * \def ARCH_TEST_RSA
34  *
35  * Enable the RSA public-key cryptosystem.
36  * By default all supported keys are enabled.
37  *
38  * Comment macros to disable the types
39  */
40 #ifdef MBEDTLS_RSA_C
41 #define ARCH_TEST_RSA
42 #define ARCH_TEST_RSA_1024
43 #define ARCH_TEST_RSA_2048
44 #define ARCH_TEST_RSA_3072
45 #endif
46 /**
47  * \def ARCH_TEST_ECC
48  * \def ARCH_TEST_ECC_CURVE_SECPXXXR1
49  *
50  * Enable the elliptic curve
51  * Enable specific curves within the Elliptic Curve
52  * module. By default all supported curves are enabled.
53  *
54  * Requires: ARCH_TEST_ECC
55  * Comment macros to disable the curve
56  */
57 #ifdef MBEDTLS_ECP_C
58 #define ARCH_TEST_ECC
59 #ifdef MBEDTLS_ECP_DP_SECP192R1_ENABLED
60 #define ARCH_TEST_ECC_CURVE_SECP192R1
61 #endif
62 #ifdef MBEDTLS_ECP_DP_SECP224R1_ENABLED
63 #define ARCH_TEST_ECC_CURVE_SECP224R1
64 #endif
65 #ifdef MBEDTLS_ECP_DP_SECP256R1_ENABLED
66 #define ARCH_TEST_ECC_CURVE_SECP256R1
67 #endif
68 #ifdef MBEDTLS_ECP_DP_SECP384R1_ENABLED
69 #define ARCH_TEST_ECC_CURVE_SECP384R1
70 #endif
71 #endif
72 /**
73  * \def ARCH_TEST_AES
74  *
75  * Enable the AES block cipher.
76  * By default all supported keys are enabled.
77  *
78  * Comment macros to disable the types
79  */
80 #ifdef MBEDTLS_AES_C
81 #define ARCH_TEST_AES
82 #define ARCH_TEST_AES_128
83 #define ARCH_TEST_AES_192
84 #define ARCH_TEST_AES_256
85 #define ARCH_TEST_AES_512
86 #endif
87 
88 /**
89  * \def ARCH_TEST_DES
90  *
91  * Enable the DES block cipher.
92  * By default all supported keys are enabled.
93  *
94  * Comment macros to disable the types
95  */
96 #ifdef MBEDTLS_DES_C
97 #define ARCH_TEST_DES
98 #define ARCH_TEST_DES_1KEY
99 #define ARCH_TEST_DES_2KEY
100 #define ARCH_TEST_DES_3KEY
101 #endif
102 
103 /**
104  * \def ARCH_TEST_RAW
105  *
106  * A "key" of this type cannot be used for any cryptographic operation.
107  * Applications may use this type to store arbitrary data in the keystore.
108  */
109 #define ARCH_TEST_RAW
110 
111 /**
112  * \def ARCH_TEST_CIPER
113  *
114  * Enable the generic cipher layer.
115  */
116 #ifdef MBEDTLS_CIPHER_C
117 #define ARCH_TEST_CIPER
118 #endif
119 /**
120  * \def ARCH_TEST_ARC4
121  *
122  * Enable the ARC4 key type.
123  */
124 #ifdef MBEDTLS_ARC4_C
125 #define ARCH_TEST_ARC4
126 #endif
127 /**
128  * \def ARCH_TEST_CIPER_MODE_CTR
129  *
130  * Enable Counter Block Cipher mode (CTR) for symmetric ciphers.
131  *
132  * Requires: ARCH_TEST_CIPER
133  */
134 #ifdef MBEDTLS_CIPHER_MODE_CTR
135 #define ARCH_TEST_CIPER_MODE_CTR
136 #endif
137 
138 /**
139  * \def ARCH_TEST_CIPER_MODE_CFB
140  *
141  * Enable Cipher Feedback mode (CFB) for symmetric ciphers.
142  *
143  * Requires: ARCH_TEST_CIPER
144  */
145 #ifdef MBEDTLS_CIPHER_MODE_CFB
146 #define ARCH_TEST_CIPER_MODE_CFB
147 #endif
148 
149 /**
150  * \def ARCH_TEST_CIPER_MODE_CBC
151  *
152  * Enable Cipher Block Chaining mode (CBC) for symmetric ciphers.
153  *
154  * Requires: ARCH_TEST_CIPER
155  */
156 #ifdef MBEDTLS_CIPHER_MODE_CBC
157 #define ARCH_TEST_CIPER_MODE_CBC
158 #endif
159 
160 /**
161  * \def ARCH_TEST_CTR_AES
162  *
163  * Requires: ARCH_TEST_CIPER, ARCH_TEST_AES, ARCH_TEST_CIPER_MODE_CTR
164  */
165 #if defined(MBEDTLS_CIPHER_MODE_CTR) && defined(MBEDTLS_AES_C)
166 #define ARCH_TEST_CTR_AES
167 #endif
168 /**
169  * \def ARCH_TEST_CBC_AES
170  *
171  * Requires: ARCH_TEST_CIPER, ARCH_TEST_AES, ARCH_TEST_CIPER_MODE_CBC
172  *
173  * Comment macros to disable the types
174  */
175 #if defined(MBEDTLS_CIPHER_MODE_CBC) && defined(MBEDTLS_AES_C)
176 #define ARCH_TEST_CBC_AES
177 #define ARCH_TEST_CBC_AES_NO_PADDING
178 #endif
179 
180 
181 /**
182  * \def ARCH_TEST_CBC_NO_PADDING
183  *
184  * Requires: ARCH_TEST_CIPER, ARCH_TEST_CIPER_MODE_CBC
185  *
186  * Comment macros to disable the types
187  */
188 #ifdef MBEDTLS_CIPHER_MODE_CBC
189 #define ARCH_TEST_CBC_NO_PADDING
190 #endif
191 
192 /**
193  * \def ARCH_TEST_CFB_AES
194  *
195  * Requires: ARCH_TEST_CIPER, ARCH_TEST_AES, ARCH_TEST_CIPER_MODE_CFB
196  */
197 #if defined(MBEDTLS_CIPHER_MODE_CFB) && defined(MBEDTLS_AES_C)
198 #define ARCH_TEST_CFB_AES
199 #endif
200 
201 /**
202  * \def ARCH_TEST_PKCS1V15_*
203  *
204  * Enable support for PKCS#1 v1.5 encoding.
205  * Enable support for PKCS#1 v1.5 operations.
206  * Enable support for RSA-OAEP
207  *
208  * Requires: ARCH_TEST_RSA, ARCH_TEST_PKCS1V15
209  *
210  * Comment macros to disable the types
211  */
212 #if defined(MBEDTLS_PKCS1_V15) && defined(MBEDTLS_RSA_C)
213 #define ARCH_TEST_PKCS1V15
214 #define ARCH_TEST_RSA_PKCS1V15_SIGN
215 #define ARCH_TEST_RSA_PKCS1V15_SIGN_RAW
216 #define ARCH_TEST_RSA_PKCS1V15_CRYPT
217 #endif
218 #if defined(MBEDTLS_PKCS1_V21) && defined(MBEDTLS_RSA_C)
219 #define ARCH_TEST_RSA_OAEP
220 #endif
221 
222 
223 /**
224  * \def ARCH_TEST_CBC_PKCS7
225  *
226  * Requires: ARCH_TEST_CIPER_MODE_CBC
227  *
228  * Comment macros to disable the types
229  */
230 #if defined(MBEDTLS_CIPHER_MODE_CBC) && defined(MBEDTLS_CIPHER_PADDING_PKCS7)
231 #define ARCH_TEST_CBC_PKCS7
232 #endif
233 
234 /**
235  * \def ARCH_TEST_ASYMMETRIC_ENCRYPTION
236  *
237  * Enable support for Asymmetric encryption algorithms
238  */
239 #define ARCH_TEST_ASYMMETRIC_ENCRYPTION
240 
241 /**
242  * \def ARCH_TEST_HASH
243  *
244  * Enable the hash algorithm.
245  */
246 #define ARCH_TEST_HASH
247 
248 /**
249  * \def ARCH_TEST_HMAC
250  *
251  * The key policy determines which underlying hash algorithm the key can be
252  * used for.
253  *
254  * Requires: ARCH_TEST_HASH
255  */
256 #define ARCH_TEST_HMAC
257 
258 /**
259  * \def ARCH_TEST_MDX
260  * \def ARCH_TEST_SHAXXX
261  *
262  * Enable the MDX algorithm.
263  * Enable the SHAXXX algorithm.
264  *
265  * Requires: ARCH_TEST_HASH
266  *
267  * Comment macros to disable the types
268  */
269 #ifdef MBEDTLS_MD_C
270 #ifdef MBEDTLS_MD2_C
271 #define ARCH_TEST_MD2
272 #endif
273 #ifdef MBEDTLS_MD4_C
274 #define ARCH_TEST_MD4
275 #endif
276 #ifdef MBEDTLS_MD5_C
277 #define ARCH_TEST_MD5
278 #endif
279 #endif
280 #ifdef MBEDTLS_RIPEMD160_C
281 #define ARCH_TEST_RIPEMD160
282 #endif
283 #ifdef MBEDTLS_SHA1_C
284 #define ARCH_TEST_SHA1
285 #endif
286 #ifdef MBEDTLS_SHA224_C
287 #define ARCH_TEST_SHA224
288 #endif
289 #ifdef MBEDTLS_SHA256_C
290 #define ARCH_TEST_SHA256
291 #endif
292 #ifdef MBEDTLS_SHA384_C
293 #define ARCH_TEST_SHA384
294 #endif
295 #ifdef MBEDTLS_SHA512_C
296 #define ARCH_TEST_SHA512
297 #ifdef MBEDTLS_SHA512_224_C
298 #define ARCH_TEST_SHA512_224
299 #endif
300 #ifdef MBEDTLS_SHA512_256_C
301 #define ARCH_TEST_SHA512_256
302 #endif
303 #endif
304 #ifdef MBEDTLS_SHA3_C
305 #define ARCH_TEST_SHA3_224
306 #define ARCH_TEST_SHA3_256
307 #define ARCH_TEST_SHA3_384
308 #define ARCH_TEST_SHA3_512
309 #endif
310 
311 /**
312  * \def ARCH_TEST_HKDF
313  *
314  * Enable the HKDF algorithm (RFC 5869).
315  *
316  * Requires: ARCH_TEST_HASH
317 */
318 #ifdef MBEDTLS_HKDF_C
319 #define ARCH_TEST_HKDF
320 #endif
321 
322 /**
323  * \def ARCH_TEST_xMAC
324  *
325  * Enable the xMAC (Cipher/Hash/G-based Message Authentication Code) mode for block
326  * ciphers.
327  * Requires: ARCH_TEST_AES or ARCH_TEST_DES
328  *
329  * Comment macros to disable the types
330  */
331 #ifdef MBEDTLS_CMAC_C
332 #define ARCH_TEST_CMAC
333 #endif
334 #ifdef MBEDTLS_GMAC_C
335 #define ARCH_TEST_GMAC
336 #endif
337 #define ARCH_TEST_HMAC
338 
339 
340 /**
341  * \def ARCH_TEST_CCM
342  *
343  * Enable the Counter with CBC-MAC (CCM) mode for 128-bit block cipher.
344  *
345  * Requires: ARCH_TEST_AES
346  */
347 #ifdef MBEDTLS_CCM_C
348 #define ARCH_TEST_CCM
349 #endif
350 
351 /**
352  * \def ARCH_TEST_GCM
353  *
354  * Enable the Galois/Counter Mode (GCM) for AES.
355  *
356  * Requires: ARCH_TEST_AES
357  *
358  */
359 #ifdef MBEDTLS_GCM_C
360 #define ARCH_TEST_GCM
361 #endif
362 
363 /**
364  * \def ARCH_TEST_TRUNCATED_MAC
365  *
366  * Enable support for RFC 6066 truncated HMAC in SSL.
367  *
368  * Comment this macro to disable support for truncated HMAC in SSL
369  */
370 #ifdef MBEDTLS_SSL_TRUNCATED_HMAC
371 #define ARCH_TEST_TRUNCATED_MAC
372 #endif
373 
374 
375 /**
376  * \def ARCH_TEST_ECDH
377  *
378  * Enable the elliptic curve Diffie-Hellman library.
379  *
380  * Requires: ARCH_TEST_ECC
381  */
382 #ifdef MBEDTLS_ECDH_C
383 #define ARCH_TEST_ECDH
384 #endif
385 
386 /**
387  * \def ARCH_TEST_ECDSA
388  *
389  * Enable the elliptic curve DSA library.
390  * Requires: ARCH_TEST_ECC
391  */
392 #ifdef MBEDTLS_ECDSA_C
393 #define ARCH_TEST_ECDSA
394 #endif
395 
396 /**
397  * \def ARCH_TEST_DETERMINISTIC_ECDSA
398  *
399  * Enable deterministic ECDSA (RFC 6979).
400 */
401 #ifdef MBEDTLS_ECDSA_DETERMINISTIC
402 #define ARCH_TEST_DETERMINISTIC_ECDSA
403 #endif
404 
405 #include "pal_crypto_config_check.h"
406 
407 #endif
Copyright (c) 2019, Arm Limited or its affiliates.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.