xref: /optee_os/lib/libmbedtls/include/mbedtls_config_kernel.h (revision 734545da1c03116be01161caeb9e8446445aca10)
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 #if defined(CFG_CORE_CRYPTO_SHA1_ACCEL)
27 #define MBEDTLS_SHA1_PROCESS_ALT
28 #endif
29 #endif
30 
31 #if defined(CFG_CRYPTO_SHA224) || defined(CFG_CRYPTO_SHA256)
32 #define MBEDTLS_SHA256_C
33 #define MBEDTLS_MD_C
34 #endif
35 
36 #if defined(CFG_CRYPTO_SHA384) || defined(CFG_CRYPTO_SHA512)
37 #define MBEDTLS_SHA512_C
38 #define MBEDTLS_MD_C
39 #endif
40 
41 #if defined(CFG_CRYPTO_HMAC)
42 #define MBEDTLS_MD_C
43 #endif
44 
45 #if defined(CFG_CRYPTO_AES)
46 #define MBEDTLS_AES_C
47 #define MBEDTLS_AES_ROM_TABLES
48 #if defined(CFG_CORE_CRYPTO_AES_ACCEL)
49 #define MBEDTLS_AES_ALT
50 #endif
51 #endif
52 
53 #if defined(CFG_CRYPTO_DES)
54 #define MBEDTLS_DES_C
55 #endif
56 
57 #if defined(CFG_CRYPTO_CBC)
58 #define MBEDTLS_CIPHER_MODE_CBC
59 #endif
60 
61 #if defined(CFG_CRYPTO_CTR)
62 #define MBEDTLS_CIPHER_MODE_CTR
63 #endif
64 
65 #if defined(CFG_CRYPTO_CMAC)
66 #define MBEDTLS_CMAC_C
67 #define MBEDTLS_CIPHER_C
68 #endif
69 
70 #if defined(CFG_CRYPTO_RSA) || defined(CFG_CRYPTO_DH) || defined(CFG_CRYPTO_ECC)
71 #define MBEDTLS_BIGNUM_C
72 #define MBEDTLS_OID_C
73 #define MBEDTLS_PKCS1_V15
74 #define MBEDTLS_PKCS1_V21
75 #define MBEDTLS_PK_C
76 #define MBEDTLS_GENPRIME
77 #define MBEDTLS_CTR_DRBG_C
78 #endif
79 
80 #if defined(CFG_CRYPTO_RSA)
81 #define MBEDTLS_RSA_C
82 #define MBEDTLS_RSA_NO_CRT
83 #endif
84 
85 #if defined(CFG_CRYPTO_RSA) || defined(CFG_CRYPTO_ECC)
86 #define MBEDTLS_ASN1_PARSE_C
87 #define MBEDTLS_ASN1_WRITE_C
88 #endif
89 
90 #if defined(CFG_CRYPTO_DH)
91 #define MBEDTLS_DHM_C
92 #endif
93 
94 #if defined(CFG_CRYPTO_ECC)
95 #define MBEDTLS_ECP_DP_SECP192R1_ENABLED
96 #define MBEDTLS_ECP_DP_SECP224R1_ENABLED
97 #define MBEDTLS_ECP_DP_SECP256R1_ENABLED
98 #define MBEDTLS_ECP_DP_SECP384R1_ENABLED
99 #define MBEDTLS_ECP_DP_SECP521R1_ENABLED
100 #define MBEDTLS_ECP_DP_SECP192K1_ENABLED
101 #define MBEDTLS_ECP_DP_SECP224K1_ENABLED
102 #define MBEDTLS_ECP_DP_SECP256K1_ENABLED
103 #define MBEDTLS_ECP_DP_BP256R1_ENABLED
104 #define MBEDTLS_ECP_DP_BP384R1_ENABLED
105 #define MBEDTLS_ECP_DP_BP512R1_ENABLED
106 #define MBEDTLS_ECP_DP_CURVE25519_ENABLED
107 #define MBEDTLS_ECP_C
108 #define MBEDTLS_ECDSA_C
109 #define MBEDTLS_ECDH_C
110 #endif
111 
112 #endif /*CFG_CRYPTOLIB_NAME_mbedtls*/
113 
114 #include <mbedtls/check_config.h>
115 
116 #endif /* __MBEDTLS_CONFIG_KERNEL_H */
117