blob: d27f017d084755fa11761725b517fd86acfe7d07 [file] [log] [blame]
Raymond Mao13de8482024-10-03 14:50:15 -07001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * MbedTLS config file
4 *
5 * Derived from the MbedTLS internal config file,
6 * for more information about each build option,
7 * please refer to:
8 * external/mbedtls/include/mbedtls/mbedtls_config.h
9 *
10 * Copyright (c) 2024 Linaro Limited
11 * Author: Raymond Mao <raymond.mao@linaro.org>
12 */
13
14#if defined CONFIG_MBEDTLS_LIB
15
16#if CONFIG_IS_ENABLED(MD5)
17#define MBEDTLS_MD_C
18#define MBEDTLS_MD5_C
19#if defined CONFIG_MBEDTLS_LIB_CRYPTO_ALT
20#define MBEDTLS_MD5_ALT
21#endif
22#endif
23
24#if CONFIG_IS_ENABLED(SHA1)
25#define MBEDTLS_MD_C
26#define MBEDTLS_SHA1_C
27#if defined CONFIG_MBEDTLS_LIB_CRYPTO_ALT
28#define MBEDTLS_SHA1_ALT
29#endif
30#endif
31
32#if CONFIG_IS_ENABLED(SHA256)
33#define MBEDTLS_MD_C
34#define MBEDTLS_SHA256_C
35#if defined CONFIG_MBEDTLS_LIB_CRYPTO_ALT
36#define MBEDTLS_SHA256_ALT
37#endif
Raymond Maoc60e99f2024-10-03 14:50:20 -070038#if CONFIG_IS_ENABLED(SHA256_SMALLER)
39#define MBEDTLS_SHA256_SMALLER
40#endif
Raymond Mao13de8482024-10-03 14:50:15 -070041#endif
42
43#if CONFIG_IS_ENABLED(SHA384)
44#define MBEDTLS_MD_C
45#define MBEDTLS_SHA384_C
46#endif
47
48#if CONFIG_IS_ENABLED(SHA512)
49#define MBEDTLS_MD_C
50#define MBEDTLS_SHA512_C
51#if defined CONFIG_MBEDTLS_LIB_CRYPTO_ALT
52#define MBEDTLS_SHA512_ALT
53#endif
Raymond Maoc60e99f2024-10-03 14:50:20 -070054#if CONFIG_IS_ENABLED(SHA512_SMALLER)
55#define MBEDTLS_SHA512_SMALLER
56#endif
Raymond Mao13de8482024-10-03 14:50:15 -070057#endif
58
59#if defined CONFIG_MBEDTLS_LIB_X509
60
61#if CONFIG_IS_ENABLED(X509_CERTIFICATE_PARSER)
62#define MBEDTLS_X509_USE_C
63#define MBEDTLS_X509_CRT_PARSE_C
64#define MBEDTLS_X509_CRL_PARSE_C
65#endif
66
67#if CONFIG_IS_ENABLED(ASYMMETRIC_PUBLIC_KEY_SUBTYPE)
68#define MBEDTLS_PK_C
69#define MBEDTLS_PK_PARSE_C
70#endif
71
72#if CONFIG_IS_ENABLED(RSA_PUBLIC_KEY_PARSER)
73#define MBEDTLS_BIGNUM_C
74#define MBEDTLS_RSA_C
75#define MBEDTLS_PKCS1_V15
76#endif
77
78#if CONFIG_IS_ENABLED(PKCS7_MESSAGE_PARSER)
79#define MBEDTLS_PKCS7_C
80#endif
81
82#if CONFIG_IS_ENABLED(ASN1_DECODER)
83#define MBEDTLS_OID_C
84#define MBEDTLS_ASN1_PARSE_C
85#define MBEDTLS_ASN1_WRITE_C
86#endif
87
88#endif /* #if defined CONFIG_MBEDTLS_LIB_X509 */
89
Ilias Apalodimasa564f502024-11-10 10:28:37 +020090#if IS_ENABLED(CONFIG_MBEDTLS_LIB_TLS)
91#include "rtc.h"
92
93/* Generic options */
94#define MBEDTLS_ENTROPY_HARDWARE_ALT
95#define MBEDTLS_HAVE_TIME
96#define MBEDTLS_PLATFORM_MS_TIME_ALT
97#define MBEDTLS_PLATFORM_TIME_MACRO rtc_mktime
98#define MBEDTLS_PLATFORM_C
99#define MBEDTLS_SSL_CLI_C
100#define MBEDTLS_SSL_TLS_C
101#define MBEDTLS_CIPHER_C
102#define MBEDTLS_MD_C
103#define MBEDTLS_CTR_DRBG_C
104#define MBEDTLS_AES_C
105#define MBEDTLS_ENTROPY_C
106#define MBEDTLS_NO_PLATFORM_ENTROPY
107#define MBEDTLS_SSL_PROTO_TLS1_2
108#define MBEDTLS_SSL_SERVER_NAME_INDICATION
109#define MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
110
111/* RSA */
112#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
113#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
114#define MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
115#define MBEDTLS_GCM_C
116
117/* ECDSA */
118#define MBEDTLS_ECDSA_C
119#define MBEDTLS_ECDH_C
120#define MBEDTLS_ECDSA_DETERMINISTIC
121#define MBEDTLS_HMAC_DRBG_C
122#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
123#define MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
124#define MBEDTLS_CAN_ECDH
125#define MBEDTLS_PK_CAN_ECDSA_SIGN
126#define MBEDTLS_ECP_C
127#define MBEDTLS_ECP_DP_SECP256K1_ENABLED
128#define MBEDTLS_ECP_DP_SECP192R1_ENABLED
129#define MBEDTLS_ECP_DP_SECP224R1_ENABLED
130#define MBEDTLS_ECP_DP_SECP256R1_ENABLED
131#define MBEDTLS_ECP_DP_SECP384R1_ENABLED
132#define MBEDTLS_ECP_DP_SECP521R1_ENABLED
133#define MBEDTLS_ECP_DP_SECP192K1_ENABLED
134#define MBEDTLS_ECP_DP_SECP224K1_ENABLED
135#define MBEDTLS_ECP_DP_SECP256K1_ENABLED
136#define MBEDTLS_ECP_DP_BP256R1_ENABLED
137#define MBEDTLS_ECP_DP_BP384R1_ENABLED
138#define MBEDTLS_ECP_DP_BP512R1_ENABLED
139
140#endif /* #if defined CONFIG_MBEDTLS_LIB_TLS */
141
Raymond Mao13de8482024-10-03 14:50:15 -0700142#endif /* #if defined CONFIG_MBEDTLS_LIB */