xref: /optee_os/lib/libmbedtls/include/mbedtls_config_kernel.h (revision 10b907910d58334cc5b1486cb2f91a08f764566e)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /* Copyright (c) 2018, Linaro Limited */
3 #ifndef __MBEDTLS_CONFIG_KERNEL_H
4 #define __MBEDTLS_CONFIG_KERNEL_H
5 
6 #ifdef ARM32
7 #define MBEDTLS_HAVE_INT32
8 #endif
9 #ifdef ARM64
10 #define MBEDTLS_HAVE_INT64
11 #endif
12 #define MBEDTLS_BIGNUM_C
13 #define MBEDTLS_GENPRIME
14 
15 /* Test if Mbedtls is the primary crypto lib */
16 #ifdef CFG_CRYPTOLIB_NAME_mbedtls
17 
18 #if defined(CFG_CRYPTO_MD5)
19 #define MBEDTLS_MD5_C
20 #define MBEDTLS_MD_C
21 #endif
22 
23 #if defined(CFG_CRYPTO_SHA1)
24 #define MBEDTLS_SHA1_C
25 #define MBEDTLS_MD_C
26 #endif
27 
28 #if defined(CFG_CRYPTO_SHA224) || defined(CFG_CRYPTO_SHA256)
29 #define MBEDTLS_SHA256_C
30 #define MBEDTLS_MD_C
31 #endif
32 
33 #if defined(CFG_CRYPTO_SHA384) || defined(CFG_CRYPTO_SHA512)
34 #define MBEDTLS_SHA512_C
35 #define MBEDTLS_MD_C
36 #endif
37 
38 #if defined(CFG_CRYPTO_HMAC)
39 #define MBEDTLS_MD_C
40 #endif
41 
42 #if defined(CFG_CRYPTO_AES)
43 #define MBEDTLS_AES_C
44 #define MBEDTLS_AES_ROM_TABLES
45 #if defined(CFG_CORE_CRYPTO_AES_ACCEL)
46 #define MBEDTLS_AES_ALT
47 #endif
48 #endif
49 
50 #if defined(CFG_CRYPTO_DES)
51 #define MBEDTLS_DES_C
52 #endif
53 
54 #if defined(CFG_CRYPTO_CBC)
55 #define MBEDTLS_CIPHER_MODE_CBC
56 #endif
57 
58 #if defined(CFG_CRYPTO_CTR)
59 #define MBEDTLS_CIPHER_MODE_CTR
60 #endif
61 
62 #if defined(CFG_CRYPTO_CMAC)
63 #define MBEDTLS_CMAC_C
64 #define MBEDTLS_CIPHER_C
65 #endif
66 
67 #if defined(CFG_CRYPTO_RSA) || defined(CFG_CRYPTO_DH) || defined(CFG_CRYPTO_ECC)
68 #define MBEDTLS_BIGNUM_C
69 #define MBEDTLS_OID_C
70 #define MBEDTLS_PKCS1_V15
71 #define MBEDTLS_PKCS1_V21
72 #define MBEDTLS_PK_C
73 #define MBEDTLS_GENPRIME
74 #define MBEDTLS_CTR_DRBG_C
75 #endif
76 
77 #if defined(CFG_CRYPTO_RSA)
78 #define MBEDTLS_RSA_C
79 #define MBEDTLS_RSA_NO_CRT
80 #endif
81 
82 #if defined(CFG_CRYPTO_RSA) || defined(CFG_CRYPTO_ECC)
83 #define MBEDTLS_ASN1_PARSE_C
84 #define MBEDTLS_ASN1_WRITE_C
85 #endif
86 
87 #if defined(CFG_CRYPTO_DH)
88 #define MBEDTLS_DHM_C
89 #endif
90 
91 #if defined(CFG_CRYPTO_ECC)
92 #define MBEDTLS_ECP_DP_SECP192R1_ENABLED
93 #define MBEDTLS_ECP_DP_SECP224R1_ENABLED
94 #define MBEDTLS_ECP_DP_SECP256R1_ENABLED
95 #define MBEDTLS_ECP_DP_SECP384R1_ENABLED
96 #define MBEDTLS_ECP_DP_SECP521R1_ENABLED
97 #define MBEDTLS_ECP_DP_SECP192K1_ENABLED
98 #define MBEDTLS_ECP_DP_SECP224K1_ENABLED
99 #define MBEDTLS_ECP_DP_SECP256K1_ENABLED
100 #define MBEDTLS_ECP_DP_BP256R1_ENABLED
101 #define MBEDTLS_ECP_DP_BP384R1_ENABLED
102 #define MBEDTLS_ECP_DP_BP512R1_ENABLED
103 #define MBEDTLS_ECP_DP_CURVE25519_ENABLED
104 #define MBEDTLS_ECP_C
105 #define MBEDTLS_ECDSA_C
106 #define MBEDTLS_ECDH_C
107 #endif
108 
109 #endif /*CFG_CRYPTOLIB_NAME_mbedtls*/
110 
111 #include <mbedtls/check_config.h>
112 
113 #endif /* __MBEDTLS_CONFIG_KERNEL_H */
114