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