blob: 828c0f38dcea7035342aabc6b9f17ca2506bfa8a [file] [log] [blame]
Paul Bakker5121ce52009-01-03 21:22:43 +00001/**
Bence Szépkútibb0cfeb2021-05-28 09:42:25 +02002 * \file mbedtls_config.h
Paul Bakker5121ce52009-01-03 21:22:43 +00003 *
Paul Bakker37ca75d2011-01-06 12:28:03 +00004 * \brief Configuration options (set of defines)
5 *
Simon Butcher5b331b92016-01-03 16:14:14 +00006 * This set of compile-time options may be used to enable
7 * or disable features selectively, and reduce the global
8 * memory footprint.
Darryl Greena40a1012018-01-05 15:33:17 +00009 */
10/*
Bence Szépkúti1e148272020-08-07 13:07:28 +020011 * Copyright The Mbed TLS Contributors
Dave Rodgman16799db2023-11-02 19:47:20 +000012 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
Manuel Pégourié-Gonnarde2b0efe2015-08-11 10:38:37 +020013 */
14
Bence Szépkúti2bb74562021-06-21 16:19:00 +020015/**
Tom Cosgrove1e211442022-05-26 11:51:00 +010016 * This is an optional version symbol that enables compatibility handling of
Bence Szépkúti2bb74562021-06-21 16:19:00 +020017 * config files.
18 *
Bence Szépkúti1b2a8832021-06-28 10:26:11 +010019 * It is equal to the #MBEDTLS_VERSION_NUMBER of the Mbed TLS version that
Bence Szépkúti2bb74562021-06-21 16:19:00 +020020 * introduced the config format we want to be compatible with.
21 */
Bence Szépkúti1cafe5c2021-06-22 09:30:08 +020022//#define MBEDTLS_CONFIG_VERSION 0x03000000
Bence Szépkútiba7248a2021-05-31 16:53:56 +020023
Paul Bakkerf3b86c12011-01-27 15:24:17 +000024/**
Minos Galanakisacd560f2024-12-12 15:30:05 +000025 * \name SECTION: Platform abstraction layer
26 *
27 * This section sets platform specific settings.
28 * \{
29 */
30
Minos Galanakisacd560f2024-12-12 15:30:05 +000031/**
Minos Galanakis80e76b62024-12-12 15:46:29 +000032 * \def MBEDTLS_NET_C
Minos Galanakisacd560f2024-12-12 15:30:05 +000033 *
Minos Galanakis80e76b62024-12-12 15:46:29 +000034 * Enable the TCP and UDP over IPv6/IPv4 networking routines.
Minos Galanakisacd560f2024-12-12 15:30:05 +000035 *
Minos Galanakis80e76b62024-12-12 15:46:29 +000036 * \note This module only works on POSIX/Unix (including Linux, BSD and OS X)
37 * and Windows. For other platforms, you'll want to disable it, and write your
38 * own networking callbacks to be passed to \c mbedtls_ssl_set_bio().
Minos Galanakisacd560f2024-12-12 15:30:05 +000039 *
Minos Galanakis80e76b62024-12-12 15:46:29 +000040 * \note See also our Knowledge Base article about porting to a new
41 * environment:
42 * https://mbed-tls.readthedocs.io/en/latest/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS
Paul Bakker0a62cd12011-01-21 11:00:08 +000043 *
Minos Galanakis80e76b62024-12-12 15:46:29 +000044 * Module: library/net_sockets.c
45 *
46 * This module provides networking routines.
Paul Bakker0a62cd12011-01-21 11:00:08 +000047 */
Minos Galanakis80e76b62024-12-12 15:46:29 +000048#define MBEDTLS_NET_C
Paul Bakker5121ce52009-01-03 21:22:43 +000049
Paul Bakkerf3b86c12011-01-27 15:24:17 +000050/**
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020051 * \def MBEDTLS_TIMING_ALT
Paul Bakkerf2561b32014-02-06 15:11:55 +010052 *
TRodziewiczd8540832021-06-10 15:16:50 +020053 * Uncomment to provide your own alternate implementation for
Manuel Pégourié-Gonnarda63bc942015-05-14 18:22:47 +020054 * mbedtls_timing_get_timer(), mbedtls_set_alarm(), mbedtls_set/get_delay()
Paul Bakkerf2561b32014-02-06 15:11:55 +010055 *
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020056 * Only works if you have MBEDTLS_TIMING_C enabled.
Paul Bakkerf2561b32014-02-06 15:11:55 +010057 *
58 * You will need to provide a header "timing_alt.h" and an implementation at
59 * compile time.
60 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +020061//#define MBEDTLS_TIMING_ALT
Paul Bakkerf2561b32014-02-06 15:11:55 +010062
Paul Bakker90995b52013-06-24 19:20:35 +020063/**
Minos Galanakis80e76b62024-12-12 15:46:29 +000064 * \def MBEDTLS_TIMING_C
Paul Bakkerd4a56ec2013-04-16 18:05:29 +020065 *
Minos Galanakis80e76b62024-12-12 15:46:29 +000066 * Enable the semi-portable timing interface.
Paul Bakkerd4a56ec2013-04-16 18:05:29 +020067 *
Minos Galanakis80e76b62024-12-12 15:46:29 +000068 * \note The provided implementation only works on POSIX/Unix (including Linux,
69 * BSD and OS X) and Windows. On other platforms, you can either disable that
70 * module and provide your own implementations of the callbacks needed by
71 * \c mbedtls_ssl_set_timer_cb() for DTLS, or leave it enabled and provide
72 * your own implementation of the whole module by setting
73 * \c MBEDTLS_TIMING_ALT in the current file.
74 *
75 * \note The timing module will include time.h on suitable platforms
76 * regardless of the setting of MBEDTLS_HAVE_TIME, unless
77 * MBEDTLS_TIMING_ALT is used. See timing.c for more information.
78 *
79 * \note See also our Knowledge Base article about porting to a new
80 * environment:
81 * https://mbed-tls.readthedocs.io/en/latest/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS
82 *
83 * Module: library/timing.c
Paul Bakkerd4a56ec2013-04-16 18:05:29 +020084 */
Minos Galanakis80e76b62024-12-12 15:46:29 +000085#define MBEDTLS_TIMING_C
86
87/** \} name SECTION: Platform abstraction layer */
88
89/**
90 * \name SECTION: General configuration options
91 *
Minos Galanakis1bf85a82024-12-12 16:29:38 +000092 * This section contains Mbed TLS build settings that are not associated
93 * with a particular module.
Minos Galanakis80e76b62024-12-12 15:46:29 +000094 * \{
95 */
96
97/**
98 * \def MBEDTLS_ERROR_C
99 *
100 * Enable error code to error string conversion.
101 *
102 * Module: library/error.c
103 * Caller:
104 *
105 * This module enables mbedtls_strerror().
106 */
107#define MBEDTLS_ERROR_C
108
109/**
110 * \def MBEDTLS_ERROR_STRERROR_DUMMY
111 *
112 * Enable a dummy error function to make use of mbedtls_strerror() in
113 * third party libraries easier when MBEDTLS_ERROR_C is disabled
114 * (no effect when MBEDTLS_ERROR_C is enabled).
115 *
116 * You can safely disable this if MBEDTLS_ERROR_C is enabled, or if you're
117 * not using mbedtls_strerror() or error_strerror() in your application.
118 *
119 * Disable if you run into name conflicts and want to really remove the
120 * mbedtls_strerror()
121 */
122#define MBEDTLS_ERROR_STRERROR_DUMMY
123
124/**
125 * \def MBEDTLS_VERSION_C
126 *
127 * Enable run-time version information.
128 *
129 * Module: library/version.c
130 *
131 * This module provides run-time version information.
132 */
133#define MBEDTLS_VERSION_C
134
135/**
136 * \def MBEDTLS_VERSION_FEATURES
137 *
138 * Allow run-time checking of compile-time enabled features. Thus allowing users
139 * to check at run-time if the library is for instance compiled with threading
140 * support via mbedtls_version_check_feature().
141 *
142 * Requires: MBEDTLS_VERSION_C
143 *
144 * Comment this to disable run-time checking and save ROM space
145 */
146#define MBEDTLS_VERSION_FEATURES
147
148/**
149 * \def MBEDTLS_CONFIG_FILE
150 *
151 * If defined, this is a header which will be included instead of
152 * `"mbedtls/mbedtls_config.h"`.
153 * This header file specifies the compile-time configuration of Mbed TLS.
154 * Unlike other configuration options, this one must be defined on the
155 * compiler command line: a definition in `mbedtls_config.h` would have
156 * no effect.
157 *
158 * This macro is expanded after an <tt>\#include</tt> directive. This is a popular but
159 * non-standard feature of the C language, so this feature is only available
160 * with compilers that perform macro expansion on an <tt>\#include</tt> line.
161 *
162 * The value of this symbol is typically a path in double quotes, either
163 * absolute or relative to a directory on the include search path.
164 */
165//#define MBEDTLS_CONFIG_FILE "mbedtls/mbedtls_config.h"
166
167/**
168 * \def MBEDTLS_USER_CONFIG_FILE
169 *
170 * If defined, this is a header which will be included after
171 * `"mbedtls/mbedtls_config.h"` or #MBEDTLS_CONFIG_FILE.
172 * This allows you to modify the default configuration, including the ability
173 * to undefine options that are enabled by default.
174 *
175 * This macro is expanded after an <tt>\#include</tt> directive. This is a popular but
176 * non-standard feature of the C language, so this feature is only available
177 * with compilers that perform macro expansion on an <tt>\#include</tt> line.
178 *
179 * The value of this symbol is typically a path in double quotes, either
180 * absolute or relative to a directory on the include search path.
181 */
182//#define MBEDTLS_USER_CONFIG_FILE "/dev/null"
183
184/** \} name SECTION: General configuration options */
185
186/**
187 * \name SECTION: TLS feature selection
188 *
Minos Galanakis1bf85a82024-12-12 16:29:38 +0000189 * This section sets support for features that are or are not needed
190 * within the modules that are enabled.
Minos Galanakis80e76b62024-12-12 15:46:29 +0000191 * \{
192 */
193
194/**
Ronald Cron0dd31fe2025-09-10 09:37:46 +0200195 * \def MBEDTLS_SSL_NULL_CIPHERSUITES
196 *
197 * Enable ciphersuites without encryption.
198 *
199 * Warning: Only do so when you know what you are doing. This allows for
200 * channels without any encryption. All data are transmitted in clear.
201 *
202 * Uncomment this macro to enable the NULL ciphersuites
203 */
204//#define MBEDTLS_SSL_NULL_CIPHERSUITES
205
206/**
Minos Galanakis80e76b62024-12-12 15:46:29 +0000207 * \def MBEDTLS_DEBUG_C
208 *
209 * Enable the debug functions.
210 *
211 * Module: library/debug.c
212 * Caller: library/ssl_msg.c
213 * library/ssl_tls.c
214 * library/ssl_tls12_*.c
215 * library/ssl_tls13_*.c
216 *
217 * This module provides debugging functions.
218 */
219#define MBEDTLS_DEBUG_C
Paul Bakkerd4a56ec2013-04-16 18:05:29 +0200220
221/**
Minos Galanakis80e76b62024-12-12 15:46:29 +0000222 * \def MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
223 *
224 * Enable the ECDHE-ECDSA based ciphersuite modes in SSL / TLS.
225 *
Ronald Crona19ee282025-09-15 18:25:06 +0200226 * Requires: PSA_WANT_ALG_ECDH
Ronald Cron3c6bbdd2025-09-15 18:28:06 +0200227 * PSA_WANT_ALG_ECDSA
Minos Galanakis80e76b62024-12-12 15:46:29 +0000228 * MBEDTLS_X509_CRT_PARSE_C
229 *
230 * This enables the following ciphersuites (if other requisites are
231 * enabled as well):
232 * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
233 * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
234 * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
235 * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
236 * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384
237 * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
238 * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
239 * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
240 * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
241 * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256
242 */
243#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
244
245/**
246 * \def MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
247 *
248 * Enable the ECDHE-PSK based ciphersuite modes in SSL / TLS.
249 *
Ronald Crona19ee282025-09-15 18:25:06 +0200250 * Requires: PSA_WANT_ALG_ECDH
Minos Galanakis80e76b62024-12-12 15:46:29 +0000251 *
252 * This enables the following ciphersuites (if other requisites are
253 * enabled as well):
254 * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384
255 * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA
256 * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384
257 * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256
258 * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA
259 * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256
260 */
261#define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
262
263/**
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200264 * \def MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
Paul Bakkere07f41d2013-04-19 09:08:57 +0200265 *
Manuel Pégourié-Gonnard09fff7e2013-09-20 13:45:36 +0200266 * Enable the ECDHE-RSA based ciphersuite modes in SSL / TLS.
Paul Bakkere07f41d2013-04-19 09:08:57 +0200267 *
Ronald Crona19ee282025-09-15 18:25:06 +0200268 * Requires: PSA_WANT_ALG_ECDH
Ronald Cron5eb9aba2025-07-22 10:58:44 +0200269 * PSA_WANT_ALG_RSA_PKCS1V15_SIGN
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200270 * MBEDTLS_X509_CRT_PARSE_C
Paul Bakkere07f41d2013-04-19 09:08:57 +0200271 *
272 * This enables the following ciphersuites (if other requisites are
273 * enabled as well):
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200274 * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
275 * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
276 * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
277 * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384
278 * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384
279 * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
280 * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
281 * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
282 * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256
283 * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256
Paul Bakkere07f41d2013-04-19 09:08:57 +0200284 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200285#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
Paul Bakkere07f41d2013-04-19 09:08:57 +0200286
287/**
Manuel Pégourié-Gonnard557535d2015-09-15 17:53:32 +0200288 * \def MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
289 *
290 * Enable the ECJPAKE based ciphersuite modes in SSL / TLS.
291 *
Manuel Pégourié-Gonnard75df9022015-09-16 23:21:01 +0200292 * \warning This is currently experimental. EC J-PAKE support is based on the
293 * Thread v1.0.0 specification; incompatible changes to the specification
294 * might still happen. For this reason, this is disabled by default.
Manuel Pégourié-Gonnard557535d2015-09-15 17:53:32 +0200295 *
Ronald Cron2ad1e5c2025-09-15 18:30:07 +0200296 * Requires: PSA_WANT_ALG_JPAKE
Ronald Cron5eb9aba2025-07-22 10:58:44 +0200297 * PSA_WANT_ALG_SHA_256
Manuel Pégourié-Gonnard557535d2015-09-15 17:53:32 +0200298 * MBEDTLS_ECP_DP_SECP256R1_ENABLED
299 *
300 * This enables the following ciphersuites (if other requisites are
301 * enabled as well):
302 * MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8
303 */
Manuel Pégourié-Gonnardcf828932015-10-20 14:57:00 +0200304//#define MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
Manuel Pégourié-Gonnard557535d2015-09-15 17:53:32 +0200305
306/**
Minos Galanakis80e76b62024-12-12 15:46:29 +0000307 * \def MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
Paul Bakker8fe40dc2013-02-02 12:43:08 +0100308 *
Minos Galanakis80e76b62024-12-12 15:46:29 +0000309 * Enable the PSK based ciphersuite modes in SSL / TLS.
Manuel Pégourié-Gonnarddc16aa72014-06-25 12:55:12 +0200310 *
Minos Galanakis80e76b62024-12-12 15:46:29 +0000311 * This enables the following ciphersuites (if other requisites are
312 * enabled as well):
313 * MBEDTLS_TLS_PSK_WITH_AES_256_GCM_SHA384
314 * MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA384
315 * MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA
316 * MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384
317 * MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384
318 * MBEDTLS_TLS_PSK_WITH_AES_128_GCM_SHA256
319 * MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA256
320 * MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA
321 * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256
322 * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256
Paul Bakker8fe40dc2013-02-02 12:43:08 +0100323 */
Minos Galanakis80e76b62024-12-12 15:46:29 +0000324#define MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
325
326/**
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200327 * \def MBEDTLS_SSL_ALL_ALERT_MESSAGES
Paul Bakker40865c82013-01-31 17:13:13 +0100328 *
329 * Enable sending of alert messages in case of encountered errors as per RFC.
Gilles Peskinee820c0a2023-08-03 17:45:20 +0200330 * If you choose not to send the alert messages, Mbed TLS can still communicate
Paul Bakker40865c82013-01-31 17:13:13 +0100331 * with other servers, only debugging of failures is harder.
332 *
333 * The advantage of not sending alert messages, is that no information is given
334 * about reasons for failures thus preventing adversaries of gaining intel.
335 *
336 * Enable sending of all alert messages
337 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200338#define MBEDTLS_SSL_ALL_ALERT_MESSAGES
Paul Bakker40865c82013-01-31 17:13:13 +0100339
340/**
Minos Galanakis80e76b62024-12-12 15:46:29 +0000341 * \def MBEDTLS_SSL_ALPN
Gilles Peskined3d02902020-03-04 21:35:27 +0100342 *
Minos Galanakis80e76b62024-12-12 15:46:29 +0000343 * Enable support for RFC 7301 Application Layer Protocol Negotiation.
Gilles Peskined3d02902020-03-04 21:35:27 +0100344 *
Minos Galanakis80e76b62024-12-12 15:46:29 +0000345 * Comment this macro to disable support for ALPN.
Gilles Peskined3d02902020-03-04 21:35:27 +0100346 */
Minos Galanakis80e76b62024-12-12 15:46:29 +0000347#define MBEDTLS_SSL_ALPN
Gilles Peskined3d02902020-03-04 21:35:27 +0100348
349/**
Gilles Peskineb74a1c72018-04-24 13:09:22 +0200350 * \def MBEDTLS_SSL_ASYNC_PRIVATE
351 *
352 * Enable asynchronous external private key operations in SSL. This allows
353 * you to configure an SSL connection to call an external cryptographic
354 * module to perform private key operations instead of performing the
355 * operation inside the library.
356 *
Valerio Setti8841d6b2023-01-05 08:40:24 +0100357 * Requires: MBEDTLS_X509_CRT_PARSE_C
Gilles Peskineb74a1c72018-04-24 13:09:22 +0200358 */
Jaeden Amerod9c71da2018-06-15 20:31:26 +0100359//#define MBEDTLS_SSL_ASYNC_PRIVATE
Gilles Peskineb74a1c72018-04-24 13:09:22 +0200360
361/**
Minos Galanakis80e76b62024-12-12 15:46:29 +0000362 * \def MBEDTLS_SSL_CACHE_C
363 *
364 * Enable simple SSL cache implementation.
365 *
366 * Module: library/ssl_cache.c
367 * Caller:
368 *
369 * Requires: MBEDTLS_SSL_CACHE_C
370 */
371#define MBEDTLS_SSL_CACHE_C
372
373/**
374 * \def MBEDTLS_SSL_CLI_C
375 *
376 * Enable the SSL/TLS client code.
377 *
378 * Module: library/ssl*_client.c
379 * Caller:
380 *
381 * Requires: MBEDTLS_SSL_TLS_C
382 *
383 * \warning You must call psa_crypto_init() before doing any TLS operations.
384 *
385 * This module is required for SSL/TLS client support.
386 */
387#define MBEDTLS_SSL_CLI_C
388
389/**
Gilles Peskined3d02902020-03-04 21:35:27 +0100390 * \def MBEDTLS_SSL_CONTEXT_SERIALIZATION
391 *
392 * Enable serialization of the TLS context structures, through use of the
393 * functions mbedtls_ssl_context_save() and mbedtls_ssl_context_load().
394 *
395 * This pair of functions allows one side of a connection to serialize the
396 * context associated with the connection, then free or re-use that context
397 * while the serialized state is persisted elsewhere, and finally deserialize
398 * that state to a live context for resuming read/write operations on the
399 * connection. From a protocol perspective, the state of the connection is
400 * unaffected, in particular this is entirely transparent to the peer.
401 *
402 * Note: this is distinct from TLS session resumption, which is part of the
403 * protocol and fully visible by the peer. TLS session resumption enables
404 * establishing new connections associated to a saved session with shorter,
405 * lighter handshakes, while context serialization is a local optimization in
406 * handling a single, potentially long-lived connection.
407 *
408 * Enabling these APIs makes some SSL structures larger, as 64 extra bytes are
409 * saved after the handshake to allow for more efficient serialization, so if
410 * you don't need this feature you'll save RAM by disabling it.
411 *
Ronald Cron5eb9aba2025-07-22 10:58:44 +0200412 * Requires: PSA_WANT_ALG_GCM or PSA_WANT_ALG_CCM or PSA_WANT_ALG_CHACHA20_POLY1305
Przemek Stekiel460192e2022-10-03 08:55:29 +0200413 *
Gilles Peskined3d02902020-03-04 21:35:27 +0100414 * Comment to disable the context serialization APIs.
415 */
416#define MBEDTLS_SSL_CONTEXT_SERIALIZATION
417
418/**
Minos Galanakis80e76b62024-12-12 15:46:29 +0000419 * \def MBEDTLS_SSL_COOKIE_C
420 *
421 * Enable basic implementation of DTLS cookies for hello verification.
422 *
423 * Module: library/ssl_cookie.c
424 * Caller:
425 */
426#define MBEDTLS_SSL_COOKIE_C
427
428/**
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200429 * \def MBEDTLS_SSL_DEBUG_ALL
Paul Bakkerd66f0702013-01-31 16:57:45 +0100430 *
431 * Enable the debug messages in SSL module for all issues.
432 * Debug messages have been disabled in some places to prevent timing
433 * attacks due to (unbalanced) debugging function calls.
434 *
435 * If you need all error reporting you should enable this during debugging,
436 * but remove this for production servers that should log as well.
437 *
438 * Uncomment this macro to report all debug messages on errors introducing
439 * a timing side-channel.
440 *
Paul Bakkerd66f0702013-01-31 16:57:45 +0100441 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200442//#define MBEDTLS_SSL_DEBUG_ALL
Paul Bakkerd66f0702013-01-31 16:57:45 +0100443
Minos Galanakis80e76b62024-12-12 15:46:29 +0000444/**
445 * \def MBEDTLS_SSL_DTLS_ANTI_REPLAY
446 *
447 * Enable support for the anti-replay mechanism in DTLS.
448 *
449 * Requires: MBEDTLS_SSL_TLS_C
450 * MBEDTLS_SSL_PROTO_DTLS
451 *
452 * \warning Disabling this is often a security risk!
453 * See mbedtls_ssl_conf_dtls_anti_replay() for details.
454 *
455 * Comment this to disable anti-replay in DTLS.
456 */
457#define MBEDTLS_SSL_DTLS_ANTI_REPLAY
458
459/**
460 * \def MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE
461 *
462 * Enable server-side support for clients that reconnect from the same port.
463 *
464 * Some clients unexpectedly close the connection and try to reconnect using the
465 * same source port. This needs special support from the server to handle the
466 * new connection securely, as described in section 4.2.8 of RFC 6347. This
467 * flag enables that support.
468 *
469 * Requires: MBEDTLS_SSL_DTLS_HELLO_VERIFY
470 *
471 * Comment this to disable support for clients reusing the source port.
472 */
473#define MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE
474
475/**
476 * \def MBEDTLS_SSL_DTLS_CONNECTION_ID
477 *
478 * Enable support for the DTLS Connection ID (CID) extension,
479 * which allows to identify DTLS connections across changes
480 * in the underlying transport. The CID functionality is described
481 * in RFC 9146.
482 *
483 * Setting this option enables the SSL APIs `mbedtls_ssl_set_cid()`,
484 * mbedtls_ssl_get_own_cid()`, `mbedtls_ssl_get_peer_cid()` and
485 * `mbedtls_ssl_conf_cid()`. See the corresponding documentation for
486 * more information.
487 *
488 * The maximum lengths of outgoing and incoming CIDs can be configured
489 * through the options
490 * - MBEDTLS_SSL_CID_OUT_LEN_MAX
491 * - MBEDTLS_SSL_CID_IN_LEN_MAX.
492 *
493 * Requires: MBEDTLS_SSL_PROTO_DTLS
494 *
495 * Uncomment to enable the Connection ID extension.
496 */
497#define MBEDTLS_SSL_DTLS_CONNECTION_ID
498
499/**
Minos Galanakis80e76b62024-12-12 15:46:29 +0000500 * \def MBEDTLS_SSL_DTLS_HELLO_VERIFY
501 *
502 * Enable support for HelloVerifyRequest on DTLS servers.
503 *
504 * This feature is highly recommended to prevent DTLS servers being used as
505 * amplifiers in DoS attacks against other hosts. It should always be enabled
506 * unless you know for sure amplification cannot be a problem in the
507 * environment in which your server operates.
508 *
509 * \warning Disabling this can be a security risk! (see above)
510 *
511 * Requires: MBEDTLS_SSL_PROTO_DTLS
512 *
513 * Comment this to disable support for HelloVerifyRequest.
514 */
515#define MBEDTLS_SSL_DTLS_HELLO_VERIFY
516
517/**
518 * \def MBEDTLS_SSL_DTLS_SRTP
519 *
520 * Enable support for negotiation of DTLS-SRTP (RFC 5764)
521 * through the use_srtp extension.
522 *
523 * \note This feature provides the minimum functionality required
524 * to negotiate the use of DTLS-SRTP and to allow the derivation of
525 * the associated SRTP packet protection key material.
526 * In particular, the SRTP packet protection itself, as well as the
527 * demultiplexing of RTP and DTLS packets at the datagram layer
528 * (see Section 5 of RFC 5764), are not handled by this feature.
529 * Instead, after successful completion of a handshake negotiating
530 * the use of DTLS-SRTP, the extended key exporter API
531 * mbedtls_ssl_conf_export_keys_cb() should be used to implement
532 * the key exporter described in Section 4.2 of RFC 5764 and RFC 5705
533 * (this is implemented in the SSL example programs).
534 * The resulting key should then be passed to an SRTP stack.
535 *
536 * Setting this option enables the runtime API
537 * mbedtls_ssl_conf_dtls_srtp_protection_profiles()
538 * through which the supported DTLS-SRTP protection
539 * profiles can be configured. You must call this API at
540 * runtime if you wish to negotiate the use of DTLS-SRTP.
541 *
542 * Requires: MBEDTLS_SSL_PROTO_DTLS
543 *
544 * Uncomment this to enable support for use_srtp extension.
545 */
546//#define MBEDTLS_SSL_DTLS_SRTP
547
548/**
549 * \def MBEDTLS_SSL_EARLY_DATA
550 *
551 * Enable support for RFC 8446 TLS 1.3 early data.
552 *
553 * Requires: MBEDTLS_SSL_SESSION_TICKETS and either
554 * MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED or
555 * MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED
556 *
557 * Comment this to disable support for early data. If MBEDTLS_SSL_PROTO_TLS1_3
558 * is not enabled, this option does not have any effect on the build.
559 *
560 * \note The maximum amount of early data can be set with
561 * MBEDTLS_SSL_MAX_EARLY_DATA_SIZE.
562 *
563 */
564//#define MBEDTLS_SSL_EARLY_DATA
565
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200566/** \def MBEDTLS_SSL_ENCRYPT_THEN_MAC
Manuel Pégourié-Gonnard699cafa2014-10-27 13:57:03 +0100567 *
568 * Enable support for Encrypt-then-MAC, RFC 7366.
569 *
570 * This allows peers that both support it to use a more robust protection for
571 * ciphersuites using CBC, providing deep resistance against timing attacks
572 * on the padding or underlying cipher.
573 *
574 * This only affects CBC ciphersuites, and is useless if none is defined.
575 *
TRodziewicz0f82ec62021-05-12 17:49:18 +0200576 * Requires: MBEDTLS_SSL_PROTO_TLS1_2
Manuel Pégourié-Gonnard699cafa2014-10-27 13:57:03 +0100577 *
578 * Comment this macro to disable support for Encrypt-then-MAC
579 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200580#define MBEDTLS_SSL_ENCRYPT_THEN_MAC
Manuel Pégourié-Gonnard699cafa2014-10-27 13:57:03 +0100581
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200582/** \def MBEDTLS_SSL_EXTENDED_MASTER_SECRET
Manuel Pégourié-Gonnard367381f2014-10-20 18:40:56 +0200583 *
Manuel Pégourié-Gonnardbca8aa02020-03-24 12:11:49 +0100584 * Enable support for RFC 7627: Session Hash and Extended Master Secret
585 * Extension.
Manuel Pégourié-Gonnard367381f2014-10-20 18:40:56 +0200586 *
Shaun Case8b0ecbc2021-12-20 21:14:10 -0800587 * This was introduced as "the proper fix" to the Triple Handshake family of
Manuel Pégourié-Gonnard367381f2014-10-20 18:40:56 +0200588 * attacks, but it is recommended to always use it (even if you disable
589 * renegotiation), since it actually fixes a more fundamental issue in the
590 * original SSL/TLS design, and has implications beyond Triple Handshake.
591 *
TRodziewicz0f82ec62021-05-12 17:49:18 +0200592 * Requires: MBEDTLS_SSL_PROTO_TLS1_2
Manuel Pégourié-Gonnard769c6b62014-10-28 14:13:55 +0100593 *
Manuel Pégourié-Gonnard367381f2014-10-20 18:40:56 +0200594 * Comment this macro to disable support for Extended Master Secret.
595 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200596#define MBEDTLS_SSL_EXTENDED_MASTER_SECRET
Manuel Pégourié-Gonnard367381f2014-10-20 18:40:56 +0200597
Paul Bakkerd66f0702013-01-31 16:57:45 +0100598/**
Hanno Beckerbb278f52019-02-05 17:04:00 +0000599 * \def MBEDTLS_SSL_KEEP_PEER_CERTIFICATE
600 *
Hanno Beckerfd7f2982019-02-25 10:13:33 +0000601 * This option controls the availability of the API mbedtls_ssl_get_peer_cert()
Hanno Beckerbb278f52019-02-05 17:04:00 +0000602 * giving access to the peer's certificate after completion of the handshake.
603 *
604 * Unless you need mbedtls_ssl_peer_cert() in your application, it is
605 * recommended to disable this option for reduced RAM usage.
606 *
607 * \note If this option is disabled, mbedtls_ssl_get_peer_cert() is still
608 * defined, but always returns \c NULL.
609 *
610 * \note This option has no influence on the protection against the
611 * triple handshake attack. Even if it is disabled, Mbed TLS will
612 * still ensure that certificates do not change during renegotiation,
Shaun Case8b0ecbc2021-12-20 21:14:10 -0800613 * for example by keeping a hash of the peer's certificate.
Hanno Beckerbb278f52019-02-05 17:04:00 +0000614 *
Tom Cosgroveafb2fe12022-06-29 16:36:12 +0100615 * \note This option is required if MBEDTLS_SSL_PROTO_TLS1_3 is set.
Hanno Beckerbb278f52019-02-05 17:04:00 +0000616 *
617 * Comment this macro to disable storing the peer's certificate
618 * after the handshake.
619 */
620#define MBEDTLS_SSL_KEEP_PEER_CERTIFICATE
621
622/**
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200623 * \def MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
Paul Bakker05decb22013-08-15 13:33:48 +0200624 *
Manuel Pégourié-Gonnard09fff7e2013-09-20 13:45:36 +0200625 * Enable support for RFC 6066 max_fragment_length extension in SSL.
Paul Bakker05decb22013-08-15 13:33:48 +0200626 *
627 * Comment this macro to disable support for the max_fragment_length extension
628 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200629#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
Paul Bakker05decb22013-08-15 13:33:48 +0200630
631/**
Minos Galanakis80e76b62024-12-12 15:46:29 +0000632 * \def MBEDTLS_SSL_PROTO_DTLS
Jan Bruckner151f6422023-02-10 12:45:19 +0100633 *
Minos Galanakis80e76b62024-12-12 15:46:29 +0000634 * Enable support for DTLS (all available versions).
Jan Bruckner151f6422023-02-10 12:45:19 +0100635 *
Minos Galanakis80e76b62024-12-12 15:46:29 +0000636 * Enable this and MBEDTLS_SSL_PROTO_TLS1_2 to enable DTLS 1.2.
Jan Bruckner151f6422023-02-10 12:45:19 +0100637 *
Minos Galanakis80e76b62024-12-12 15:46:29 +0000638 * Requires: MBEDTLS_SSL_PROTO_TLS1_2
639 *
640 * Comment this macro to disable support for DTLS
Jan Bruckner151f6422023-02-10 12:45:19 +0100641 */
Minos Galanakis80e76b62024-12-12 15:46:29 +0000642#define MBEDTLS_SSL_PROTO_DTLS
Jan Bruckner151f6422023-02-10 12:45:19 +0100643
644/**
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200645 * \def MBEDTLS_SSL_PROTO_TLS1_2
Paul Bakkerd2f068e2013-08-27 21:19:20 +0200646 *
Manuel Pégourié-Gonnard0b1ff292014-02-06 13:04:16 +0100647 * Enable support for TLS 1.2 (and DTLS 1.2 if DTLS is enabled).
Paul Bakkerd2f068e2013-08-27 21:19:20 +0200648 *
Janos Follath277bba82024-11-19 16:14:00 +0000649 * Requires: PSA_WANT_ALG_SHA_256 or PSA_WANT_ALG_SHA_384
Andrzej Kureke02da812022-08-17 17:04:49 -0400650 *
Manuel Pégourié-Gonnard0b1ff292014-02-06 13:04:16 +0100651 * Comment this macro to disable support for TLS 1.2 / DTLS 1.2
Paul Bakkerd2f068e2013-08-27 21:19:20 +0200652 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200653#define MBEDTLS_SSL_PROTO_TLS1_2
Paul Bakkerd2f068e2013-08-27 21:19:20 +0200654
655/**
Ronald Cron6f135e12021-12-08 16:57:54 +0100656 * \def MBEDTLS_SSL_PROTO_TLS1_3
Hanno Becker9fc15ea2020-05-04 12:00:47 +0100657 *
Ronald Cron6f135e12021-12-08 16:57:54 +0100658 * Enable support for TLS 1.3.
Hanno Becker9fc15ea2020-05-04 12:00:47 +0100659 *
Gilles Peskineda69eaa2023-09-05 20:54:17 +0200660 * \note See docs/architecture/tls13-support.md for a description of the TLS
Ronald Cron6f135e12021-12-08 16:57:54 +0100661 * 1.3 support that this option enables.
Hanno Becker9fc15ea2020-05-04 12:00:47 +0100662 *
Tom Cosgroveafb2fe12022-06-29 16:36:12 +0100663 * Requires: MBEDTLS_SSL_KEEP_PEER_CERTIFICATE
Manuel Pégourié-Gonnard3e830982022-05-11 13:27:44 +0200664 * Requires: MBEDTLS_PSA_CRYPTO_C
Ronald Cron6f135e12021-12-08 16:57:54 +0100665 *
Hanno Becker9fc15ea2020-05-04 12:00:47 +0100666 * Uncomment this macro to enable the support for TLS 1.3.
Hanno Becker9fc15ea2020-05-04 12:00:47 +0100667 */
Ronald Cron27eb68d2024-03-15 16:13:37 +0100668#define MBEDTLS_SSL_PROTO_TLS1_3
Hanno Becker9fc15ea2020-05-04 12:00:47 +0100669
670/**
Minos Galanakis80e76b62024-12-12 15:46:29 +0000671 * \def MBEDTLS_SSL_RECORD_SIZE_LIMIT
672 *
673 * Enable support for RFC 8449 record_size_limit extension in SSL (TLS 1.3 only).
674 *
675 * Requires: MBEDTLS_SSL_PROTO_TLS1_3
676 *
677 * Uncomment this macro to enable support for the record_size_limit extension
678 */
679//#define MBEDTLS_SSL_RECORD_SIZE_LIMIT
680
Max Fillinger7577c9e2025-01-17 14:10:08 +0100681/**
Max Fillinger2fe35f62024-10-25 00:52:24 +0200682 * \def MBEDTLS_SSL_KEYING_MATERIAL_EXPORT
683 *
684 * When this option is enabled, the client and server can extract additional
685 * shared symmetric keys after an SSL handshake using the function
686 * mbedtls_ssl_export_keying_material().
687 *
688 * The process for deriving the keys is specified in RFC 5705 for TLS 1.2 and
689 * in RFC 8446, Section 7.5, for TLS 1.3.
690 *
Max Fillinger51bec542024-10-28 13:14:39 +0100691 * Comment this macro to disable mbedtls_ssl_export_keying_material().
Max Fillinger2fe35f62024-10-25 00:52:24 +0200692 */
Max Fillinger51bec542024-10-28 13:14:39 +0100693#define MBEDTLS_SSL_KEYING_MATERIAL_EXPORT
Max Fillinger2fe35f62024-10-25 00:52:24 +0200694
Minos Galanakis80e76b62024-12-12 15:46:29 +0000695/**
696 * \def MBEDTLS_SSL_RENEGOTIATION
697 *
698 * Enable support for TLS renegotiation.
699 *
700 * The two main uses of renegotiation are (1) refresh keys on long-lived
701 * connections and (2) client authentication after the initial handshake.
702 * If you don't need renegotiation, it's probably better to disable it, since
703 * it has been associated with security issues in the past and is easy to
704 * misuse/misunderstand.
705 *
706 * Requires: MBEDTLS_SSL_PROTO_TLS1_2
707 *
708 * Comment this to disable support for renegotiation.
709 *
710 * \note Even if this option is disabled, both client and server are aware
711 * of the Renegotiation Indication Extension (RFC 5746) used to
712 * prevent the SSL renegotiation attack (see RFC 5746 Sect. 1).
713 * (See \c mbedtls_ssl_conf_legacy_renegotiation for the
714 * configuration of this extension).
715 *
716 */
717#define MBEDTLS_SSL_RENEGOTIATION
718
719/**
720 * \def MBEDTLS_SSL_SERVER_NAME_INDICATION
721 *
722 * Enable support for RFC 6066 server name indication (SNI) in SSL.
723 *
724 * Requires: MBEDTLS_X509_CRT_PARSE_C
725 *
726 * Comment this macro to disable support for server name indication in SSL
727 */
728#define MBEDTLS_SSL_SERVER_NAME_INDICATION
729
730/**
731 * \def MBEDTLS_SSL_SESSION_TICKETS
732 *
733 * Enable support for RFC 5077 session tickets in SSL.
734 * Client-side, provides full support for session tickets (maintenance of a
735 * session store remains the responsibility of the application, though).
736 * Server-side, you also need to provide callbacks for writing and parsing
737 * tickets, including authenticated encryption and key management. Example
738 * callbacks are provided by MBEDTLS_SSL_TICKET_C.
739 *
740 * Comment this macro to disable support for SSL session tickets
741 */
742#define MBEDTLS_SSL_SESSION_TICKETS
743
744/**
745 * \def MBEDTLS_SSL_SRV_C
746 *
747 * Enable the SSL/TLS server code.
748 *
749 * Module: library/ssl*_server.c
750 * Caller:
751 *
752 * Requires: MBEDTLS_SSL_TLS_C
753 *
754 * \warning You must call psa_crypto_init() before doing any TLS operations.
755 *
756 * This module is required for SSL/TLS server support.
757 */
758#define MBEDTLS_SSL_SRV_C
759
760/**
761 * \def MBEDTLS_SSL_TICKET_C
762 *
763 * Enable an implementation of TLS server-side callbacks for session tickets.
764 *
765 * Module: library/ssl_ticket.c
766 * Caller:
767 *
Ronald Cron5eb9aba2025-07-22 10:58:44 +0200768 * Requires: PSA_WANT_ALG_GCM or PSA_WANT_ALG_CCM or PSA_WANT_ALG_CHACHA20_POLY1305
Minos Galanakis80e76b62024-12-12 15:46:29 +0000769 */
770#define MBEDTLS_SSL_TICKET_C
771
772/**
Ronald Cronab65c522021-11-24 10:47:20 +0100773 * \def MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE
774 *
775 * Enable TLS 1.3 middlebox compatibility mode.
776 *
777 * As specified in Section D.4 of RFC 8446, TLS 1.3 offers a compatibility
778 * mode to make a TLS 1.3 connection more likely to pass through middle boxes
779 * expecting TLS 1.2 traffic.
780 *
781 * Turning on the compatibility mode comes at the cost of a few added bytes
782 * on the wire, but it doesn't affect compatibility with TLS 1.3 implementations
783 * that don't use it. Therefore, unless transmission bandwidth is critical and
784 * you know that middlebox compatibility issues won't occur, it is therefore
785 * recommended to set this option.
786 *
787 * Comment to disable compatibility mode for TLS 1.3. If
Ronald Cron6f135e12021-12-08 16:57:54 +0100788 * MBEDTLS_SSL_PROTO_TLS1_3 is not enabled, this option does not have any
789 * effect on the build.
Ronald Cronab65c522021-11-24 10:47:20 +0100790 *
791 */
Ronald Cron27eb68d2024-03-15 16:13:37 +0100792#define MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE
Ronald Cronab65c522021-11-24 10:47:20 +0100793
794/**
Ronald Crond8d2ea52022-10-04 15:48:06 +0200795 * \def MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED
796 *
797 * Enable TLS 1.3 ephemeral key exchange mode.
798 *
Przemek Stekielce05f542023-06-15 16:44:08 +0200799 * Requires: PSA_WANT_ALG_ECDH or PSA_WANT_ALG_FFDH
Manuel Pégourié-Gonnard4fa702a2023-03-29 12:15:24 +0200800 * MBEDTLS_X509_CRT_PARSE_C
801 * and at least one of:
Ronald Cron3c6bbdd2025-09-15 18:28:06 +0200802 * PSA_WANT_ALG_ECDSA
Ronald Cron5eb9aba2025-07-22 10:58:44 +0200803 * PSA_WANT_ALG_RSA_PSS
Ronald Crond8d2ea52022-10-04 15:48:06 +0200804 *
805 * Comment to disable support for the ephemeral key exchange mode in TLS 1.3.
806 * If MBEDTLS_SSL_PROTO_TLS1_3 is not enabled, this option does not have any
807 * effect on the build.
808 *
809 */
810#define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_EPHEMERAL_ENABLED
811
812/**
Minos Galanakis80e76b62024-12-12 15:46:29 +0000813 * \def MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED
814 *
815 * Enable TLS 1.3 PSK key exchange mode.
816 *
817 * Comment to disable support for the PSK key exchange mode in TLS 1.3. If
818 * MBEDTLS_SSL_PROTO_TLS1_3 is not enabled, this option does not have any
819 * effect on the build.
820 *
821 */
822#define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_ENABLED
823
824/**
Ronald Crond8d2ea52022-10-04 15:48:06 +0200825 * \def MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED
826 *
827 * Enable TLS 1.3 PSK ephemeral key exchange mode.
828 *
Przemek Stekielce05f542023-06-15 16:44:08 +0200829 * Requires: PSA_WANT_ALG_ECDH or PSA_WANT_ALG_FFDH
Ronald Crond8d2ea52022-10-04 15:48:06 +0200830 *
831 * Comment to disable support for the PSK ephemeral key exchange mode in
832 * TLS 1.3. If MBEDTLS_SSL_PROTO_TLS1_3 is not enabled, this option does not
833 * have any effect on the build.
834 *
835 */
836#define MBEDTLS_SSL_TLS1_3_KEY_EXCHANGE_MODE_PSK_EPHEMERAL_ENABLED
837
838/**
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200839 * \def MBEDTLS_SSL_TLS_C
Paul Bakkerf3b86c12011-01-27 15:24:17 +0000840 *
Paul Bakkere29ab062011-05-18 13:26:54 +0000841 * Enable the generic SSL/TLS code.
Paul Bakkerf3b86c12011-01-27 15:24:17 +0000842 *
Paul Bakker5121ce52009-01-03 21:22:43 +0000843 * Module: library/ssl_tls.c
Ronald Cronde1adee2022-03-07 16:20:30 +0100844 * Caller: library/ssl*_client.c
845 * library/ssl*_server.c
Paul Bakker5121ce52009-01-03 21:22:43 +0000846 *
Ronald Cron5eb9aba2025-07-22 10:58:44 +0200847 * Requires: PSA_WANT_ALG_SHA_256 or PSA_WANT_ALG_SHA_384
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200848 * and at least one of the MBEDTLS_SSL_PROTO_XXX defines
Paul Bakker5690efc2011-05-26 13:16:06 +0000849 *
Paul Bakker5121ce52009-01-03 21:22:43 +0000850 * This module is required for SSL/TLS.
851 */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200852#define MBEDTLS_SSL_TLS_C
Paul Bakker5121ce52009-01-03 21:22:43 +0000853
Paul Bakkerf3b86c12011-01-27 15:24:17 +0000854/**
Minos Galanakis80e76b62024-12-12 15:46:29 +0000855 * \def MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH
Paul Bakkerf3b86c12011-01-27 15:24:17 +0000856 *
Minos Galanakis80e76b62024-12-12 15:46:29 +0000857 * When this option is enabled, the SSL buffer will be resized automatically
858 * based on the negotiated maximum fragment length in each direction.
Manuel Pégourié-Gonnard325ce092016-02-22 10:33:34 +0100859 *
Minos Galanakis80e76b62024-12-12 15:46:29 +0000860 * Requires: MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
Paul Bakkerecd54fb2013-07-03 14:48:29 +0200861 */
Minos Galanakis80e76b62024-12-12 15:46:29 +0000862//#define MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH
Paul Bakker5121ce52009-01-03 21:22:43 +0000863
Minos Galanakis80e76b62024-12-12 15:46:29 +0000864//#define MBEDTLS_PSK_MAX_LEN 32 /**< Max size of TLS pre-shared keys, in bytes (default 256 or 384 bits) */
Manuel Pégourié-Gonnard2cf5a7c2015-04-08 12:49:31 +0200865//#define MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES 50 /**< Maximum entries in cache */
Minos Galanakis80e76b62024-12-12 15:46:29 +0000866//#define MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT 86400 /**< 1 day */
Angus Grattond8213d02016-05-25 20:56:48 +1000867
Gilles Peskined3d02902020-03-04 21:35:27 +0100868/** \def MBEDTLS_SSL_CID_IN_LEN_MAX
869 *
870 * The maximum length of CIDs used for incoming DTLS messages.
871 *
872 */
873//#define MBEDTLS_SSL_CID_IN_LEN_MAX 32
874
875/** \def MBEDTLS_SSL_CID_OUT_LEN_MAX
876 *
877 * The maximum length of CIDs used for outgoing DTLS messages.
878 *
879 */
880//#define MBEDTLS_SSL_CID_OUT_LEN_MAX 32
881
TRodziewicze8dd7092021-05-12 14:19:11 +0200882/** \def MBEDTLS_SSL_CID_TLS1_3_PADDING_GRANULARITY
Gilles Peskined3d02902020-03-04 21:35:27 +0100883 *
884 * This option controls the use of record plaintext padding
TRodziewicz1e660ed2021-05-26 17:08:54 +0200885 * in TLS 1.3 and when using the Connection ID extension in DTLS 1.2.
Hanno Becker13996922020-05-28 16:15:19 +0100886 *
887 * The padding will always be chosen so that the length of the
888 * padded plaintext is a multiple of the value of this option.
889 *
890 * Note: A value of \c 1 means that no padding will be used
891 * for outgoing records.
892 *
893 * Note: On systems lacking division instructions,
894 * a power of two should be preferred.
895 */
TRodziewicze8dd7092021-05-12 14:19:11 +0200896//#define MBEDTLS_SSL_CID_TLS1_3_PADDING_GRANULARITY 16
Hanno Becker13996922020-05-28 16:15:19 +0100897
Minos Galanakis80e76b62024-12-12 15:46:29 +0000898/**
899 * Complete list of ciphersuites to use, in order of preference.
900 *
901 * \warning No dependency checking is done on that field! This option can only
902 * be used to restrict the set of available ciphersuites. It is your
903 * responsibility to make sure the needed modules are active.
904 *
905 * Use this to save a few hundred bytes of ROM (default ordering of all
906 * available ciphersuites) and a few to a few hundred bytes of RAM.
907 *
908 * The value below is only an example, not the default.
909 */
910//#define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
911
912//#define MBEDTLS_SSL_COOKIE_TIMEOUT 60 /**< Default expiration delay of DTLS cookies, in seconds if HAVE_TIME, or in number of cookies issued */
913
914/** \def MBEDTLS_SSL_DTLS_MAX_BUFFERING
915 *
916 * Maximum number of heap-allocated bytes for the purpose of
917 * DTLS handshake message reassembly and future message buffering.
918 *
919 * This should be at least 9/8 * MBEDTLS_SSL_IN_CONTENT_LEN
920 * to account for a reassembled handshake message of maximum size,
921 * together with its reassembly bitmap.
922 *
923 * A value of 2 * MBEDTLS_SSL_IN_CONTENT_LEN (32768 by default)
924 * should be sufficient for all practical situations as it allows
925 * to reassembly a large handshake message (such as a certificate)
926 * while buffering multiple smaller handshake messages.
927 *
928 */
929//#define MBEDTLS_SSL_DTLS_MAX_BUFFERING 32768
930
931/** \def MBEDTLS_SSL_IN_CONTENT_LEN
932 *
933 * Maximum length (in bytes) of incoming plaintext fragments.
934 *
935 * This determines the size of the incoming TLS I/O buffer in such a way
936 * that it is capable of holding the specified amount of plaintext data,
937 * regardless of the protection mechanism used.
938 *
939 * \note When using a value less than the default of 16KB on the client, it is
940 * recommended to use the Maximum Fragment Length (MFL) extension to
941 * inform the server about this limitation. On the server, there
942 * is no supported, standardized way of informing the client about
943 * restriction on the maximum size of incoming messages, and unless
944 * the limitation has been communicated by other means, it is recommended
945 * to only change the outgoing buffer size #MBEDTLS_SSL_OUT_CONTENT_LEN
946 * while keeping the default value of 16KB for the incoming buffer.
947 *
948 * Uncomment to set the maximum plaintext size of the incoming I/O buffer.
949 */
950//#define MBEDTLS_SSL_IN_CONTENT_LEN 16384
951
952/**
953 * \def MBEDTLS_SSL_MAX_EARLY_DATA_SIZE
954 *
955 * The default maximum amount of 0-RTT data. See the documentation of
956 * \c mbedtls_ssl_conf_max_early_data_size() for more information.
957 *
958 * It must be positive and smaller than UINT32_MAX.
959 *
960 * If MBEDTLS_SSL_EARLY_DATA is not defined, this default value does not
961 * have any impact on the build.
962 */
963//#define MBEDTLS_SSL_MAX_EARLY_DATA_SIZE 1024
964
Angus Grattond8213d02016-05-25 20:56:48 +1000965/** \def MBEDTLS_SSL_OUT_CONTENT_LEN
966 *
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500967 * Maximum length (in bytes) of outgoing plaintext fragments.
Angus Grattond8213d02016-05-25 20:56:48 +1000968 *
Andrzej Kurekc470b6b2019-01-31 08:20:20 -0500969 * This determines the size of the outgoing TLS I/O buffer in such a way
970 * that it is capable of holding the specified amount of plaintext data,
971 * regardless of the protection mechanism used.
972 *
Angus Grattond8213d02016-05-25 20:56:48 +1000973 * It is possible to save RAM by setting a smaller outward buffer, while keeping
974 * the default inward 16384 byte buffer to conform to the TLS specification.
975 *
976 * The minimum required outward buffer size is determined by the handshake
977 * protocol's usage. Handshaking will fail if the outward buffer is too small.
978 * The specific size requirement depends on the configured ciphers and any
979 * certificate data which is sent during the handshake.
980 *
David Horstmann95d516f2021-05-04 18:36:56 +0100981 * Uncomment to set the maximum plaintext size of the outgoing I/O buffer.
Angus Grattond8213d02016-05-25 20:56:48 +1000982 */
983//#define MBEDTLS_SSL_OUT_CONTENT_LEN 16384
984
Manuel Pégourié-Gonnarddfc7df02014-06-30 17:59:55 +0200985/**
Minos Galanakis80e76b62024-12-12 15:46:29 +0000986 * \def MBEDTLS_SSL_TLS1_3_DEFAULT_NEW_SESSION_TICKETS
Manuel Pégourié-Gonnarddfc7df02014-06-30 17:59:55 +0200987 *
Minos Galanakis80e76b62024-12-12 15:46:29 +0000988 * Default number of NewSessionTicket messages to be sent by a TLS 1.3 server
989 * after handshake completion. This is not used in TLS 1.2 and relevant only if
990 * the MBEDTLS_SSL_SESSION_TICKETS option is enabled.
Manuel Pégourié-Gonnarddfc7df02014-06-30 17:59:55 +0200991 *
Manuel Pégourié-Gonnarddfc7df02014-06-30 17:59:55 +0200992 */
Minos Galanakis80e76b62024-12-12 15:46:29 +0000993//#define MBEDTLS_SSL_TLS1_3_DEFAULT_NEW_SESSION_TICKETS 1
Tom Cosgrovea63775b2023-09-14 13:31:19 +0100994
995/**
Gilles Peskinea8d7e432022-08-04 23:39:41 +0200996 * \def MBEDTLS_SSL_TLS1_3_TICKET_AGE_TOLERANCE
997 *
Jerry Yucf913512023-11-14 11:06:52 +0800998 * Maximum allowed ticket age difference in milliseconds tolerated between
Jerry Yu034a8b72023-11-10 12:20:19 +0800999 * server and client. Default value is 6000. This is not used in TLS 1.2.
Gilles Peskinea8d7e432022-08-04 23:39:41 +02001000 *
Jerry Yu034a8b72023-11-10 12:20:19 +08001001 * - The client ticket age is the time difference between the time when the
1002 * client proposes to the server to use the ticket and the time the client
1003 * received the ticket from the server.
1004 * - The server ticket age is the time difference between the time when the
1005 * server receives a proposition from the client to use the ticket and the
1006 * time when the ticket was created by the server.
1007 *
Jerry Yucf913512023-11-14 11:06:52 +08001008 * The ages might be different due to the client and server clocks not running
1009 * at the same pace. The typical accuracy of an RTC crystal is ±100 to ±20 parts
1010 * per million (360 to 72 milliseconds per hour). Default tolerance window is
1011 * 6s, thus in the worst case clients and servers must sync up their system time
1012 * every 6000/360/2~=8 hours.
Gilles Peskinea8d7e432022-08-04 23:39:41 +02001013 *
Jerry Yu04fceb72023-11-15 09:52:46 +08001014 * See section 8.3 of the TLS 1.3 specification(RFC 8446) for more information.
Gilles Peskinea8d7e432022-08-04 23:39:41 +02001015 */
Gilles Peskined65ea422023-09-05 21:07:32 +02001016//#define MBEDTLS_SSL_TLS1_3_TICKET_AGE_TOLERANCE 6000
Gilles Peskinea8d7e432022-08-04 23:39:41 +02001017
Minos Galanakis1bf85a82024-12-12 16:29:38 +00001018/**
1019 * \def MBEDTLS_SSL_TLS1_3_TICKET_NONCE_LENGTH
1020 *
1021 * Size in bytes of a ticket nonce. This is not used in TLS 1.2.
1022 *
1023 * This must be less than 256.
1024 */
1025//#define MBEDTLS_SSL_TLS1_3_TICKET_NONCE_LENGTH 32
1026
Minos Galanakis80e76b62024-12-12 15:46:29 +00001027/** \} name SECTION: TLS feature selection */
1028
Gilles Peskinea8d7e432022-08-04 23:39:41 +02001029/**
Minos Galanakis80e76b62024-12-12 15:46:29 +00001030 * \name SECTION: X.509 feature selection
Gilles Peskinea8d7e432022-08-04 23:39:41 +02001031 *
Minos Galanakis80e76b62024-12-12 15:46:29 +00001032 * This section sets Certificate related options.
1033 * \{
Gilles Peskinea8d7e432022-08-04 23:39:41 +02001034 */
Minos Galanakis80e76b62024-12-12 15:46:29 +00001035
1036/**
1037 * \def MBEDTLS_PKCS7_C
1038 *
1039 * Enable PKCS #7 core for using PKCS #7-formatted signatures.
1040 * RFC Link - https://tools.ietf.org/html/rfc2315
1041 *
1042 * Module: library/pkcs7.c
1043 *
Gilles Peskine02ec5852025-05-12 20:52:07 +02001044 * Requires: MBEDTLS_ASN1_PARSE_C, MBEDTLS_PK_PARSE_C,
Minos Galanakis80e76b62024-12-12 15:46:29 +00001045 * MBEDTLS_X509_CRT_PARSE_C MBEDTLS_X509_CRL_PARSE_C,
1046 * MBEDTLS_BIGNUM_C, MBEDTLS_MD_C
1047 *
1048 * This module is required for the PKCS #7 parsing modules.
1049 */
1050#define MBEDTLS_PKCS7_C
1051
1052/**
1053 * \def MBEDTLS_X509_CREATE_C
1054 *
1055 * Enable X.509 core for creating certificates.
1056 *
1057 * Module: library/x509_create.c
1058 *
Gilles Peskine02ec5852025-05-12 20:52:07 +02001059 * Requires: MBEDTLS_BIGNUM_C, MBEDTLS_PK_PARSE_C,
Minos Galanakis80e76b62024-12-12 15:46:29 +00001060 *
1061 * \warning You must call psa_crypto_init() before doing any X.509 operation.
1062 *
1063 * This module is the basis for creating X.509 certificates and CSRs.
1064 */
1065#define MBEDTLS_X509_CREATE_C
1066
1067/**
1068 * \def MBEDTLS_X509_CRL_PARSE_C
1069 *
1070 * Enable X.509 CRL parsing.
1071 *
1072 * Module: library/x509_crl.c
1073 * Caller: library/x509_crt.c
1074 *
1075 * Requires: MBEDTLS_X509_USE_C
1076 *
1077 * This module is required for X.509 CRL parsing.
1078 */
1079#define MBEDTLS_X509_CRL_PARSE_C
1080
1081/**
1082 * \def MBEDTLS_X509_CRT_PARSE_C
1083 *
1084 * Enable X.509 certificate parsing.
1085 *
1086 * Module: library/x509_crt.c
1087 * Caller: library/ssl_tls.c
1088 * library/ssl*_client.c
1089 * library/ssl*_server.c
1090 *
1091 * Requires: MBEDTLS_X509_USE_C
1092 *
1093 * This module is required for X.509 certificate parsing.
1094 */
1095#define MBEDTLS_X509_CRT_PARSE_C
1096
1097/**
1098 * \def MBEDTLS_X509_CRT_WRITE_C
1099 *
1100 * Enable creating X.509 certificates.
1101 *
1102 * Module: library/x509_crt_write.c
1103 *
1104 * Requires: MBEDTLS_X509_CREATE_C
1105 *
1106 * This module is required for X.509 certificate creation.
1107 */
1108#define MBEDTLS_X509_CRT_WRITE_C
1109
1110/**
1111 * \def MBEDTLS_X509_CSR_PARSE_C
1112 *
1113 * Enable X.509 Certificate Signing Request (CSR) parsing.
1114 *
1115 * Module: library/x509_csr.c
1116 * Caller: library/x509_crt_write.c
1117 *
1118 * Requires: MBEDTLS_X509_USE_C
1119 *
1120 * This module is used for reading X.509 certificate request.
1121 */
1122#define MBEDTLS_X509_CSR_PARSE_C
1123
1124/**
1125 * \def MBEDTLS_X509_CSR_WRITE_C
1126 *
1127 * Enable creating X.509 Certificate Signing Requests (CSR).
1128 *
1129 * Module: library/x509_csr_write.c
1130 *
1131 * Requires: MBEDTLS_X509_CREATE_C
1132 *
1133 * This module is required for X.509 certificate request writing.
1134 */
1135#define MBEDTLS_X509_CSR_WRITE_C
1136
1137/**
1138 * \def MBEDTLS_X509_REMOVE_INFO
1139 *
1140 * Disable mbedtls_x509_*_info() and related APIs.
1141 *
1142 * Uncomment to omit mbedtls_x509_*_info(), as well as mbedtls_debug_print_crt()
1143 * and other functions/constants only used by these functions, thus reducing
1144 * the code footprint by several KB.
1145 */
1146//#define MBEDTLS_X509_REMOVE_INFO
1147
1148/**
1149 * \def MBEDTLS_X509_RSASSA_PSS_SUPPORT
1150 *
1151 * Enable parsing and verification of X.509 certificates, CRLs and CSRS
1152 * signed with RSASSA-PSS (aka PKCS#1 v2.1).
1153 *
Ronald Cron5eb9aba2025-07-22 10:58:44 +02001154 * Requires: PSA_WANT_ALG_RSA_PSS
Minos Galanakis80e76b62024-12-12 15:46:29 +00001155 *
1156 * Comment this macro to disallow using RSASSA-PSS in certificates.
1157 */
1158#define MBEDTLS_X509_RSASSA_PSS_SUPPORT
1159
1160/**
1161 * \def MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
1162 *
1163 * If set, this enables the X.509 API `mbedtls_x509_crt_verify_with_ca_cb()`
1164 * and the SSL API `mbedtls_ssl_conf_ca_cb()` which allow users to configure
1165 * the set of trusted certificates through a callback instead of a linked
1166 * list.
1167 *
1168 * This is useful for example in environments where a large number of trusted
1169 * certificates is present and storing them in a linked list isn't efficient
1170 * enough, or when the set of trusted certificates changes frequently.
1171 *
1172 * See the documentation of `mbedtls_x509_crt_verify_with_ca_cb()` and
1173 * `mbedtls_ssl_conf_ca_cb()` for more information.
1174 *
1175 * Requires: MBEDTLS_X509_CRT_PARSE_C
1176 *
1177 * Uncomment to enable trusted certificate callbacks.
1178 */
1179//#define MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
1180
1181/**
1182 * \def MBEDTLS_X509_USE_C
1183 *
1184 * Enable X.509 core for using certificates.
1185 *
1186 * Module: library/x509.c
1187 * Caller: library/x509_crl.c
1188 * library/x509_crt.c
1189 * library/x509_csr.c
1190 *
Gilles Peskine02ec5852025-05-12 20:52:07 +02001191 * Requires: MBEDTLS_ASN1_PARSE_C, MBEDTLS_BIGNUM_C, MBEDTLS_PK_PARSE_C
Minos Galanakis80e76b62024-12-12 15:46:29 +00001192 *
1193 * \warning You must call psa_crypto_init() before doing any X.509 operation.
1194 *
1195 * This module is required for the X.509 parsing modules.
1196 */
1197#define MBEDTLS_X509_USE_C
1198
1199//#define MBEDTLS_X509_MAX_FILE_PATH_LEN 512 /**< Maximum length of a path/filename string in bytes including the null terminator character ('\0'). */
1200//#define MBEDTLS_X509_MAX_INTERMEDIATE_CA 8 /**< Maximum number of intermediate CAs in a verification chain. */
1201
1202/** \} name SECTION: X.509 feature selection */