xref: /optee_os/lib/libmbedtls/include/mbedtls_config_kernel.h (revision 7fb525f1f8a6709ba8adc89b1d2f2995dae26803)
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 #endif
46 
47 #if defined(CFG_CRYPTO_DES)
48 #define MBEDTLS_DES_C
49 #endif
50 
51 #if defined(CFG_CRYPTO_CBC)
52 #define MBEDTLS_CIPHER_MODE_CBC
53 #endif
54 
55 #if defined(CFG_CRYPTO_CTR)
56 #define MBEDTLS_CIPHER_MODE_CTR
57 #endif
58 
59 #if defined(CFG_CRYPTO_CMAC)
60 #define MBEDTLS_CMAC_C
61 #define MBEDTLS_CIPHER_C
62 #endif
63 
64 #if defined(CFG_CRYPTO_RSA) || defined(CFG_CRYPTO_DH) || defined(CFG_CRYPTO_ECC)
65 #define MBEDTLS_BIGNUM_C
66 #define MBEDTLS_OID_C
67 #define MBEDTLS_PKCS1_V15
68 #define MBEDTLS_PKCS1_V21
69 #define MBEDTLS_PK_C
70 #define MBEDTLS_GENPRIME
71 #define MBEDTLS_CTR_DRBG_C
72 #endif
73 
74 #if defined(CFG_CRYPTO_RSA)
75 #define MBEDTLS_RSA_C
76 #define MBEDTLS_RSA_NO_CRT
77 #endif
78 
79 #if defined(CFG_CRYPTO_RSA) || defined(CFG_CRYPTO_ECC)
80 #define MBEDTLS_ASN1_PARSE_C
81 #define MBEDTLS_ASN1_WRITE_C
82 #endif
83 
84 #if defined(CFG_CRYPTO_DH)
85 #define MBEDTLS_DHM_C
86 #endif
87 
88 #if defined(CFG_CRYPTO_ECC)
89 #define MBEDTLS_ECP_DP_SECP192R1_ENABLED
90 #define MBEDTLS_ECP_DP_SECP224R1_ENABLED
91 #define MBEDTLS_ECP_DP_SECP256R1_ENABLED
92 #define MBEDTLS_ECP_DP_SECP384R1_ENABLED
93 #define MBEDTLS_ECP_DP_SECP521R1_ENABLED
94 #define MBEDTLS_ECP_DP_SECP192K1_ENABLED
95 #define MBEDTLS_ECP_DP_SECP224K1_ENABLED
96 #define MBEDTLS_ECP_DP_SECP256K1_ENABLED
97 #define MBEDTLS_ECP_DP_BP256R1_ENABLED
98 #define MBEDTLS_ECP_DP_BP384R1_ENABLED
99 #define MBEDTLS_ECP_DP_BP512R1_ENABLED
100 #define MBEDTLS_ECP_DP_CURVE25519_ENABLED
101 #define MBEDTLS_ECP_C
102 #define MBEDTLS_ECDSA_C
103 #define MBEDTLS_ECDH_C
104 #endif
105 
106 #endif /*CFG_CRYPTOLIB_NAME_mbedtls*/
107 
108 #include <mbedtls/check_config.h>
109 
110 #endif /* __MBEDTLS_CONFIG_KERNEL_H */
111