1 /**
2  * \file config.h
3  *
4  * \brief Configuration options (set of defines)
5  *
6  *  This set of compile-time options may be used to enable
7  *  or disable features selectively, and reduce the global
8  *  memory footprint.
9  */
10 /*
11  *  Copyright The Mbed TLS Contributors
12  *  SPDX-License-Identifier: Apache-2.0
13  *
14  *  Licensed under the Apache License, Version 2.0 (the "License"); you may
15  *  not use this file except in compliance with the License.
16  *  You may obtain a copy of the License at
17  *
18  *  http://www.apache.org/licenses/LICENSE-2.0
19  *
20  *  Unless required by applicable law or agreed to in writing, software
21  *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
22  *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23  *  See the License for the specific language governing permissions and
24  *  limitations under the License.
25  */
26 
27 #ifndef MBEDTLS_CONFIG_H
28 #define MBEDTLS_CONFIG_H
29 
30 #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
31 #define _CRT_SECURE_NO_DEPRECATE 1
32 #endif
33 
34 /**
35  * \name SECTION: System support
36  *
37  * This section sets system specific settings.
38  * \{
39  */
40 
41 /**
42  * \def MBEDTLS_HAVE_ASM
43  *
44  * The compiler has support for asm().
45  *
46  * Requires support for asm() in compiler.
47  *
48  * Used in:
49  *      library/aria.c
50  *      library/timing.c
51  *      include/mbedtls/bn_mul.h
52  *
53  * Required by:
54  *      MBEDTLS_AESNI_C
55  *      MBEDTLS_PADLOCK_C
56  *
57  * Comment to disable the use of assembly code.
58  */
59 #define MBEDTLS_HAVE_ASM
60 
61 /**
62  * \def MBEDTLS_NO_UDBL_DIVISION
63  *
64  * The platform lacks support for double-width integer division (64-bit
65  * division on a 32-bit platform, 128-bit division on a 64-bit platform).
66  *
67  * Used in:
68  *      include/mbedtls/bignum.h
69  *      library/bignum.c
70  *
71  * The bignum code uses double-width division to speed up some operations.
72  * Double-width division is often implemented in software that needs to
73  * be linked with the program. The presence of a double-width integer
74  * type is usually detected automatically through preprocessor macros,
75  * but the automatic detection cannot know whether the code needs to
76  * and can be linked with an implementation of division for that type.
77  * By default division is assumed to be usable if the type is present.
78  * Uncomment this option to prevent the use of double-width division.
79  *
80  * Note that division for the native integer type is always required.
81  * Furthermore, a 64-bit type is always required even on a 32-bit
82  * platform, but it need not support multiplication or division. In some
83  * cases it is also desirable to disable some double-width operations. For
84  * example, if double-width division is implemented in software, disabling
85  * it can reduce code size in some embedded targets.
86  */
87 //#define MBEDTLS_NO_UDBL_DIVISION
88 
89 /**
90  * \def MBEDTLS_NO_64BIT_MULTIPLICATION
91  *
92  * The platform lacks support for 32x32 -> 64-bit multiplication.
93  *
94  * Used in:
95  *      library/poly1305.c
96  *
97  * Some parts of the library may use multiplication of two unsigned 32-bit
98  * operands with a 64-bit result in order to speed up computations. On some
99  * platforms, this is not available in hardware and has to be implemented in
100  * software, usually in a library provided by the toolchain.
101  *
102  * Sometimes it is not desirable to have to link to that library. This option
103  * removes the dependency of that library on platforms that lack a hardware
104  * 64-bit multiplier by embedding a software implementation in Mbed TLS.
105  *
106  * Note that depending on the compiler, this may decrease performance compared
107  * to using the library function provided by the toolchain.
108  */
109 //#define MBEDTLS_NO_64BIT_MULTIPLICATION
110 
111 /**
112  * \def MBEDTLS_HAVE_SSE2
113  *
114  * CPU supports SSE2 instruction set.
115  *
116  * Uncomment if the CPU supports SSE2 (IA-32 specific).
117  */
118 //#define MBEDTLS_HAVE_SSE2
119 
120 /**
121  * \def MBEDTLS_HAVE_TIME
122  *
123  * System has time.h and time().
124  * The time does not need to be correct, only time differences are used,
125  * by contrast with MBEDTLS_HAVE_TIME_DATE
126  *
127  * Defining MBEDTLS_HAVE_TIME allows you to specify MBEDTLS_PLATFORM_TIME_ALT,
128  * MBEDTLS_PLATFORM_TIME_MACRO, MBEDTLS_PLATFORM_TIME_TYPE_MACRO and
129  * MBEDTLS_PLATFORM_STD_TIME.
130  *
131  * Comment if your system does not support time functions
132  */
133 #define MBEDTLS_HAVE_TIME
134 
135 /**
136  * \def MBEDTLS_HAVE_TIME_DATE
137  *
138  * System has time.h, time(), and an implementation for
139  * mbedtls_platform_gmtime_r() (see below).
140  * The time needs to be correct (not necessarily very accurate, but at least
141  * the date should be correct). This is used to verify the validity period of
142  * X.509 certificates.
143  *
144  * Comment if your system does not have a correct clock.
145  *
146  * \note mbedtls_platform_gmtime_r() is an abstraction in platform_util.h that
147  * behaves similarly to the gmtime_r() function from the C standard. Refer to
148  * the documentation for mbedtls_platform_gmtime_r() for more information.
149  *
150  * \note It is possible to configure an implementation for
151  * mbedtls_platform_gmtime_r() at compile-time by using the macro
152  * MBEDTLS_PLATFORM_GMTIME_R_ALT.
153  */
154 #define MBEDTLS_HAVE_TIME_DATE
155 
156 /**
157  * \def MBEDTLS_PLATFORM_MEMORY
158  *
159  * Enable the memory allocation layer.
160  *
161  * By default mbed TLS uses the system-provided calloc() and free().
162  * This allows different allocators (self-implemented or provided) to be
163  * provided to the platform abstraction layer.
164  *
165  * Enabling MBEDTLS_PLATFORM_MEMORY without the
166  * MBEDTLS_PLATFORM_{FREE,CALLOC}_MACROs will provide
167  * "mbedtls_platform_set_calloc_free()" allowing you to set an alternative calloc() and
168  * free() function pointer at runtime.
169  *
170  * Enabling MBEDTLS_PLATFORM_MEMORY and specifying
171  * MBEDTLS_PLATFORM_{CALLOC,FREE}_MACROs will allow you to specify the
172  * alternate function at compile time.
173  *
174  * Requires: MBEDTLS_PLATFORM_C
175  *
176  * Enable this layer to allow use of alternative memory allocators.
177  */
178 //#define MBEDTLS_PLATFORM_MEMORY
179 
180 /**
181  * \def MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
182  *
183  * Do not assign standard functions in the platform layer (e.g. calloc() to
184  * MBEDTLS_PLATFORM_STD_CALLOC and printf() to MBEDTLS_PLATFORM_STD_PRINTF)
185  *
186  * This makes sure there are no linking errors on platforms that do not support
187  * these functions. You will HAVE to provide alternatives, either at runtime
188  * via the platform_set_xxx() functions or at compile time by setting
189  * the MBEDTLS_PLATFORM_STD_XXX defines, or enabling a
190  * MBEDTLS_PLATFORM_XXX_MACRO.
191  *
192  * Requires: MBEDTLS_PLATFORM_C
193  *
194  * Uncomment to prevent default assignment of standard functions in the
195  * platform layer.
196  */
197 //#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
198 
199 /**
200  * \def MBEDTLS_PLATFORM_EXIT_ALT
201  *
202  * MBEDTLS_PLATFORM_XXX_ALT: Uncomment a macro to let mbed TLS support the
203  * function in the platform abstraction layer.
204  *
205  * Example: In case you uncomment MBEDTLS_PLATFORM_PRINTF_ALT, mbed TLS will
206  * provide a function "mbedtls_platform_set_printf()" that allows you to set an
207  * alternative printf function pointer.
208  *
209  * All these define require MBEDTLS_PLATFORM_C to be defined!
210  *
211  * \note MBEDTLS_PLATFORM_SNPRINTF_ALT is required on Windows;
212  * it will be enabled automatically by check_config.h
213  *
214  * \warning MBEDTLS_PLATFORM_XXX_ALT cannot be defined at the same time as
215  * MBEDTLS_PLATFORM_XXX_MACRO!
216  *
217  * Requires: MBEDTLS_PLATFORM_TIME_ALT requires MBEDTLS_HAVE_TIME
218  *
219  * Uncomment a macro to enable alternate implementation of specific base
220  * platform function
221  */
222 //#define MBEDTLS_PLATFORM_EXIT_ALT
223 //#define MBEDTLS_PLATFORM_TIME_ALT
224 //#define MBEDTLS_PLATFORM_FPRINTF_ALT
225 //#define MBEDTLS_PLATFORM_PRINTF_ALT
226 //#define MBEDTLS_PLATFORM_SNPRINTF_ALT
227 //#define MBEDTLS_PLATFORM_VSNPRINTF_ALT
228 //#define MBEDTLS_PLATFORM_NV_SEED_ALT
229 //#define MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT
230 
231 /**
232  * \def MBEDTLS_DEPRECATED_WARNING
233  *
234  * Mark deprecated functions and features so that they generate a warning if
235  * used. Functionality deprecated in one version will usually be removed in the
236  * next version. You can enable this to help you prepare the transition to a
237  * new major version by making sure your code is not using this functionality.
238  *
239  * This only works with GCC and Clang. With other compilers, you may want to
240  * use MBEDTLS_DEPRECATED_REMOVED
241  *
242  * Uncomment to get warnings on using deprecated functions and features.
243  */
244 //#define MBEDTLS_DEPRECATED_WARNING
245 
246 /**
247  * \def MBEDTLS_DEPRECATED_REMOVED
248  *
249  * Remove deprecated functions and features so that they generate an error if
250  * used. Functionality deprecated in one version will usually be removed in the
251  * next version. You can enable this to help you prepare the transition to a
252  * new major version by making sure your code is not using this functionality.
253  *
254  * Uncomment to get errors on using deprecated functions and features.
255  */
256 //#define MBEDTLS_DEPRECATED_REMOVED
257 
258 /**
259  * \def MBEDTLS_CHECK_PARAMS
260  *
261  * This configuration option controls whether the library validates more of
262  * the parameters passed to it.
263  *
264  * When this flag is not defined, the library only attempts to validate an
265  * input parameter if: (1) they may come from the outside world (such as the
266  * network, the filesystem, etc.) or (2) not validating them could result in
267  * internal memory errors such as overflowing a buffer controlled by the
268  * library. On the other hand, it doesn't attempt to validate parameters whose
269  * values are fully controlled by the application (such as pointers).
270  *
271  * When this flag is defined, the library additionally attempts to validate
272  * parameters that are fully controlled by the application, and should always
273  * be valid if the application code is fully correct and trusted.
274  *
275  * For example, when a function accepts as input a pointer to a buffer that may
276  * contain untrusted data, and its documentation mentions that this pointer
277  * must not be NULL:
278  * - The pointer is checked to be non-NULL only if this option is enabled.
279  * - The content of the buffer is always validated.
280  *
281  * When this flag is defined, if a library function receives a parameter that
282  * is invalid:
283  * 1. The function will invoke the macro MBEDTLS_PARAM_FAILED().
284  * 2. If MBEDTLS_PARAM_FAILED() did not terminate the program, the function
285  *   will immediately return. If the function returns an Mbed TLS error code,
286  *   the error code in this case is MBEDTLS_ERR_xxx_BAD_INPUT_DATA.
287  *
288  * When defining this flag, you also need to arrange a definition for
289  * MBEDTLS_PARAM_FAILED(). You can do this by any of the following methods:
290  * - By default, the library defines MBEDTLS_PARAM_FAILED() to call a
291  *   function mbedtls_param_failed(), but the library does not define this
292  *   function. If you do not make any other arrangements, you must provide
293  *   the function mbedtls_param_failed() in your application.
294  *   See `platform_util.h` for its prototype.
295  * - If you enable the macro #MBEDTLS_CHECK_PARAMS_ASSERT, then the
296  *   library defines MBEDTLS_PARAM_FAILED(\c cond) to be `assert(cond)`.
297  *   You can still supply an alternative definition of
298  *   MBEDTLS_PARAM_FAILED(), which may call `assert`.
299  * - If you define a macro MBEDTLS_PARAM_FAILED() before including `config.h`
300  *   or you uncomment the definition of MBEDTLS_PARAM_FAILED() in `config.h`,
301  *   the library will call the macro that you defined and will not supply
302  *   its own version. Note that if MBEDTLS_PARAM_FAILED() calls `assert`,
303  *   you need to enable #MBEDTLS_CHECK_PARAMS_ASSERT so that library source
304  *   files include `<assert.h>`.
305  *
306  * Uncomment to enable validation of application-controlled parameters.
307  */
308 //#define MBEDTLS_CHECK_PARAMS
309 
310 /**
311  * \def MBEDTLS_CHECK_PARAMS_ASSERT
312  *
313  * Allow MBEDTLS_PARAM_FAILED() to call `assert`, and make it default to
314  * `assert`. This macro is only used if #MBEDTLS_CHECK_PARAMS is defined.
315  *
316  * If this macro is not defined, then MBEDTLS_PARAM_FAILED() defaults to
317  * calling a function mbedtls_param_failed(). See the documentation of
318  * #MBEDTLS_CHECK_PARAMS for details.
319  *
320  * Uncomment to allow MBEDTLS_PARAM_FAILED() to call `assert`.
321  */
322 //#define MBEDTLS_CHECK_PARAMS_ASSERT
323 
324 /* \} name SECTION: System support */
325 
326 /**
327  * \name SECTION: mbed TLS feature support
328  *
329  * This section sets support for features that are or are not needed
330  * within the modules that are enabled.
331  * \{
332  */
333 
334 /**
335  * \def MBEDTLS_TIMING_ALT
336  *
337  * Uncomment to provide your own alternate implementation for mbedtls_timing_hardclock(),
338  * mbedtls_timing_get_timer(), mbedtls_set_alarm(), mbedtls_set/get_delay()
339  *
340  * Only works if you have MBEDTLS_TIMING_C enabled.
341  *
342  * You will need to provide a header "timing_alt.h" and an implementation at
343  * compile time.
344  */
345 //#define MBEDTLS_TIMING_ALT
346 
347 /**
348  * \def MBEDTLS_AES_ALT
349  *
350  * MBEDTLS__MODULE_NAME__ALT: Uncomment a macro to let mbed TLS use your
351  * alternate core implementation of a symmetric crypto, an arithmetic or hash
352  * module (e.g. platform specific assembly optimized implementations). Keep
353  * in mind that the function prototypes should remain the same.
354  *
355  * This replaces the whole module. If you only want to replace one of the
356  * functions, use one of the MBEDTLS__FUNCTION_NAME__ALT flags.
357  *
358  * Example: In case you uncomment MBEDTLS_AES_ALT, mbed TLS will no longer
359  * provide the "struct mbedtls_aes_context" definition and omit the base
360  * function declarations and implementations. "aes_alt.h" will be included from
361  * "aes.h" to include the new function definitions.
362  *
363  * Uncomment a macro to enable alternate implementation of the corresponding
364  * module.
365  *
366  * \warning   MD2, MD4, MD5, ARC4, DES and SHA-1 are considered weak and their
367  *            use constitutes a security risk. If possible, we recommend
368  *            avoiding dependencies on them, and considering stronger message
369  *            digests and ciphers instead.
370  *
371  */
372 //#define MBEDTLS_AES_ALT
373 //#define MBEDTLS_ARC4_ALT
374 //#define MBEDTLS_ARIA_ALT
375 //#define MBEDTLS_BLOWFISH_ALT
376 //#define MBEDTLS_CAMELLIA_ALT
377 //#define MBEDTLS_CCM_ALT
378 //#define MBEDTLS_CHACHA20_ALT
379 //#define MBEDTLS_CHACHAPOLY_ALT
380 //#define MBEDTLS_CMAC_ALT
381 //#define MBEDTLS_DES_ALT
382 //#define MBEDTLS_DHM_ALT
383 //#define MBEDTLS_ECJPAKE_ALT
384 //#define MBEDTLS_GCM_ALT
385 //#define MBEDTLS_NIST_KW_ALT
386 //#define MBEDTLS_MD2_ALT
387 //#define MBEDTLS_MD4_ALT
388 //#define MBEDTLS_MD5_ALT
389 //#define MBEDTLS_POLY1305_ALT
390 //#define MBEDTLS_RIPEMD160_ALT
391 //#define MBEDTLS_RSA_ALT
392 //#define MBEDTLS_SHA1_ALT
393 //#define MBEDTLS_SHA256_ALT
394 //#define MBEDTLS_SHA512_ALT
395 //#define MBEDTLS_XTEA_ALT
396 
397 /*
398  * When replacing the elliptic curve module, pleace consider, that it is
399  * implemented with two .c files:
400  *      - ecp.c
401  *      - ecp_curves.c
402  * You can replace them very much like all the other MBEDTLS__MODULE_NAME__ALT
403  * macros as described above. The only difference is that you have to make sure
404  * that you provide functionality for both .c files.
405  */
406 //#define MBEDTLS_ECP_ALT
407 
408 /**
409  * \def MBEDTLS_MD2_PROCESS_ALT
410  *
411  * MBEDTLS__FUNCTION_NAME__ALT: Uncomment a macro to let mbed TLS use you
412  * alternate core implementation of symmetric crypto or hash function. Keep in
413  * mind that function prototypes should remain the same.
414  *
415  * This replaces only one function. The header file from mbed TLS is still
416  * used, in contrast to the MBEDTLS__MODULE_NAME__ALT flags.
417  *
418  * Example: In case you uncomment MBEDTLS_SHA256_PROCESS_ALT, mbed TLS will
419  * no longer provide the mbedtls_sha1_process() function, but it will still provide
420  * the other function (using your mbedtls_sha1_process() function) and the definition
421  * of mbedtls_sha1_context, so your implementation of mbedtls_sha1_process must be compatible
422  * with this definition.
423  *
424  * \note Because of a signature change, the core AES encryption and decryption routines are
425  *       currently named mbedtls_aes_internal_encrypt and mbedtls_aes_internal_decrypt,
426  *       respectively. When setting up alternative implementations, these functions should
427  *       be overridden, but the wrapper functions mbedtls_aes_decrypt and mbedtls_aes_encrypt
428  *       must stay untouched.
429  *
430  * \note If you use the AES_xxx_ALT macros, then it is recommended to also set
431  *       MBEDTLS_AES_ROM_TABLES in order to help the linker garbage-collect the AES
432  *       tables.
433  *
434  * Uncomment a macro to enable alternate implementation of the corresponding
435  * function.
436  *
437  * \warning   MD2, MD4, MD5, DES and SHA-1 are considered weak and their use
438  *            constitutes a security risk. If possible, we recommend avoiding
439  *            dependencies on them, and considering stronger message digests
440  *            and ciphers instead.
441  *
442  * \warning   If both MBEDTLS_ECDSA_SIGN_ALT and MBEDTLS_ECDSA_DETERMINISTIC are
443  *            enabled, then the deterministic ECDH signature functions pass the
444  *            the static HMAC-DRBG as RNG to mbedtls_ecdsa_sign(). Therefore
445  *            alternative implementations should use the RNG only for generating
446  *            the ephemeral key and nothing else. If this is not possible, then
447  *            MBEDTLS_ECDSA_DETERMINISTIC should be disabled and an alternative
448  *            implementation should be provided for mbedtls_ecdsa_sign_det_ext()
449  *            (and for mbedtls_ecdsa_sign_det() too if backward compatibility is
450  *            desirable).
451  *
452  */
453 //#define MBEDTLS_MD2_PROCESS_ALT
454 //#define MBEDTLS_MD4_PROCESS_ALT
455 //#define MBEDTLS_MD5_PROCESS_ALT
456 //#define MBEDTLS_RIPEMD160_PROCESS_ALT
457 //#define MBEDTLS_SHA1_PROCESS_ALT
458 //#define MBEDTLS_SHA256_PROCESS_ALT
459 //#define MBEDTLS_SHA512_PROCESS_ALT
460 //#define MBEDTLS_DES_SETKEY_ALT
461 //#define MBEDTLS_DES_CRYPT_ECB_ALT
462 //#define MBEDTLS_DES3_CRYPT_ECB_ALT
463 //#define MBEDTLS_AES_SETKEY_ENC_ALT
464 //#define MBEDTLS_AES_SETKEY_DEC_ALT
465 //#define MBEDTLS_AES_ENCRYPT_ALT
466 //#define MBEDTLS_AES_DECRYPT_ALT
467 //#define MBEDTLS_ECDH_GEN_PUBLIC_ALT
468 //#define MBEDTLS_ECDH_COMPUTE_SHARED_ALT
469 //#define MBEDTLS_ECDSA_VERIFY_ALT
470 //#define MBEDTLS_ECDSA_SIGN_ALT
471 //#define MBEDTLS_ECDSA_GENKEY_ALT
472 
473 /**
474  * \def MBEDTLS_ECP_INTERNAL_ALT
475  *
476  * Expose a part of the internal interface of the Elliptic Curve Point module.
477  *
478  * MBEDTLS_ECP__FUNCTION_NAME__ALT: Uncomment a macro to let mbed TLS use your
479  * alternative core implementation of elliptic curve arithmetic. Keep in mind
480  * that function prototypes should remain the same.
481  *
482  * This partially replaces one function. The header file from mbed TLS is still
483  * used, in contrast to the MBEDTLS_ECP_ALT flag. The original implementation
484  * is still present and it is used for group structures not supported by the
485  * alternative.
486  *
487  * The original implementation can in addition be removed by setting the
488  * MBEDTLS_ECP_NO_FALLBACK option, in which case any function for which the
489  * corresponding MBEDTLS_ECP__FUNCTION_NAME__ALT macro is defined will not be
490  * able to fallback to curves not supported by the alternative implementation.
491  *
492  * Any of these options become available by defining MBEDTLS_ECP_INTERNAL_ALT
493  * and implementing the following functions:
494  *      unsigned char mbedtls_internal_ecp_grp_capable(
495  *          const mbedtls_ecp_group *grp )
496  *      int  mbedtls_internal_ecp_init( const mbedtls_ecp_group *grp )
497  *      void mbedtls_internal_ecp_free( const mbedtls_ecp_group *grp )
498  * The mbedtls_internal_ecp_grp_capable function should return 1 if the
499  * replacement functions implement arithmetic for the given group and 0
500  * otherwise.
501  * The functions mbedtls_internal_ecp_init and mbedtls_internal_ecp_free are
502  * called before and after each point operation and provide an opportunity to
503  * implement optimized set up and tear down instructions.
504  *
505  * Example: In case you set MBEDTLS_ECP_INTERNAL_ALT and
506  * MBEDTLS_ECP_DOUBLE_JAC_ALT, mbed TLS will still provide the ecp_double_jac()
507  * function, but will use your mbedtls_internal_ecp_double_jac() if the group
508  * for the operation is supported by your implementation (i.e. your
509  * mbedtls_internal_ecp_grp_capable() function returns 1 for this group). If the
510  * group is not supported by your implementation, then the original mbed TLS
511  * implementation of ecp_double_jac() is used instead, unless this fallback
512  * behaviour is disabled by setting MBEDTLS_ECP_NO_FALLBACK (in which case
513  * ecp_double_jac() will return MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE).
514  *
515  * The function prototypes and the definition of mbedtls_ecp_group and
516  * mbedtls_ecp_point will not change based on MBEDTLS_ECP_INTERNAL_ALT, so your
517  * implementation of mbedtls_internal_ecp__function_name__ must be compatible
518  * with their definitions.
519  *
520  * Uncomment a macro to enable alternate implementation of the corresponding
521  * function.
522  */
523 /* Required for all the functions in this section */
524 //#define MBEDTLS_ECP_INTERNAL_ALT
525 /* Turn off software fallback for curves not supported in hardware */
526 //#define MBEDTLS_ECP_NO_FALLBACK
527 /* Support for Weierstrass curves with Jacobi representation */
528 //#define MBEDTLS_ECP_RANDOMIZE_JAC_ALT
529 //#define MBEDTLS_ECP_ADD_MIXED_ALT
530 //#define MBEDTLS_ECP_DOUBLE_JAC_ALT
531 //#define MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT
532 //#define MBEDTLS_ECP_NORMALIZE_JAC_ALT
533 /* Support for curves with Montgomery arithmetic */
534 //#define MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT
535 //#define MBEDTLS_ECP_RANDOMIZE_MXZ_ALT
536 //#define MBEDTLS_ECP_NORMALIZE_MXZ_ALT
537 
538 /**
539  * \def MBEDTLS_TEST_NULL_ENTROPY
540  *
541  * Enables testing and use of mbed TLS without any configured entropy sources.
542  * This permits use of the library on platforms before an entropy source has
543  * been integrated (see for example the MBEDTLS_ENTROPY_HARDWARE_ALT or the
544  * MBEDTLS_ENTROPY_NV_SEED switches).
545  *
546  * WARNING! This switch MUST be disabled in production builds, and is suitable
547  * only for development.
548  * Enabling the switch negates any security provided by the library.
549  *
550  * Requires MBEDTLS_ENTROPY_C, MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
551  *
552  */
553 //#define MBEDTLS_TEST_NULL_ENTROPY
554 
555 /**
556  * \def MBEDTLS_ENTROPY_HARDWARE_ALT
557  *
558  * Uncomment this macro to let mbed TLS use your own implementation of a
559  * hardware entropy collector.
560  *
561  * Your function must be called \c mbedtls_hardware_poll(), have the same
562  * prototype as declared in entropy_poll.h, and accept NULL as first argument.
563  *
564  * Uncomment to use your own hardware entropy collector.
565  */
566 //#define MBEDTLS_ENTROPY_HARDWARE_ALT
567 
568 /**
569  * \def MBEDTLS_AES_ROM_TABLES
570  *
571  * Use precomputed AES tables stored in ROM.
572  *
573  * Uncomment this macro to use precomputed AES tables stored in ROM.
574  * Comment this macro to generate AES tables in RAM at runtime.
575  *
576  * Tradeoff: Using precomputed ROM tables reduces RAM usage by ~8kb
577  * (or ~2kb if \c MBEDTLS_AES_FEWER_TABLES is used) and reduces the
578  * initialization time before the first AES operation can be performed.
579  * It comes at the cost of additional ~8kb ROM use (resp. ~2kb if \c
580  * MBEDTLS_AES_FEWER_TABLES below is used), and potentially degraded
581  * performance if ROM access is slower than RAM access.
582  *
583  * This option is independent of \c MBEDTLS_AES_FEWER_TABLES.
584  *
585  */
586 //#define MBEDTLS_AES_ROM_TABLES
587 
588 /**
589  * \def MBEDTLS_AES_FEWER_TABLES
590  *
591  * Use less ROM/RAM for AES tables.
592  *
593  * Uncommenting this macro omits 75% of the AES tables from
594  * ROM / RAM (depending on the value of \c MBEDTLS_AES_ROM_TABLES)
595  * by computing their values on the fly during operations
596  * (the tables are entry-wise rotations of one another).
597  *
598  * Tradeoff: Uncommenting this reduces the RAM / ROM footprint
599  * by ~6kb but at the cost of more arithmetic operations during
600  * runtime. Specifically, one has to compare 4 accesses within
601  * different tables to 4 accesses with additional arithmetic
602  * operations within the same table. The performance gain/loss
603  * depends on the system and memory details.
604  *
605  * This option is independent of \c MBEDTLS_AES_ROM_TABLES.
606  *
607  */
608 //#define MBEDTLS_AES_FEWER_TABLES
609 
610 /**
611  * \def MBEDTLS_CAMELLIA_SMALL_MEMORY
612  *
613  * Use less ROM for the Camellia implementation (saves about 768 bytes).
614  *
615  * Uncomment this macro to use less memory for Camellia.
616  */
617 //#define MBEDTLS_CAMELLIA_SMALL_MEMORY
618 
619 /**
620  * \def MBEDTLS_CHECK_RETURN_WARNING
621  *
622  * If this macro is defined, emit a compile-time warning if application code
623  * calls a function without checking its return value, but the return value
624  * should generally be checked in portable applications.
625  *
626  * This is only supported on platforms where #MBEDTLS_CHECK_RETURN is
627  * implemented. Otherwise this option has no effect.
628  *
629  * Uncomment to get warnings on using fallible functions without checking
630  * their return value.
631  *
632  * \note  This feature is a work in progress.
633  *        Warnings will be added to more functions in the future.
634  *
635  * \note  A few functions are considered critical, and ignoring the return
636  *        value of these functions will trigger a warning even if this
637  *        macro is not defined. To completely disable return value check
638  *        warnings, define #MBEDTLS_CHECK_RETURN with an empty expansion.
639  */
640 //#define MBEDTLS_CHECK_RETURN_WARNING
641 
642 /**
643  * \def MBEDTLS_CIPHER_MODE_CBC
644  *
645  * Enable Cipher Block Chaining mode (CBC) for symmetric ciphers.
646  */
647 #define MBEDTLS_CIPHER_MODE_CBC
648 
649 /**
650  * \def MBEDTLS_CIPHER_MODE_CFB
651  *
652  * Enable Cipher Feedback mode (CFB) for symmetric ciphers.
653  */
654 #define MBEDTLS_CIPHER_MODE_CFB
655 
656 /**
657  * \def MBEDTLS_CIPHER_MODE_CTR
658  *
659  * Enable Counter Block Cipher mode (CTR) for symmetric ciphers.
660  */
661 #define MBEDTLS_CIPHER_MODE_CTR
662 
663 /**
664  * \def MBEDTLS_CIPHER_MODE_OFB
665  *
666  * Enable Output Feedback mode (OFB) for symmetric ciphers.
667  */
668 #define MBEDTLS_CIPHER_MODE_OFB
669 
670 /**
671  * \def MBEDTLS_CIPHER_MODE_XTS
672  *
673  * Enable Xor-encrypt-xor with ciphertext stealing mode (XTS) for AES.
674  */
675 #define MBEDTLS_CIPHER_MODE_XTS
676 
677 /**
678  * \def MBEDTLS_CIPHER_NULL_CIPHER
679  *
680  * Enable NULL cipher.
681  * Warning: Only do so when you know what you are doing. This allows for
682  * encryption or channels without any security!
683  *
684  * Requires MBEDTLS_ENABLE_WEAK_CIPHERSUITES as well to enable
685  * the following ciphersuites:
686  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_NULL_SHA
687  *      MBEDTLS_TLS_ECDH_RSA_WITH_NULL_SHA
688  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_NULL_SHA
689  *      MBEDTLS_TLS_ECDHE_RSA_WITH_NULL_SHA
690  *      MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA384
691  *      MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA256
692  *      MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA
693  *      MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA384
694  *      MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA256
695  *      MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA
696  *      MBEDTLS_TLS_RSA_WITH_NULL_SHA256
697  *      MBEDTLS_TLS_RSA_WITH_NULL_SHA
698  *      MBEDTLS_TLS_RSA_WITH_NULL_MD5
699  *      MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA384
700  *      MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA256
701  *      MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA
702  *      MBEDTLS_TLS_PSK_WITH_NULL_SHA384
703  *      MBEDTLS_TLS_PSK_WITH_NULL_SHA256
704  *      MBEDTLS_TLS_PSK_WITH_NULL_SHA
705  *
706  * Uncomment this macro to enable the NULL cipher and ciphersuites
707  */
708 //#define MBEDTLS_CIPHER_NULL_CIPHER
709 
710 /**
711  * \def MBEDTLS_CIPHER_PADDING_PKCS7
712  *
713  * MBEDTLS_CIPHER_PADDING_XXX: Uncomment or comment macros to add support for
714  * specific padding modes in the cipher layer with cipher modes that support
715  * padding (e.g. CBC)
716  *
717  * If you disable all padding modes, only full blocks can be used with CBC.
718  *
719  * Enable padding modes in the cipher layer.
720  */
721 #define MBEDTLS_CIPHER_PADDING_PKCS7
722 #define MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS
723 #define MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN
724 #define MBEDTLS_CIPHER_PADDING_ZEROS
725 
726 /** \def MBEDTLS_CTR_DRBG_USE_128_BIT_KEY
727  *
728  * Uncomment this macro to use a 128-bit key in the CTR_DRBG module.
729  * By default, CTR_DRBG uses a 256-bit key.
730  */
731 //#define MBEDTLS_CTR_DRBG_USE_128_BIT_KEY
732 
733 /**
734  * \def MBEDTLS_ENABLE_WEAK_CIPHERSUITES
735  *
736  * Enable weak ciphersuites in SSL / TLS.
737  * Warning: Only do so when you know what you are doing. This allows for
738  * channels with virtually no security at all!
739  *
740  * This enables the following ciphersuites:
741  *      MBEDTLS_TLS_RSA_WITH_DES_CBC_SHA
742  *      MBEDTLS_TLS_DHE_RSA_WITH_DES_CBC_SHA
743  *
744  * Uncomment this macro to enable weak ciphersuites
745  *
746  * \warning   DES is considered a weak cipher and its use constitutes a
747  *            security risk. We recommend considering stronger ciphers instead.
748  */
749 //#define MBEDTLS_ENABLE_WEAK_CIPHERSUITES
750 
751 /**
752  * \def MBEDTLS_REMOVE_ARC4_CIPHERSUITES
753  *
754  * Remove RC4 ciphersuites by default in SSL / TLS.
755  * This flag removes the ciphersuites based on RC4 from the default list as
756  * returned by mbedtls_ssl_list_ciphersuites(). However, it is still possible to
757  * enable (some of) them with mbedtls_ssl_conf_ciphersuites() by including them
758  * explicitly.
759  *
760  * Uncomment this macro to remove RC4 ciphersuites by default.
761  */
762 #define MBEDTLS_REMOVE_ARC4_CIPHERSUITES
763 
764 /**
765  * \def MBEDTLS_REMOVE_3DES_CIPHERSUITES
766  *
767  * Remove 3DES ciphersuites by default in SSL / TLS.
768  * This flag removes the ciphersuites based on 3DES from the default list as
769  * returned by mbedtls_ssl_list_ciphersuites(). However, it is still possible
770  * to enable (some of) them with mbedtls_ssl_conf_ciphersuites() by including
771  * them explicitly.
772  *
773  * A man-in-the-browser attacker can recover authentication tokens sent through
774  * a TLS connection using a 3DES based cipher suite (see "On the Practical
775  * (In-)Security of 64-bit Block Ciphers" by Karthikeyan Bhargavan and Gaëtan
776  * Leurent, see https://sweet32.info/SWEET32_CCS16.pdf). If this attack falls
777  * in your threat model or you are unsure, then you should keep this option
778  * enabled to remove 3DES based cipher suites.
779  *
780  * Comment this macro to keep 3DES in the default ciphersuite list.
781  */
782 #define MBEDTLS_REMOVE_3DES_CIPHERSUITES
783 
784 /**
785  * \def MBEDTLS_ECP_DP_SECP192R1_ENABLED
786  *
787  * MBEDTLS_ECP_XXXX_ENABLED: Enables specific curves within the Elliptic Curve
788  * module.  By default all supported curves are enabled.
789  *
790  * Comment macros to disable the curve and functions for it
791  */
792 /* Short Weierstrass curves (supporting ECP, ECDH, ECDSA) */
793 #define MBEDTLS_ECP_DP_SECP192R1_ENABLED
794 #define MBEDTLS_ECP_DP_SECP224R1_ENABLED
795 #define MBEDTLS_ECP_DP_SECP256R1_ENABLED
796 #define MBEDTLS_ECP_DP_SECP384R1_ENABLED
797 #define MBEDTLS_ECP_DP_SECP521R1_ENABLED
798 #define MBEDTLS_ECP_DP_SECP192K1_ENABLED
799 #define MBEDTLS_ECP_DP_SECP224K1_ENABLED
800 #define MBEDTLS_ECP_DP_SECP256K1_ENABLED
801 #define MBEDTLS_ECP_DP_BP256R1_ENABLED
802 #define MBEDTLS_ECP_DP_BP384R1_ENABLED
803 #define MBEDTLS_ECP_DP_BP512R1_ENABLED
804 /* Montgomery curves (supporting ECP) */
805 #define MBEDTLS_ECP_DP_CURVE25519_ENABLED
806 #define MBEDTLS_ECP_DP_CURVE448_ENABLED
807 
808 /**
809  * \def MBEDTLS_ECP_NIST_OPTIM
810  *
811  * Enable specific 'modulo p' routines for each NIST prime.
812  * Depending on the prime and architecture, makes operations 4 to 8 times
813  * faster on the corresponding curve.
814  *
815  * Comment this macro to disable NIST curves optimisation.
816  */
817 #define MBEDTLS_ECP_NIST_OPTIM
818 
819 /**
820  * \def MBEDTLS_ECP_NO_INTERNAL_RNG
821  *
822  * When this option is disabled, mbedtls_ecp_mul() will make use of an
823  * internal RNG when called with a NULL \c f_rng argument, in order to protect
824  * against some side-channel attacks.
825  *
826  * This protection introduces a dependency of the ECP module on one of the
827  * DRBG modules. For very constrained implementations that don't require this
828  * protection (for example, because you're only doing signature verification,
829  * so not manipulating any secret, or because local/physical side-channel
830  * attacks are outside your threat model), it might be desirable to get rid of
831  * that dependency.
832  *
833  * \warning Enabling this option makes some uses of ECP vulnerable to some
834  * side-channel attacks. Only enable it if you know that's not a problem for
835  * your use case.
836  *
837  * Uncomment this macro to disable some counter-measures in ECP.
838  */
839 //#define MBEDTLS_ECP_NO_INTERNAL_RNG
840 
841 /**
842  * \def MBEDTLS_ECP_RESTARTABLE
843  *
844  * Enable "non-blocking" ECC operations that can return early and be resumed.
845  *
846  * This allows various functions to pause by returning
847  * #MBEDTLS_ERR_ECP_IN_PROGRESS (or, for functions in the SSL module,
848  * #MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS) and then be called later again in
849  * order to further progress and eventually complete their operation. This is
850  * controlled through mbedtls_ecp_set_max_ops() which limits the maximum
851  * number of ECC operations a function may perform before pausing; see
852  * mbedtls_ecp_set_max_ops() for more information.
853  *
854  * This is useful in non-threaded environments if you want to avoid blocking
855  * for too long on ECC (and, hence, X.509 or SSL/TLS) operations.
856  *
857  * Uncomment this macro to enable restartable ECC computations.
858  *
859  * \note  This option only works with the default software implementation of
860  *        elliptic curve functionality. It is incompatible with
861  *        MBEDTLS_ECP_ALT, MBEDTLS_ECDH_XXX_ALT, MBEDTLS_ECDSA_XXX_ALT
862  *        and MBEDTLS_ECDH_LEGACY_CONTEXT.
863  */
864 //#define MBEDTLS_ECP_RESTARTABLE
865 
866 /**
867  * \def MBEDTLS_ECDH_LEGACY_CONTEXT
868  *
869  * Use a backward compatible ECDH context.
870  *
871  * Mbed TLS supports two formats for ECDH contexts (#mbedtls_ecdh_context
872  * defined in `ecdh.h`). For most applications, the choice of format makes
873  * no difference, since all library functions can work with either format,
874  * except that the new format is incompatible with MBEDTLS_ECP_RESTARTABLE.
875 
876  * The new format used when this option is disabled is smaller
877  * (56 bytes on a 32-bit platform). In future versions of the library, it
878  * will support alternative implementations of ECDH operations.
879  * The new format is incompatible with applications that access
880  * context fields directly and with restartable ECP operations.
881  *
882  * Define this macro if you enable MBEDTLS_ECP_RESTARTABLE or if you
883  * want to access ECDH context fields directly. Otherwise you should
884  * comment out this macro definition.
885  *
886  * This option has no effect if #MBEDTLS_ECDH_C is not enabled.
887  *
888  * \note This configuration option is experimental. Future versions of the
889  *       library may modify the way the ECDH context layout is configured
890  *       and may modify the layout of the new context type.
891  */
892 #define MBEDTLS_ECDH_LEGACY_CONTEXT
893 
894 /**
895  * \def MBEDTLS_ECDSA_DETERMINISTIC
896  *
897  * Enable deterministic ECDSA (RFC 6979).
898  * Standard ECDSA is "fragile" in the sense that lack of entropy when signing
899  * may result in a compromise of the long-term signing key. This is avoided by
900  * the deterministic variant.
901  *
902  * Requires: MBEDTLS_HMAC_DRBG_C, MBEDTLS_ECDSA_C
903  *
904  * Comment this macro to disable deterministic ECDSA.
905  */
906 #define MBEDTLS_ECDSA_DETERMINISTIC
907 
908 /**
909  * \def MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
910  *
911  * Enable the PSK based ciphersuite modes in SSL / TLS.
912  *
913  * This enables the following ciphersuites (if other requisites are
914  * enabled as well):
915  *      MBEDTLS_TLS_PSK_WITH_AES_256_GCM_SHA384
916  *      MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA384
917  *      MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA
918  *      MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384
919  *      MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384
920  *      MBEDTLS_TLS_PSK_WITH_AES_128_GCM_SHA256
921  *      MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA256
922  *      MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA
923  *      MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256
924  *      MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256
925  *      MBEDTLS_TLS_PSK_WITH_3DES_EDE_CBC_SHA
926  *      MBEDTLS_TLS_PSK_WITH_RC4_128_SHA
927  */
928 #define MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
929 
930 /**
931  * \def MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED
932  *
933  * Enable the DHE-PSK based ciphersuite modes in SSL / TLS.
934  *
935  * Requires: MBEDTLS_DHM_C
936  *
937  * This enables the following ciphersuites (if other requisites are
938  * enabled as well):
939  *      MBEDTLS_TLS_DHE_PSK_WITH_AES_256_GCM_SHA384
940  *      MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA384
941  *      MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA
942  *      MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384
943  *      MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384
944  *      MBEDTLS_TLS_DHE_PSK_WITH_AES_128_GCM_SHA256
945  *      MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA256
946  *      MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA
947  *      MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256
948  *      MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256
949  *      MBEDTLS_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA
950  *      MBEDTLS_TLS_DHE_PSK_WITH_RC4_128_SHA
951  *
952  * \warning    Using DHE constitutes a security risk as it
953  *             is not possible to validate custom DH parameters.
954  *             If possible, it is recommended users should consider
955  *             preferring other methods of key exchange.
956  *             See dhm.h for more details.
957  *
958  */
959 #define MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED
960 
961 /**
962  * \def MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
963  *
964  * Enable the ECDHE-PSK based ciphersuite modes in SSL / TLS.
965  *
966  * Requires: MBEDTLS_ECDH_C
967  *
968  * This enables the following ciphersuites (if other requisites are
969  * enabled as well):
970  *      MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384
971  *      MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA
972  *      MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384
973  *      MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256
974  *      MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA
975  *      MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256
976  *      MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA
977  *      MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA
978  */
979 #define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED
980 
981 /**
982  * \def MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
983  *
984  * Enable the RSA-PSK based ciphersuite modes in SSL / TLS.
985  *
986  * Requires: MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15,
987  *           MBEDTLS_X509_CRT_PARSE_C
988  *
989  * This enables the following ciphersuites (if other requisites are
990  * enabled as well):
991  *      MBEDTLS_TLS_RSA_PSK_WITH_AES_256_GCM_SHA384
992  *      MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA384
993  *      MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA
994  *      MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384
995  *      MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384
996  *      MBEDTLS_TLS_RSA_PSK_WITH_AES_128_GCM_SHA256
997  *      MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA256
998  *      MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA
999  *      MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256
1000  *      MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256
1001  *      MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA
1002  *      MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA
1003  */
1004 #define MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
1005 
1006 /**
1007  * \def MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
1008  *
1009  * Enable the RSA-only based ciphersuite modes in SSL / TLS.
1010  *
1011  * Requires: MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15,
1012  *           MBEDTLS_X509_CRT_PARSE_C
1013  *
1014  * This enables the following ciphersuites (if other requisites are
1015  * enabled as well):
1016  *      MBEDTLS_TLS_RSA_WITH_AES_256_GCM_SHA384
1017  *      MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA256
1018  *      MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA
1019  *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384
1020  *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256
1021  *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA
1022  *      MBEDTLS_TLS_RSA_WITH_AES_128_GCM_SHA256
1023  *      MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA256
1024  *      MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA
1025  *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256
1026  *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256
1027  *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA
1028  *      MBEDTLS_TLS_RSA_WITH_3DES_EDE_CBC_SHA
1029  *      MBEDTLS_TLS_RSA_WITH_RC4_128_SHA
1030  *      MBEDTLS_TLS_RSA_WITH_RC4_128_MD5
1031  */
1032 #define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
1033 
1034 /**
1035  * \def MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED
1036  *
1037  * Enable the DHE-RSA based ciphersuite modes in SSL / TLS.
1038  *
1039  * Requires: MBEDTLS_DHM_C, MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15,
1040  *           MBEDTLS_X509_CRT_PARSE_C
1041  *
1042  * This enables the following ciphersuites (if other requisites are
1043  * enabled as well):
1044  *      MBEDTLS_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
1045  *      MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
1046  *      MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA
1047  *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384
1048  *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256
1049  *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA
1050  *      MBEDTLS_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
1051  *      MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
1052  *      MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA
1053  *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256
1054  *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256
1055  *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA
1056  *      MBEDTLS_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
1057  *
1058  * \warning    Using DHE constitutes a security risk as it
1059  *             is not possible to validate custom DH parameters.
1060  *             If possible, it is recommended users should consider
1061  *             preferring other methods of key exchange.
1062  *             See dhm.h for more details.
1063  *
1064  */
1065 #define MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED
1066 
1067 /**
1068  * \def MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
1069  *
1070  * Enable the ECDHE-RSA based ciphersuite modes in SSL / TLS.
1071  *
1072  * Requires: MBEDTLS_ECDH_C, MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15,
1073  *           MBEDTLS_X509_CRT_PARSE_C
1074  *
1075  * This enables the following ciphersuites (if other requisites are
1076  * enabled as well):
1077  *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
1078  *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
1079  *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
1080  *      MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384
1081  *      MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384
1082  *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
1083  *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
1084  *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
1085  *      MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256
1086  *      MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256
1087  *      MBEDTLS_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
1088  *      MBEDTLS_TLS_ECDHE_RSA_WITH_RC4_128_SHA
1089  */
1090 #define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
1091 
1092 /**
1093  * \def MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
1094  *
1095  * Enable the ECDHE-ECDSA based ciphersuite modes in SSL / TLS.
1096  *
1097  * Requires: MBEDTLS_ECDH_C, MBEDTLS_ECDSA_C, MBEDTLS_X509_CRT_PARSE_C,
1098  *
1099  * This enables the following ciphersuites (if other requisites are
1100  * enabled as well):
1101  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
1102  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
1103  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
1104  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
1105  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384
1106  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
1107  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
1108  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
1109  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
1110  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256
1111  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA
1112  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA
1113  */
1114 #define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
1115 
1116 /**
1117  * \def MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
1118  *
1119  * Enable the ECDH-ECDSA based ciphersuite modes in SSL / TLS.
1120  *
1121  * Requires: MBEDTLS_ECDH_C, MBEDTLS_ECDSA_C, MBEDTLS_X509_CRT_PARSE_C
1122  *
1123  * This enables the following ciphersuites (if other requisites are
1124  * enabled as well):
1125  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_RC4_128_SHA
1126  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA
1127  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
1128  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
1129  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256
1130  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384
1131  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
1132  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384
1133  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256
1134  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384
1135  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
1136  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
1137  */
1138 #define MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
1139 
1140 /**
1141  * \def MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
1142  *
1143  * Enable the ECDH-RSA based ciphersuite modes in SSL / TLS.
1144  *
1145  * Requires: MBEDTLS_ECDH_C, MBEDTLS_RSA_C, MBEDTLS_X509_CRT_PARSE_C
1146  *
1147  * This enables the following ciphersuites (if other requisites are
1148  * enabled as well):
1149  *      MBEDTLS_TLS_ECDH_RSA_WITH_RC4_128_SHA
1150  *      MBEDTLS_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA
1151  *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
1152  *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
1153  *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256
1154  *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384
1155  *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256
1156  *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384
1157  *      MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256
1158  *      MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384
1159  *      MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256
1160  *      MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384
1161  */
1162 #define MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED
1163 
1164 /**
1165  * \def MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
1166  *
1167  * Enable the ECJPAKE based ciphersuite modes in SSL / TLS.
1168  *
1169  * \warning This is currently experimental. EC J-PAKE support is based on the
1170  * Thread v1.0.0 specification; incompatible changes to the specification
1171  * might still happen. For this reason, this is disabled by default.
1172  *
1173  * Requires: MBEDTLS_ECJPAKE_C
1174  *           MBEDTLS_SHA256_C
1175  *           MBEDTLS_ECP_DP_SECP256R1_ENABLED
1176  *
1177  * This enables the following ciphersuites (if other requisites are
1178  * enabled as well):
1179  *      MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8
1180  */
1181 //#define MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
1182 
1183 /**
1184  * \def MBEDTLS_PK_PARSE_EC_EXTENDED
1185  *
1186  * Enhance support for reading EC keys using variants of SEC1 not allowed by
1187  * RFC 5915 and RFC 5480.
1188  *
1189  * Currently this means parsing the SpecifiedECDomain choice of EC
1190  * parameters (only known groups are supported, not arbitrary domains, to
1191  * avoid validation issues).
1192  *
1193  * Disable if you only need to support RFC 5915 + 5480 key formats.
1194  */
1195 #define MBEDTLS_PK_PARSE_EC_EXTENDED
1196 
1197 /**
1198  * \def MBEDTLS_ERROR_STRERROR_DUMMY
1199  *
1200  * Enable a dummy error function to make use of mbedtls_strerror() in
1201  * third party libraries easier when MBEDTLS_ERROR_C is disabled
1202  * (no effect when MBEDTLS_ERROR_C is enabled).
1203  *
1204  * You can safely disable this if MBEDTLS_ERROR_C is enabled, or if you're
1205  * not using mbedtls_strerror() or error_strerror() in your application.
1206  *
1207  * Disable if you run into name conflicts and want to really remove the
1208  * mbedtls_strerror()
1209  */
1210 #define MBEDTLS_ERROR_STRERROR_DUMMY
1211 
1212 /**
1213  * \def MBEDTLS_GENPRIME
1214  *
1215  * Enable the prime-number generation code.
1216  *
1217  * Requires: MBEDTLS_BIGNUM_C
1218  */
1219 #define MBEDTLS_GENPRIME
1220 
1221 /**
1222  * \def MBEDTLS_FS_IO
1223  *
1224  * Enable functions that use the filesystem.
1225  */
1226 #define MBEDTLS_FS_IO
1227 
1228 /**
1229  * \def MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
1230  *
1231  * Do not add default entropy sources. These are the platform specific,
1232  * mbedtls_timing_hardclock and HAVEGE based poll functions.
1233  *
1234  * This is useful to have more control over the added entropy sources in an
1235  * application.
1236  *
1237  * Uncomment this macro to prevent loading of default entropy functions.
1238  */
1239 //#define MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
1240 
1241 /**
1242  * \def MBEDTLS_NO_PLATFORM_ENTROPY
1243  *
1244  * Do not use built-in platform entropy functions.
1245  * This is useful if your platform does not support
1246  * standards like the /dev/urandom or Windows CryptoAPI.
1247  *
1248  * Uncomment this macro to disable the built-in platform entropy functions.
1249  */
1250 //#define MBEDTLS_NO_PLATFORM_ENTROPY
1251 
1252 /**
1253  * \def MBEDTLS_ENTROPY_FORCE_SHA256
1254  *
1255  * Force the entropy accumulator to use a SHA-256 accumulator instead of the
1256  * default SHA-512 based one (if both are available).
1257  *
1258  * Requires: MBEDTLS_SHA256_C
1259  *
1260  * On 32-bit systems SHA-256 can be much faster than SHA-512. Use this option
1261  * if you have performance concerns.
1262  *
1263  * This option is only useful if both MBEDTLS_SHA256_C and
1264  * MBEDTLS_SHA512_C are defined. Otherwise the available hash module is used.
1265  */
1266 //#define MBEDTLS_ENTROPY_FORCE_SHA256
1267 
1268 /**
1269  * \def MBEDTLS_ENTROPY_NV_SEED
1270  *
1271  * Enable the non-volatile (NV) seed file-based entropy source.
1272  * (Also enables the NV seed read/write functions in the platform layer)
1273  *
1274  * This is crucial (if not required) on systems that do not have a
1275  * cryptographic entropy source (in hardware or kernel) available.
1276  *
1277  * Requires: MBEDTLS_ENTROPY_C, MBEDTLS_PLATFORM_C
1278  *
1279  * \note The read/write functions that are used by the entropy source are
1280  *       determined in the platform layer, and can be modified at runtime and/or
1281  *       compile-time depending on the flags (MBEDTLS_PLATFORM_NV_SEED_*) used.
1282  *
1283  * \note If you use the default implementation functions that read a seedfile
1284  *       with regular fopen(), please make sure you make a seedfile with the
1285  *       proper name (defined in MBEDTLS_PLATFORM_STD_NV_SEED_FILE) and at
1286  *       least MBEDTLS_ENTROPY_BLOCK_SIZE bytes in size that can be read from
1287  *       and written to or you will get an entropy source error! The default
1288  *       implementation will only use the first MBEDTLS_ENTROPY_BLOCK_SIZE
1289  *       bytes from the file.
1290  *
1291  * \note The entropy collector will write to the seed file before entropy is
1292  *       given to an external source, to update it.
1293  */
1294 //#define MBEDTLS_ENTROPY_NV_SEED
1295 
1296 /* MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
1297  *
1298  * Enable key identifiers that encode a key owner identifier.
1299  *
1300  * The owner of a key is identified by a value of type ::mbedtls_key_owner_id_t
1301  * which is currently hard-coded to be int32_t.
1302  *
1303  * Note that this option is meant for internal use only and may be removed
1304  * without notice. It is incompatible with MBEDTLS_USE_PSA_CRYPTO.
1305  */
1306 //#define MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
1307 
1308 /**
1309  * \def MBEDTLS_MEMORY_DEBUG
1310  *
1311  * Enable debugging of buffer allocator memory issues. Automatically prints
1312  * (to stderr) all (fatal) messages on memory allocation issues. Enables
1313  * function for 'debug output' of allocated memory.
1314  *
1315  * Requires: MBEDTLS_MEMORY_BUFFER_ALLOC_C
1316  *
1317  * Uncomment this macro to let the buffer allocator print out error messages.
1318  */
1319 //#define MBEDTLS_MEMORY_DEBUG
1320 
1321 /**
1322  * \def MBEDTLS_MEMORY_BACKTRACE
1323  *
1324  * Include backtrace information with each allocated block.
1325  *
1326  * Requires: MBEDTLS_MEMORY_BUFFER_ALLOC_C
1327  *           GLIBC-compatible backtrace() an backtrace_symbols() support
1328  *
1329  * Uncomment this macro to include backtrace information
1330  */
1331 //#define MBEDTLS_MEMORY_BACKTRACE
1332 
1333 /**
1334  * \def MBEDTLS_PK_RSA_ALT_SUPPORT
1335  *
1336  * Support external private RSA keys (eg from a HSM) in the PK layer.
1337  *
1338  * Comment this macro to disable support for external private RSA keys.
1339  */
1340 #define MBEDTLS_PK_RSA_ALT_SUPPORT
1341 
1342 /**
1343  * \def MBEDTLS_PKCS1_V15
1344  *
1345  * Enable support for PKCS#1 v1.5 encoding.
1346  *
1347  * Requires: MBEDTLS_RSA_C
1348  *
1349  * This enables support for PKCS#1 v1.5 operations.
1350  */
1351 #define MBEDTLS_PKCS1_V15
1352 
1353 /**
1354  * \def MBEDTLS_PKCS1_V21
1355  *
1356  * Enable support for PKCS#1 v2.1 encoding.
1357  *
1358  * Requires: MBEDTLS_MD_C, MBEDTLS_RSA_C
1359  *
1360  * This enables support for RSAES-OAEP and RSASSA-PSS operations.
1361  */
1362 #define MBEDTLS_PKCS1_V21
1363 
1364 /** \def MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS
1365  *
1366  * Enable support for platform built-in keys. If you enable this feature,
1367  * you must implement the function mbedtls_psa_platform_get_builtin_key().
1368  * See the documentation of that function for more information.
1369  *
1370  * Built-in keys are typically derived from a hardware unique key or
1371  * stored in a secure element.
1372  *
1373  * Requires: MBEDTLS_PSA_CRYPTO_C.
1374  *
1375  * \warning This interface is experimental and may change or be removed
1376  * without notice.
1377  */
1378 //#define MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS
1379 
1380 /** \def MBEDTLS_PSA_CRYPTO_CLIENT
1381  *
1382  * Enable support for PSA crypto client.
1383  *
1384  * \note This option allows to include the code necessary for a PSA
1385  *       crypto client when the PSA crypto implementation is not included in
1386  *       the library (MBEDTLS_PSA_CRYPTO_C disabled). The code included is the
1387  *       code to set and get PSA key attributes.
1388  *       The development of PSA drivers partially relying on the library to
1389  *       fulfill the hardware gaps is another possible usage of this option.
1390  *
1391  * \warning This interface is experimental and may change or be removed
1392  * without notice.
1393  */
1394 //#define MBEDTLS_PSA_CRYPTO_CLIENT
1395 
1396 /** \def MBEDTLS_PSA_CRYPTO_DRIVERS
1397  *
1398  * Enable support for the experimental PSA crypto driver interface.
1399  *
1400  * Requires: MBEDTLS_PSA_CRYPTO_C
1401  *
1402  * \warning This interface is experimental and may change or be removed
1403  * without notice.
1404  */
1405 //#define MBEDTLS_PSA_CRYPTO_DRIVERS
1406 
1407 /** \def MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG
1408  *
1409  * Make the PSA Crypto module use an external random generator provided
1410  * by a driver, instead of Mbed TLS's entropy and DRBG modules.
1411  *
1412  * \note This random generator must deliver random numbers with cryptographic
1413  *       quality and high performance. It must supply unpredictable numbers
1414  *       with a uniform distribution. The implementation of this function
1415  *       is responsible for ensuring that the random generator is seeded
1416  *       with sufficient entropy. If you have a hardware TRNG which is slow
1417  *       or delivers non-uniform output, declare it as an entropy source
1418  *       with mbedtls_entropy_add_source() instead of enabling this option.
1419  *
1420  * If you enable this option, you must configure the type
1421  * ::mbedtls_psa_external_random_context_t in psa/crypto_platform.h
1422  * and define a function called mbedtls_psa_external_get_random()
1423  * with the following prototype:
1424  * ```
1425  * psa_status_t mbedtls_psa_external_get_random(
1426  *     mbedtls_psa_external_random_context_t *context,
1427  *     uint8_t *output, size_t output_size, size_t *output_length);
1428  * );
1429  * ```
1430  * The \c context value is initialized to 0 before the first call.
1431  * The function must fill the \c output buffer with \p output_size bytes
1432  * of random data and set \c *output_length to \p output_size.
1433  *
1434  * Requires: MBEDTLS_PSA_CRYPTO_C
1435  *
1436  * \warning If you enable this option, code that uses the PSA cryptography
1437  *          interface will not use any of the entropy sources set up for
1438  *          the entropy module, nor the NV seed that MBEDTLS_ENTROPY_NV_SEED
1439  *          enables.
1440  *
1441  * \note This option is experimental and may be removed without notice.
1442  */
1443 //#define MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG
1444 
1445 /**
1446  * \def MBEDTLS_PSA_CRYPTO_SPM
1447  *
1448  * When MBEDTLS_PSA_CRYPTO_SPM is defined, the code is built for SPM (Secure
1449  * Partition Manager) integration which separates the code into two parts: a
1450  * NSPE (Non-Secure Process Environment) and an SPE (Secure Process
1451  * Environment).
1452  *
1453  * Module:  library/psa_crypto.c
1454  * Requires: MBEDTLS_PSA_CRYPTO_C
1455  *
1456  */
1457 //#define MBEDTLS_PSA_CRYPTO_SPM
1458 
1459 /**
1460  * \def MBEDTLS_PSA_INJECT_ENTROPY
1461  *
1462  * Enable support for entropy injection at first boot. This feature is
1463  * required on systems that do not have a built-in entropy source (TRNG).
1464  * This feature is currently not supported on systems that have a built-in
1465  * entropy source.
1466  *
1467  * Requires: MBEDTLS_PSA_CRYPTO_STORAGE_C, MBEDTLS_ENTROPY_NV_SEED
1468  *
1469  */
1470 //#define MBEDTLS_PSA_INJECT_ENTROPY
1471 
1472 /**
1473  * \def MBEDTLS_RSA_NO_CRT
1474  *
1475  * Do not use the Chinese Remainder Theorem
1476  * for the RSA private operation.
1477  *
1478  * Uncomment this macro to disable the use of CRT in RSA.
1479  *
1480  */
1481 //#define MBEDTLS_RSA_NO_CRT
1482 
1483 /**
1484  * \def MBEDTLS_SELF_TEST
1485  *
1486  * Enable the checkup functions (*_self_test).
1487  */
1488 #define MBEDTLS_SELF_TEST
1489 
1490 /**
1491  * \def MBEDTLS_SHA256_SMALLER
1492  *
1493  * Enable an implementation of SHA-256 that has lower ROM footprint but also
1494  * lower performance.
1495  *
1496  * The default implementation is meant to be a reasonnable compromise between
1497  * performance and size. This version optimizes more aggressively for size at
1498  * the expense of performance. Eg on Cortex-M4 it reduces the size of
1499  * mbedtls_sha256_process() from ~2KB to ~0.5KB for a performance hit of about
1500  * 30%.
1501  *
1502  * Uncomment to enable the smaller implementation of SHA256.
1503  */
1504 //#define MBEDTLS_SHA256_SMALLER
1505 
1506 /**
1507  * \def MBEDTLS_SHA512_SMALLER
1508  *
1509  * Enable an implementation of SHA-512 that has lower ROM footprint but also
1510  * lower performance.
1511  *
1512  * Uncomment to enable the smaller implementation of SHA512.
1513  */
1514 //#define MBEDTLS_SHA512_SMALLER
1515 
1516 /**
1517  * \def MBEDTLS_SHA512_NO_SHA384
1518  *
1519  * Disable the SHA-384 option of the SHA-512 module. Use this to save some
1520  * code size on devices that don't use SHA-384.
1521  *
1522  * Requires: MBEDTLS_SHA512_C
1523  *
1524  * Uncomment to disable SHA-384
1525  */
1526 //#define MBEDTLS_SHA512_NO_SHA384
1527 
1528 /**
1529  * \def MBEDTLS_SSL_ALL_ALERT_MESSAGES
1530  *
1531  * Enable sending of alert messages in case of encountered errors as per RFC.
1532  * If you choose not to send the alert messages, mbed TLS can still communicate
1533  * with other servers, only debugging of failures is harder.
1534  *
1535  * The advantage of not sending alert messages, is that no information is given
1536  * about reasons for failures thus preventing adversaries of gaining intel.
1537  *
1538  * Enable sending of all alert messages
1539  */
1540 #define MBEDTLS_SSL_ALL_ALERT_MESSAGES
1541 
1542 /**
1543  * \def MBEDTLS_SSL_RECORD_CHECKING
1544  *
1545  * Enable the function mbedtls_ssl_check_record() which can be used to check
1546  * the validity and authenticity of an incoming record, to verify that it has
1547  * not been seen before. These checks are performed without modifying the
1548  * externally visible state of the SSL context.
1549  *
1550  * See mbedtls_ssl_check_record() for more information.
1551  *
1552  * Uncomment to enable support for record checking.
1553  */
1554 #define MBEDTLS_SSL_RECORD_CHECKING
1555 
1556 /**
1557  * \def MBEDTLS_SSL_DTLS_CONNECTION_ID
1558  *
1559  * Enable support for the DTLS Connection ID extension
1560  * (version draft-ietf-tls-dtls-connection-id-05,
1561  * https://tools.ietf.org/html/draft-ietf-tls-dtls-connection-id-05)
1562  * which allows to identify DTLS connections across changes
1563  * in the underlying transport.
1564  *
1565  * Setting this option enables the SSL APIs `mbedtls_ssl_set_cid()`,
1566  * `mbedtls_ssl_get_peer_cid()` and `mbedtls_ssl_conf_cid()`.
1567  * See the corresponding documentation for more information.
1568  *
1569  * \warning The Connection ID extension is still in draft state.
1570  *          We make no stability promises for the availability
1571  *          or the shape of the API controlled by this option.
1572  *
1573  * The maximum lengths of outgoing and incoming CIDs can be configured
1574  * through the options
1575  * - MBEDTLS_SSL_CID_OUT_LEN_MAX
1576  * - MBEDTLS_SSL_CID_IN_LEN_MAX.
1577  *
1578  * Requires: MBEDTLS_SSL_PROTO_DTLS
1579  *
1580  * Uncomment to enable the Connection ID extension.
1581  */
1582 //#define MBEDTLS_SSL_DTLS_CONNECTION_ID
1583 
1584 /**
1585  * \def MBEDTLS_SSL_ASYNC_PRIVATE
1586  *
1587  * Enable asynchronous external private key operations in SSL. This allows
1588  * you to configure an SSL connection to call an external cryptographic
1589  * module to perform private key operations instead of performing the
1590  * operation inside the library.
1591  *
1592  */
1593 //#define MBEDTLS_SSL_ASYNC_PRIVATE
1594 
1595 /**
1596  * \def MBEDTLS_SSL_CONTEXT_SERIALIZATION
1597  *
1598  * Enable serialization of the TLS context structures, through use of the
1599  * functions mbedtls_ssl_context_save() and mbedtls_ssl_context_load().
1600  *
1601  * This pair of functions allows one side of a connection to serialize the
1602  * context associated with the connection, then free or re-use that context
1603  * while the serialized state is persisted elsewhere, and finally deserialize
1604  * that state to a live context for resuming read/write operations on the
1605  * connection. From a protocol perspective, the state of the connection is
1606  * unaffected, in particular this is entirely transparent to the peer.
1607  *
1608  * Note: this is distinct from TLS session resumption, which is part of the
1609  * protocol and fully visible by the peer. TLS session resumption enables
1610  * establishing new connections associated to a saved session with shorter,
1611  * lighter handshakes, while context serialization is a local optimization in
1612  * handling a single, potentially long-lived connection.
1613  *
1614  * Enabling these APIs makes some SSL structures larger, as 64 extra bytes are
1615  * saved after the handshake to allow for more efficient serialization, so if
1616  * you don't need this feature you'll save RAM by disabling it.
1617  *
1618  * Comment to disable the context serialization APIs.
1619  */
1620 #define MBEDTLS_SSL_CONTEXT_SERIALIZATION
1621 
1622 /**
1623  * \def MBEDTLS_SSL_DEBUG_ALL
1624  *
1625  * Enable the debug messages in SSL module for all issues.
1626  * Debug messages have been disabled in some places to prevent timing
1627  * attacks due to (unbalanced) debugging function calls.
1628  *
1629  * If you need all error reporting you should enable this during debugging,
1630  * but remove this for production servers that should log as well.
1631  *
1632  * Uncomment this macro to report all debug messages on errors introducing
1633  * a timing side-channel.
1634  *
1635  */
1636 //#define MBEDTLS_SSL_DEBUG_ALL
1637 
1638 /** \def MBEDTLS_SSL_ENCRYPT_THEN_MAC
1639  *
1640  * Enable support for Encrypt-then-MAC, RFC 7366.
1641  *
1642  * This allows peers that both support it to use a more robust protection for
1643  * ciphersuites using CBC, providing deep resistance against timing attacks
1644  * on the padding or underlying cipher.
1645  *
1646  * This only affects CBC ciphersuites, and is useless if none is defined.
1647  *
1648  * Requires: MBEDTLS_SSL_PROTO_TLS1    or
1649  *           MBEDTLS_SSL_PROTO_TLS1_1  or
1650  *           MBEDTLS_SSL_PROTO_TLS1_2
1651  *
1652  * Comment this macro to disable support for Encrypt-then-MAC
1653  */
1654 #define MBEDTLS_SSL_ENCRYPT_THEN_MAC
1655 
1656 /** \def MBEDTLS_SSL_EXTENDED_MASTER_SECRET
1657  *
1658  * Enable support for RFC 7627: Session Hash and Extended Master Secret
1659  * Extension.
1660  *
1661  * This was introduced as "the proper fix" to the Triple Handshake familiy of
1662  * attacks, but it is recommended to always use it (even if you disable
1663  * renegotiation), since it actually fixes a more fundamental issue in the
1664  * original SSL/TLS design, and has implications beyond Triple Handshake.
1665  *
1666  * Requires: MBEDTLS_SSL_PROTO_TLS1    or
1667  *           MBEDTLS_SSL_PROTO_TLS1_1  or
1668  *           MBEDTLS_SSL_PROTO_TLS1_2
1669  *
1670  * Comment this macro to disable support for Extended Master Secret.
1671  */
1672 #define MBEDTLS_SSL_EXTENDED_MASTER_SECRET
1673 
1674 /**
1675  * \def MBEDTLS_SSL_FALLBACK_SCSV
1676  *
1677  * Enable support for RFC 7507: Fallback Signaling Cipher Suite Value (SCSV)
1678  * for Preventing Protocol Downgrade Attacks.
1679  *
1680  * For servers, it is recommended to always enable this, unless you support
1681  * only one version of TLS, or know for sure that none of your clients
1682  * implements a fallback strategy.
1683  *
1684  * For clients, you only need this if you're using a fallback strategy, which
1685  * is not recommended in the first place, unless you absolutely need it to
1686  * interoperate with buggy (version-intolerant) servers.
1687  *
1688  * Comment this macro to disable support for FALLBACK_SCSV
1689  */
1690 #define MBEDTLS_SSL_FALLBACK_SCSV
1691 
1692 /**
1693  * \def MBEDTLS_SSL_KEEP_PEER_CERTIFICATE
1694  *
1695  * This option controls the availability of the API mbedtls_ssl_get_peer_cert()
1696  * giving access to the peer's certificate after completion of the handshake.
1697  *
1698  * Unless you need mbedtls_ssl_peer_cert() in your application, it is
1699  * recommended to disable this option for reduced RAM usage.
1700  *
1701  * \note If this option is disabled, mbedtls_ssl_get_peer_cert() is still
1702  *       defined, but always returns \c NULL.
1703  *
1704  * \note This option has no influence on the protection against the
1705  *       triple handshake attack. Even if it is disabled, Mbed TLS will
1706  *       still ensure that certificates do not change during renegotiation,
1707  *       for exaple by keeping a hash of the peer's certificate.
1708  *
1709  * Comment this macro to disable storing the peer's certificate
1710  * after the handshake.
1711  */
1712 #define MBEDTLS_SSL_KEEP_PEER_CERTIFICATE
1713 
1714 /**
1715  * \def MBEDTLS_SSL_HW_RECORD_ACCEL
1716  *
1717  * Enable hooking functions in SSL module for hardware acceleration of
1718  * individual records.
1719  *
1720  * \deprecated This option is deprecated and will be removed in a future
1721  *             version of Mbed TLS.
1722  *
1723  * Uncomment this macro to enable hooking functions.
1724  */
1725 //#define MBEDTLS_SSL_HW_RECORD_ACCEL
1726 
1727 /**
1728  * \def MBEDTLS_SSL_CBC_RECORD_SPLITTING
1729  *
1730  * Enable 1/n-1 record splitting for CBC mode in SSLv3 and TLS 1.0.
1731  *
1732  * This is a countermeasure to the BEAST attack, which also minimizes the risk
1733  * of interoperability issues compared to sending 0-length records.
1734  *
1735  * Comment this macro to disable 1/n-1 record splitting.
1736  */
1737 #define MBEDTLS_SSL_CBC_RECORD_SPLITTING
1738 
1739 /**
1740  * \def MBEDTLS_SSL_RENEGOTIATION
1741  *
1742  * Enable support for TLS renegotiation.
1743  *
1744  * The two main uses of renegotiation are (1) refresh keys on long-lived
1745  * connections and (2) client authentication after the initial handshake.
1746  * If you don't need renegotiation, it's probably better to disable it, since
1747  * it has been associated with security issues in the past and is easy to
1748  * misuse/misunderstand.
1749  *
1750  * Comment this to disable support for renegotiation.
1751  *
1752  * \note   Even if this option is disabled, both client and server are aware
1753  *         of the Renegotiation Indication Extension (RFC 5746) used to
1754  *         prevent the SSL renegotiation attack (see RFC 5746 Sect. 1).
1755  *         (See \c mbedtls_ssl_conf_legacy_renegotiation for the
1756  *          configuration of this extension).
1757  *
1758  */
1759 #define MBEDTLS_SSL_RENEGOTIATION
1760 
1761 /**
1762  * \def MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO
1763  *
1764  * Enable support for receiving and parsing SSLv2 Client Hello messages for the
1765  * SSL Server module (MBEDTLS_SSL_SRV_C).
1766  *
1767  * \deprecated This option is deprecated and will be removed in a future
1768  *             version of Mbed TLS.
1769  *
1770  * Uncomment this macro to enable support for SSLv2 Client Hello messages.
1771  */
1772 //#define MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO
1773 
1774 /**
1775  * \def MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE
1776  *
1777  * Pick the ciphersuite according to the client's preferences rather than ours
1778  * in the SSL Server module (MBEDTLS_SSL_SRV_C).
1779  *
1780  * Uncomment this macro to respect client's ciphersuite order
1781  */
1782 //#define MBEDTLS_SSL_SRV_RESPECT_CLIENT_PREFERENCE
1783 
1784 /**
1785  * \def MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
1786  *
1787  * Enable support for RFC 6066 max_fragment_length extension in SSL.
1788  *
1789  * Comment this macro to disable support for the max_fragment_length extension
1790  */
1791 #define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
1792 
1793 /**
1794  * \def MBEDTLS_SSL_PROTO_SSL3
1795  *
1796  * Enable support for SSL 3.0.
1797  *
1798  * Requires: MBEDTLS_MD5_C
1799  *           MBEDTLS_SHA1_C
1800  *
1801  * \deprecated This option is deprecated and will be removed in a future
1802  *             version of Mbed TLS.
1803  *
1804  * Comment this macro to disable support for SSL 3.0
1805  */
1806 //#define MBEDTLS_SSL_PROTO_SSL3
1807 
1808 /**
1809  * \def MBEDTLS_SSL_PROTO_TLS1
1810  *
1811  * Enable support for TLS 1.0.
1812  *
1813  * Requires: MBEDTLS_MD5_C
1814  *           MBEDTLS_SHA1_C
1815  *
1816  * Comment this macro to disable support for TLS 1.0
1817  */
1818 #define MBEDTLS_SSL_PROTO_TLS1
1819 
1820 /**
1821  * \def MBEDTLS_SSL_PROTO_TLS1_1
1822  *
1823  * Enable support for TLS 1.1 (and DTLS 1.0 if DTLS is enabled).
1824  *
1825  * Requires: MBEDTLS_MD5_C
1826  *           MBEDTLS_SHA1_C
1827  *
1828  * Comment this macro to disable support for TLS 1.1 / DTLS 1.0
1829  */
1830 #define MBEDTLS_SSL_PROTO_TLS1_1
1831 
1832 /**
1833  * \def MBEDTLS_SSL_PROTO_TLS1_2
1834  *
1835  * Enable support for TLS 1.2 (and DTLS 1.2 if DTLS is enabled).
1836  *
1837  * Requires: MBEDTLS_SHA1_C or MBEDTLS_SHA256_C or MBEDTLS_SHA512_C
1838  *           (Depends on ciphersuites)
1839  *
1840  * Comment this macro to disable support for TLS 1.2 / DTLS 1.2
1841  */
1842 #define MBEDTLS_SSL_PROTO_TLS1_2
1843 
1844 /**
1845  * \def MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL
1846  *
1847  * This macro is used to selectively enable experimental parts
1848  * of the code that contribute to the ongoing development of
1849  * the prototype TLS 1.3 and DTLS 1.3 implementation, and provide
1850  * no other purpose.
1851  *
1852  * \warning TLS 1.3 and DTLS 1.3 aren't yet supported in Mbed TLS,
1853  *          and no feature exposed through this macro is part of the
1854  *          public API. In particular, features under the control
1855  *          of this macro are experimental and don't come with any
1856  *          stability guarantees.
1857  *
1858  * Uncomment this macro to enable experimental and partial
1859  * functionality specific to TLS 1.3.
1860  */
1861 //#define MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL
1862 
1863 /**
1864  * \def MBEDTLS_SSL_PROTO_DTLS
1865  *
1866  * Enable support for DTLS (all available versions).
1867  *
1868  * Enable this and MBEDTLS_SSL_PROTO_TLS1_1 to enable DTLS 1.0,
1869  * and/or this and MBEDTLS_SSL_PROTO_TLS1_2 to enable DTLS 1.2.
1870  *
1871  * Requires: MBEDTLS_SSL_PROTO_TLS1_1
1872  *        or MBEDTLS_SSL_PROTO_TLS1_2
1873  *
1874  * Comment this macro to disable support for DTLS
1875  */
1876 #define MBEDTLS_SSL_PROTO_DTLS
1877 
1878 /**
1879  * \def MBEDTLS_SSL_ALPN
1880  *
1881  * Enable support for RFC 7301 Application Layer Protocol Negotiation.
1882  *
1883  * Comment this macro to disable support for ALPN.
1884  */
1885 #define MBEDTLS_SSL_ALPN
1886 
1887 /**
1888  * \def MBEDTLS_SSL_DTLS_ANTI_REPLAY
1889  *
1890  * Enable support for the anti-replay mechanism in DTLS.
1891  *
1892  * Requires: MBEDTLS_SSL_TLS_C
1893  *           MBEDTLS_SSL_PROTO_DTLS
1894  *
1895  * \warning Disabling this is often a security risk!
1896  * See mbedtls_ssl_conf_dtls_anti_replay() for details.
1897  *
1898  * Comment this to disable anti-replay in DTLS.
1899  */
1900 #define MBEDTLS_SSL_DTLS_ANTI_REPLAY
1901 
1902 /**
1903  * \def MBEDTLS_SSL_DTLS_HELLO_VERIFY
1904  *
1905  * Enable support for HelloVerifyRequest on DTLS servers.
1906  *
1907  * This feature is highly recommended to prevent DTLS servers being used as
1908  * amplifiers in DoS attacks against other hosts. It should always be enabled
1909  * unless you know for sure amplification cannot be a problem in the
1910  * environment in which your server operates.
1911  *
1912  * \warning Disabling this can ba a security risk! (see above)
1913  *
1914  * Requires: MBEDTLS_SSL_PROTO_DTLS
1915  *
1916  * Comment this to disable support for HelloVerifyRequest.
1917  */
1918 #define MBEDTLS_SSL_DTLS_HELLO_VERIFY
1919 
1920 /**
1921  * \def MBEDTLS_SSL_DTLS_SRTP
1922  *
1923  * Enable support for negotiation of DTLS-SRTP (RFC 5764)
1924  * through the use_srtp extension.
1925  *
1926  * \note This feature provides the minimum functionality required
1927  * to negotiate the use of DTLS-SRTP and to allow the derivation of
1928  * the associated SRTP packet protection key material.
1929  * In particular, the SRTP packet protection itself, as well as the
1930  * demultiplexing of RTP and DTLS packets at the datagram layer
1931  * (see Section 5 of RFC 5764), are not handled by this feature.
1932  * Instead, after successful completion of a handshake negotiating
1933  * the use of DTLS-SRTP, the extended key exporter API
1934  * mbedtls_ssl_conf_export_keys_ext_cb() should be used to implement
1935  * the key exporter described in Section 4.2 of RFC 5764 and RFC 5705
1936  * (this is implemented in the SSL example programs).
1937  * The resulting key should then be passed to an SRTP stack.
1938  *
1939  * Setting this option enables the runtime API
1940  * mbedtls_ssl_conf_dtls_srtp_protection_profiles()
1941  * through which the supported DTLS-SRTP protection
1942  * profiles can be configured. You must call this API at
1943  * runtime if you wish to negotiate the use of DTLS-SRTP.
1944  *
1945  * Requires: MBEDTLS_SSL_PROTO_DTLS
1946  *
1947  * Uncomment this to enable support for use_srtp extension.
1948  */
1949 //#define MBEDTLS_SSL_DTLS_SRTP
1950 
1951 /**
1952  * \def MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE
1953  *
1954  * Enable server-side support for clients that reconnect from the same port.
1955  *
1956  * Some clients unexpectedly close the connection and try to reconnect using the
1957  * same source port. This needs special support from the server to handle the
1958  * new connection securely, as described in section 4.2.8 of RFC 6347. This
1959  * flag enables that support.
1960  *
1961  * Requires: MBEDTLS_SSL_DTLS_HELLO_VERIFY
1962  *
1963  * Comment this to disable support for clients reusing the source port.
1964  */
1965 #define MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE
1966 
1967 /**
1968  * \def MBEDTLS_SSL_DTLS_BADMAC_LIMIT
1969  *
1970  * Enable support for a limit of records with bad MAC.
1971  *
1972  * See mbedtls_ssl_conf_dtls_badmac_limit().
1973  *
1974  * Requires: MBEDTLS_SSL_PROTO_DTLS
1975  */
1976 #define MBEDTLS_SSL_DTLS_BADMAC_LIMIT
1977 
1978 /**
1979  * \def MBEDTLS_SSL_SESSION_TICKETS
1980  *
1981  * Enable support for RFC 5077 session tickets in SSL.
1982  * Client-side, provides full support for session tickets (maintenance of a
1983  * session store remains the responsibility of the application, though).
1984  * Server-side, you also need to provide callbacks for writing and parsing
1985  * tickets, including authenticated encryption and key management. Example
1986  * callbacks are provided by MBEDTLS_SSL_TICKET_C.
1987  *
1988  * Comment this macro to disable support for SSL session tickets
1989  */
1990 #define MBEDTLS_SSL_SESSION_TICKETS
1991 
1992 /**
1993  * \def MBEDTLS_SSL_EXPORT_KEYS
1994  *
1995  * Enable support for exporting key block and master secret.
1996  * This is required for certain users of TLS, e.g. EAP-TLS.
1997  *
1998  * Comment this macro to disable support for key export
1999  */
2000 #define MBEDTLS_SSL_EXPORT_KEYS
2001 
2002 /**
2003  * \def MBEDTLS_SSL_SERVER_NAME_INDICATION
2004  *
2005  * Enable support for RFC 6066 server name indication (SNI) in SSL.
2006  *
2007  * Requires: MBEDTLS_X509_CRT_PARSE_C
2008  *
2009  * Comment this macro to disable support for server name indication in SSL
2010  */
2011 #define MBEDTLS_SSL_SERVER_NAME_INDICATION
2012 
2013 /**
2014  * \def MBEDTLS_SSL_TRUNCATED_HMAC
2015  *
2016  * Enable support for RFC 6066 truncated HMAC in SSL.
2017  *
2018  * Comment this macro to disable support for truncated HMAC in SSL
2019  */
2020 #define MBEDTLS_SSL_TRUNCATED_HMAC
2021 
2022 /**
2023  * \def MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT
2024  *
2025  * Fallback to old (pre-2.7), non-conforming implementation of the truncated
2026  * HMAC extension which also truncates the HMAC key. Note that this option is
2027  * only meant for a transitory upgrade period and will be removed in a future
2028  * version of the library.
2029  *
2030  * \warning The old implementation is non-compliant and has a security weakness
2031  *          (2^80 brute force attack on the HMAC key used for a single,
2032  *          uninterrupted connection). This should only be enabled temporarily
2033  *          when (1) the use of truncated HMAC is essential in order to save
2034  *          bandwidth, and (2) the peer is an Mbed TLS stack that doesn't use
2035  *          the fixed implementation yet (pre-2.7).
2036  *
2037  * \deprecated This option is deprecated and will be removed in a
2038  *             future version of Mbed TLS.
2039  *
2040  * Uncomment to fallback to old, non-compliant truncated HMAC implementation.
2041  *
2042  * Requires: MBEDTLS_SSL_TRUNCATED_HMAC
2043  */
2044 //#define MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT
2045 
2046 /**
2047  * \def MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH
2048  *
2049  * When this option is enabled, the SSL buffer will be resized automatically
2050  * based on the negotiated maximum fragment length in each direction.
2051  *
2052  * Requires: MBEDTLS_SSL_MAX_FRAGMENT_LENGTH
2053  */
2054 //#define MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH
2055 
2056 /**
2057  * \def MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN
2058  *
2059  * Enable testing of the constant-flow nature of some sensitive functions with
2060  * clang's MemorySanitizer. This causes some existing tests to also test
2061  * this non-functional property of the code under test.
2062  *
2063  * This setting requires compiling with clang -fsanitize=memory. The test
2064  * suites can then be run normally.
2065  *
2066  * \warning This macro is only used for extended testing; it is not considered
2067  * part of the library's API, so it may change or disappear at any time.
2068  *
2069  * Uncomment to enable testing of the constant-flow nature of selected code.
2070  */
2071 //#define MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN
2072 
2073 /**
2074  * \def MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND
2075  *
2076  * Enable testing of the constant-flow nature of some sensitive functions with
2077  * valgrind's memcheck tool. This causes some existing tests to also test
2078  * this non-functional property of the code under test.
2079  *
2080  * This setting requires valgrind headers for building, and is only useful for
2081  * testing if the tests suites are run with valgrind's memcheck. This can be
2082  * done for an individual test suite with 'valgrind ./test_suite_xxx', or when
2083  * using CMake, this can be done for all test suites with 'make memcheck'.
2084  *
2085  * \warning This macro is only used for extended testing; it is not considered
2086  * part of the library's API, so it may change or disappear at any time.
2087  *
2088  * Uncomment to enable testing of the constant-flow nature of selected code.
2089  */
2090 //#define MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND
2091 
2092 /**
2093  * \def MBEDTLS_TEST_HOOKS
2094  *
2095  * Enable features for invasive testing such as introspection functions and
2096  * hooks for fault injection. This enables additional unit tests.
2097  *
2098  * Merely enabling this feature should not change the behavior of the product.
2099  * It only adds new code, and new branching points where the default behavior
2100  * is the same as when this feature is disabled.
2101  * However, this feature increases the attack surface: there is an added
2102  * risk of vulnerabilities, and more gadgets that can make exploits easier.
2103  * Therefore this feature must never be enabled in production.
2104  *
2105  * See `docs/architecture/testing/mbed-crypto-invasive-testing.md` for more
2106  * information.
2107  *
2108  * Uncomment to enable invasive tests.
2109  */
2110 //#define MBEDTLS_TEST_HOOKS
2111 
2112 /**
2113  * \def MBEDTLS_THREADING_ALT
2114  *
2115  * Provide your own alternate threading implementation.
2116  *
2117  * Requires: MBEDTLS_THREADING_C
2118  *
2119  * Uncomment this to allow your own alternate threading implementation.
2120  */
2121 //#define MBEDTLS_THREADING_ALT
2122 
2123 /**
2124  * \def MBEDTLS_THREADING_PTHREAD
2125  *
2126  * Enable the pthread wrapper layer for the threading layer.
2127  *
2128  * Requires: MBEDTLS_THREADING_C
2129  *
2130  * Uncomment this to enable pthread mutexes.
2131  */
2132 //#define MBEDTLS_THREADING_PTHREAD
2133 
2134 /**
2135  * \def MBEDTLS_USE_PSA_CRYPTO
2136  *
2137  * Make the X.509 and TLS library use PSA for cryptographic operations, and
2138  * enable new APIs for using keys handled by PSA Crypto.
2139  *
2140  * \note Development of this option is currently in progress, and parts of Mbed
2141  * TLS's X.509 and TLS modules are not ported to PSA yet. However, these parts
2142  * will still continue to work as usual, so enabling this option should not
2143  * break backwards compatibility.
2144  *
2145  * \note See docs/use-psa-crypto.md for a complete description of what this
2146  * option currently does, and of parts that are not affected by it so far.
2147  *
2148  * \warning This option enables new Mbed TLS APIs which are currently
2149  * considered experimental and may change in incompatible ways at any time.
2150  * That is, the APIs enabled by this option are not covered by the usual
2151  * promises of API stability.
2152  *
2153  * Requires: MBEDTLS_PSA_CRYPTO_C.
2154  *
2155  * Uncomment this to enable internal use of PSA Crypto and new associated APIs.
2156  */
2157 //#define MBEDTLS_USE_PSA_CRYPTO
2158 
2159 /**
2160  * \def MBEDTLS_PSA_CRYPTO_CONFIG
2161  *
2162  * This setting allows support for cryptographic mechanisms through the PSA
2163  * API to be configured separately from support through the mbedtls API.
2164  *
2165  * Uncomment this to enable use of PSA Crypto configuration settings which
2166  * can be found in include/psa/crypto_config.h.
2167  *
2168  * If you enable this option and write your own configuration file, you must
2169  * include mbedtls/config_psa.h in your configuration file. The default
2170  * provided mbedtls/config.h contains the necessary inclusion.
2171  *
2172  * This feature is still experimental and is not ready for production since
2173  * it is not completed.
2174  */
2175 //#define MBEDTLS_PSA_CRYPTO_CONFIG
2176 
2177 /**
2178  * \def MBEDTLS_VERSION_FEATURES
2179  *
2180  * Allow run-time checking of compile-time enabled features. Thus allowing users
2181  * to check at run-time if the library is for instance compiled with threading
2182  * support via mbedtls_version_check_feature().
2183  *
2184  * Requires: MBEDTLS_VERSION_C
2185  *
2186  * Comment this to disable run-time checking and save ROM space
2187  */
2188 #define MBEDTLS_VERSION_FEATURES
2189 
2190 /**
2191  * \def MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3
2192  *
2193  * If set, the X509 parser will not break-off when parsing an X509 certificate
2194  * and encountering an extension in a v1 or v2 certificate.
2195  *
2196  * Uncomment to prevent an error.
2197  */
2198 //#define MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3
2199 
2200 /**
2201  * \def MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
2202  *
2203  * If set, the X509 parser will not break-off when parsing an X509 certificate
2204  * and encountering an unknown critical extension.
2205  *
2206  * \warning Depending on your PKI use, enabling this can be a security risk!
2207  *
2208  * Uncomment to prevent an error.
2209  */
2210 //#define MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION
2211 
2212 /**
2213  * \def MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
2214  *
2215  * If set, this enables the X.509 API `mbedtls_x509_crt_verify_with_ca_cb()`
2216  * and the SSL API `mbedtls_ssl_conf_ca_cb()` which allow users to configure
2217  * the set of trusted certificates through a callback instead of a linked
2218  * list.
2219  *
2220  * This is useful for example in environments where a large number of trusted
2221  * certificates is present and storing them in a linked list isn't efficient
2222  * enough, or when the set of trusted certificates changes frequently.
2223  *
2224  * See the documentation of `mbedtls_x509_crt_verify_with_ca_cb()` and
2225  * `mbedtls_ssl_conf_ca_cb()` for more information.
2226  *
2227  * Uncomment to enable trusted certificate callbacks.
2228  */
2229 //#define MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK
2230 
2231 /**
2232  * \def MBEDTLS_X509_CHECK_KEY_USAGE
2233  *
2234  * Enable verification of the keyUsage extension (CA and leaf certificates).
2235  *
2236  * Disabling this avoids problems with mis-issued and/or misused
2237  * (intermediate) CA and leaf certificates.
2238  *
2239  * \warning Depending on your PKI use, disabling this can be a security risk!
2240  *
2241  * Comment to skip keyUsage checking for both CA and leaf certificates.
2242  */
2243 #define MBEDTLS_X509_CHECK_KEY_USAGE
2244 
2245 /**
2246  * \def MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE
2247  *
2248  * Enable verification of the extendedKeyUsage extension (leaf certificates).
2249  *
2250  * Disabling this avoids problems with mis-issued and/or misused certificates.
2251  *
2252  * \warning Depending on your PKI use, disabling this can be a security risk!
2253  *
2254  * Comment to skip extendedKeyUsage checking for certificates.
2255  */
2256 #define MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE
2257 
2258 /**
2259  * \def MBEDTLS_X509_RSASSA_PSS_SUPPORT
2260  *
2261  * Enable parsing and verification of X.509 certificates, CRLs and CSRS
2262  * signed with RSASSA-PSS (aka PKCS#1 v2.1).
2263  *
2264  * Comment this macro to disallow using RSASSA-PSS in certificates.
2265  */
2266 #define MBEDTLS_X509_RSASSA_PSS_SUPPORT
2267 
2268 /**
2269  * \def MBEDTLS_ZLIB_SUPPORT
2270  *
2271  * If set, the SSL/TLS module uses ZLIB to support compression and
2272  * decompression of packet data.
2273  *
2274  * \warning TLS-level compression MAY REDUCE SECURITY! See for example the
2275  * CRIME attack. Before enabling this option, you should examine with care if
2276  * CRIME or similar exploits may be applicable to your use case.
2277  *
2278  * \note Currently compression can't be used with DTLS.
2279  *
2280  * \deprecated This feature is deprecated and will be removed
2281  *             in the next major revision of the library.
2282  *
2283  * Used in: library/ssl_tls.c
2284  *          library/ssl_cli.c
2285  *          library/ssl_srv.c
2286  *
2287  * This feature requires zlib library and headers to be present.
2288  *
2289  * Uncomment to enable use of ZLIB
2290  */
2291 //#define MBEDTLS_ZLIB_SUPPORT
2292 /* \} name SECTION: mbed TLS feature support */
2293 
2294 /**
2295  * \name SECTION: mbed TLS modules
2296  *
2297  * This section enables or disables entire modules in mbed TLS
2298  * \{
2299  */
2300 
2301 /**
2302  * \def MBEDTLS_AESNI_C
2303  *
2304  * Enable AES-NI support on x86-64.
2305  *
2306  * Module:  library/aesni.c
2307  * Caller:  library/aes.c
2308  *
2309  * Requires: MBEDTLS_HAVE_ASM
2310  *
2311  * This modules adds support for the AES-NI instructions on x86-64
2312  */
2313 #define MBEDTLS_AESNI_C
2314 
2315 /**
2316  * \def MBEDTLS_AES_C
2317  *
2318  * Enable the AES block cipher.
2319  *
2320  * Module:  library/aes.c
2321  * Caller:  library/cipher.c
2322  *          library/pem.c
2323  *          library/ctr_drbg.c
2324  *
2325  * This module enables the following ciphersuites (if other requisites are
2326  * enabled as well):
2327  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
2328  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA
2329  *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA
2330  *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA
2331  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256
2332  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384
2333  *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256
2334  *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384
2335  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
2336  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384
2337  *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256
2338  *      MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384
2339  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
2340  *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
2341  *      MBEDTLS_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
2342  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
2343  *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
2344  *      MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
2345  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
2346  *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
2347  *      MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA
2348  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
2349  *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
2350  *      MBEDTLS_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
2351  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
2352  *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
2353  *      MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
2354  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
2355  *      MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
2356  *      MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA
2357  *      MBEDTLS_TLS_DHE_PSK_WITH_AES_256_GCM_SHA384
2358  *      MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384
2359  *      MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA384
2360  *      MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA
2361  *      MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA
2362  *      MBEDTLS_TLS_DHE_PSK_WITH_AES_128_GCM_SHA256
2363  *      MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256
2364  *      MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA256
2365  *      MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA
2366  *      MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA
2367  *      MBEDTLS_TLS_RSA_WITH_AES_256_GCM_SHA384
2368  *      MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA256
2369  *      MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA
2370  *      MBEDTLS_TLS_RSA_WITH_AES_128_GCM_SHA256
2371  *      MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA256
2372  *      MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA
2373  *      MBEDTLS_TLS_RSA_PSK_WITH_AES_256_GCM_SHA384
2374  *      MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA384
2375  *      MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA
2376  *      MBEDTLS_TLS_RSA_PSK_WITH_AES_128_GCM_SHA256
2377  *      MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA256
2378  *      MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA
2379  *      MBEDTLS_TLS_PSK_WITH_AES_256_GCM_SHA384
2380  *      MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA384
2381  *      MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA
2382  *      MBEDTLS_TLS_PSK_WITH_AES_128_GCM_SHA256
2383  *      MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA256
2384  *      MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA
2385  *
2386  * PEM_PARSE uses AES for decrypting encrypted keys.
2387  */
2388 #define MBEDTLS_AES_C
2389 
2390 /**
2391  * \def MBEDTLS_ARC4_C
2392  *
2393  * Enable the ARCFOUR stream cipher.
2394  *
2395  * Module:  library/arc4.c
2396  * Caller:  library/cipher.c
2397  *
2398  * This module enables the following ciphersuites (if other requisites are
2399  * enabled as well):
2400  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_RC4_128_SHA
2401  *      MBEDTLS_TLS_ECDH_RSA_WITH_RC4_128_SHA
2402  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA
2403  *      MBEDTLS_TLS_ECDHE_RSA_WITH_RC4_128_SHA
2404  *      MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA
2405  *      MBEDTLS_TLS_DHE_PSK_WITH_RC4_128_SHA
2406  *      MBEDTLS_TLS_RSA_WITH_RC4_128_SHA
2407  *      MBEDTLS_TLS_RSA_WITH_RC4_128_MD5
2408  *      MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA
2409  *      MBEDTLS_TLS_PSK_WITH_RC4_128_SHA
2410  *
2411  * \warning   ARC4 is considered a weak cipher and its use constitutes a
2412  *            security risk. If possible, we recommend avoidng dependencies on
2413  *            it, and considering stronger ciphers instead.
2414  *
2415  */
2416 #define MBEDTLS_ARC4_C
2417 
2418 /**
2419  * \def MBEDTLS_ASN1_PARSE_C
2420  *
2421  * Enable the generic ASN1 parser.
2422  *
2423  * Module:  library/asn1.c
2424  * Caller:  library/x509.c
2425  *          library/dhm.c
2426  *          library/pkcs12.c
2427  *          library/pkcs5.c
2428  *          library/pkparse.c
2429  */
2430 #define MBEDTLS_ASN1_PARSE_C
2431 
2432 /**
2433  * \def MBEDTLS_ASN1_WRITE_C
2434  *
2435  * Enable the generic ASN1 writer.
2436  *
2437  * Module:  library/asn1write.c
2438  * Caller:  library/ecdsa.c
2439  *          library/pkwrite.c
2440  *          library/x509_create.c
2441  *          library/x509write_crt.c
2442  *          library/x509write_csr.c
2443  */
2444 #define MBEDTLS_ASN1_WRITE_C
2445 
2446 /**
2447  * \def MBEDTLS_BASE64_C
2448  *
2449  * Enable the Base64 module.
2450  *
2451  * Module:  library/base64.c
2452  * Caller:  library/pem.c
2453  *
2454  * This module is required for PEM support (required by X.509).
2455  */
2456 #define MBEDTLS_BASE64_C
2457 
2458 /**
2459  * \def MBEDTLS_BIGNUM_C
2460  *
2461  * Enable the multi-precision integer library.
2462  *
2463  * Module:  library/bignum.c
2464  * Caller:  library/dhm.c
2465  *          library/ecp.c
2466  *          library/ecdsa.c
2467  *          library/rsa.c
2468  *          library/rsa_internal.c
2469  *          library/ssl_tls.c
2470  *
2471  * This module is required for RSA, DHM and ECC (ECDH, ECDSA) support.
2472  */
2473 #define MBEDTLS_BIGNUM_C
2474 
2475 /**
2476  * \def MBEDTLS_BLOWFISH_C
2477  *
2478  * Enable the Blowfish block cipher.
2479  *
2480  * Module:  library/blowfish.c
2481  */
2482 #define MBEDTLS_BLOWFISH_C
2483 
2484 /**
2485  * \def MBEDTLS_CAMELLIA_C
2486  *
2487  * Enable the Camellia block cipher.
2488  *
2489  * Module:  library/camellia.c
2490  * Caller:  library/cipher.c
2491  *
2492  * This module enables the following ciphersuites (if other requisites are
2493  * enabled as well):
2494  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256
2495  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384
2496  *      MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256
2497  *      MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384
2498  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
2499  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
2500  *      MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256
2501  *      MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384
2502  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384
2503  *      MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384
2504  *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384
2505  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384
2506  *      MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384
2507  *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256
2508  *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA
2509  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256
2510  *      MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256
2511  *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256
2512  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256
2513  *      MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256
2514  *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256
2515  *      MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA
2516  *      MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384
2517  *      MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384
2518  *      MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384
2519  *      MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256
2520  *      MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256
2521  *      MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256
2522  *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384
2523  *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256
2524  *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA
2525  *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256
2526  *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256
2527  *      MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA
2528  *      MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384
2529  *      MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384
2530  *      MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256
2531  *      MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256
2532  *      MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384
2533  *      MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384
2534  *      MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256
2535  *      MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256
2536  */
2537 #define MBEDTLS_CAMELLIA_C
2538 
2539 /**
2540  * \def MBEDTLS_ARIA_C
2541  *
2542  * Enable the ARIA block cipher.
2543  *
2544  * Module:  library/aria.c
2545  * Caller:  library/cipher.c
2546  *
2547  * This module enables the following ciphersuites (if other requisites are
2548  * enabled as well):
2549  *
2550  *      MBEDTLS_TLS_RSA_WITH_ARIA_128_CBC_SHA256
2551  *      MBEDTLS_TLS_RSA_WITH_ARIA_256_CBC_SHA384
2552  *      MBEDTLS_TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256
2553  *      MBEDTLS_TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384
2554  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256
2555  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384
2556  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256
2557  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384
2558  *      MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256
2559  *      MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384
2560  *      MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256
2561  *      MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384
2562  *      MBEDTLS_TLS_RSA_WITH_ARIA_128_GCM_SHA256
2563  *      MBEDTLS_TLS_RSA_WITH_ARIA_256_GCM_SHA384
2564  *      MBEDTLS_TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256
2565  *      MBEDTLS_TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384
2566  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256
2567  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384
2568  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256
2569  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384
2570  *      MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256
2571  *      MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384
2572  *      MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256
2573  *      MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384
2574  *      MBEDTLS_TLS_PSK_WITH_ARIA_128_CBC_SHA256
2575  *      MBEDTLS_TLS_PSK_WITH_ARIA_256_CBC_SHA384
2576  *      MBEDTLS_TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256
2577  *      MBEDTLS_TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384
2578  *      MBEDTLS_TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256
2579  *      MBEDTLS_TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384
2580  *      MBEDTLS_TLS_PSK_WITH_ARIA_128_GCM_SHA256
2581  *      MBEDTLS_TLS_PSK_WITH_ARIA_256_GCM_SHA384
2582  *      MBEDTLS_TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256
2583  *      MBEDTLS_TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384
2584  *      MBEDTLS_TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256
2585  *      MBEDTLS_TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384
2586  *      MBEDTLS_TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256
2587  *      MBEDTLS_TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384
2588  */
2589 //#define MBEDTLS_ARIA_C
2590 
2591 /**
2592  * \def MBEDTLS_CCM_C
2593  *
2594  * Enable the Counter with CBC-MAC (CCM) mode for 128-bit block cipher.
2595  *
2596  * Module:  library/ccm.c
2597  *
2598  * Requires: MBEDTLS_AES_C or MBEDTLS_CAMELLIA_C
2599  *
2600  * This module enables the AES-CCM ciphersuites, if other requisites are
2601  * enabled as well.
2602  */
2603 #define MBEDTLS_CCM_C
2604 
2605 /**
2606  * \def MBEDTLS_CERTS_C
2607  *
2608  * Enable the test certificates.
2609  *
2610  * Module:  library/certs.c
2611  * Caller:
2612  *
2613  * This module is used for testing (ssl_client/server).
2614  */
2615 #define MBEDTLS_CERTS_C
2616 
2617 /**
2618  * \def MBEDTLS_CHACHA20_C
2619  *
2620  * Enable the ChaCha20 stream cipher.
2621  *
2622  * Module:  library/chacha20.c
2623  */
2624 #define MBEDTLS_CHACHA20_C
2625 
2626 /**
2627  * \def MBEDTLS_CHACHAPOLY_C
2628  *
2629  * Enable the ChaCha20-Poly1305 AEAD algorithm.
2630  *
2631  * Module:  library/chachapoly.c
2632  *
2633  * This module requires: MBEDTLS_CHACHA20_C, MBEDTLS_POLY1305_C
2634  */
2635 #define MBEDTLS_CHACHAPOLY_C
2636 
2637 /**
2638  * \def MBEDTLS_CIPHER_C
2639  *
2640  * Enable the generic cipher layer.
2641  *
2642  * Module:  library/cipher.c
2643  * Caller:  library/ssl_tls.c
2644  *
2645  * Uncomment to enable generic cipher wrappers.
2646  */
2647 #define MBEDTLS_CIPHER_C
2648 
2649 /**
2650  * \def MBEDTLS_CMAC_C
2651  *
2652  * Enable the CMAC (Cipher-based Message Authentication Code) mode for block
2653  * ciphers.
2654  *
2655  * \note When #MBEDTLS_CMAC_ALT is active, meaning that the underlying
2656  *       implementation of the CMAC algorithm is provided by an alternate
2657  *       implementation, that alternate implementation may opt to not support
2658  *       AES-192 or 3DES as underlying block ciphers for the CMAC operation.
2659  *
2660  * Module:  library/cmac.c
2661  *
2662  * Requires: MBEDTLS_AES_C or MBEDTLS_DES_C
2663  *
2664  */
2665 //#define MBEDTLS_CMAC_C
2666 
2667 /**
2668  * \def MBEDTLS_CTR_DRBG_C
2669  *
2670  * Enable the CTR_DRBG AES-based random generator.
2671  * The CTR_DRBG generator uses AES-256 by default.
2672  * To use AES-128 instead, enable \c MBEDTLS_CTR_DRBG_USE_128_BIT_KEY above.
2673  *
2674  * \note To achieve a 256-bit security strength with CTR_DRBG,
2675  *       you must use AES-256 *and* use sufficient entropy.
2676  *       See ctr_drbg.h for more details.
2677  *
2678  * Module:  library/ctr_drbg.c
2679  * Caller:
2680  *
2681  * Requires: MBEDTLS_AES_C
2682  *
2683  * This module provides the CTR_DRBG AES random number generator.
2684  */
2685 #define MBEDTLS_CTR_DRBG_C
2686 
2687 /**
2688  * \def MBEDTLS_DEBUG_C
2689  *
2690  * Enable the debug functions.
2691  *
2692  * Module:  library/debug.c
2693  * Caller:  library/ssl_cli.c
2694  *          library/ssl_srv.c
2695  *          library/ssl_tls.c
2696  *
2697  * This module provides debugging functions.
2698  */
2699 #define MBEDTLS_DEBUG_C
2700 
2701 /**
2702  * \def MBEDTLS_DES_C
2703  *
2704  * Enable the DES block cipher.
2705  *
2706  * Module:  library/des.c
2707  * Caller:  library/pem.c
2708  *          library/cipher.c
2709  *
2710  * This module enables the following ciphersuites (if other requisites are
2711  * enabled as well):
2712  *      MBEDTLS_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA
2713  *      MBEDTLS_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA
2714  *      MBEDTLS_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA
2715  *      MBEDTLS_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
2716  *      MBEDTLS_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
2717  *      MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA
2718  *      MBEDTLS_TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA
2719  *      MBEDTLS_TLS_RSA_WITH_3DES_EDE_CBC_SHA
2720  *      MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA
2721  *      MBEDTLS_TLS_PSK_WITH_3DES_EDE_CBC_SHA
2722  *
2723  * PEM_PARSE uses DES/3DES for decrypting encrypted keys.
2724  *
2725  * \warning   DES is considered a weak cipher and its use constitutes a
2726  *            security risk. We recommend considering stronger ciphers instead.
2727  */
2728 #define MBEDTLS_DES_C
2729 
2730 /**
2731  * \def MBEDTLS_DHM_C
2732  *
2733  * Enable the Diffie-Hellman-Merkle module.
2734  *
2735  * Module:  library/dhm.c
2736  * Caller:  library/ssl_cli.c
2737  *          library/ssl_srv.c
2738  *
2739  * This module is used by the following key exchanges:
2740  *      DHE-RSA, DHE-PSK
2741  *
2742  * \warning    Using DHE constitutes a security risk as it
2743  *             is not possible to validate custom DH parameters.
2744  *             If possible, it is recommended users should consider
2745  *             preferring other methods of key exchange.
2746  *             See dhm.h for more details.
2747  *
2748  */
2749 #define MBEDTLS_DHM_C
2750 
2751 /**
2752  * \def MBEDTLS_ECDH_C
2753  *
2754  * Enable the elliptic curve Diffie-Hellman library.
2755  *
2756  * Module:  library/ecdh.c
2757  * Caller:  library/ssl_cli.c
2758  *          library/ssl_srv.c
2759  *
2760  * This module is used by the following key exchanges:
2761  *      ECDHE-ECDSA, ECDHE-RSA, DHE-PSK
2762  *
2763  * Requires: MBEDTLS_ECP_C
2764  */
2765 #define MBEDTLS_ECDH_C
2766 
2767 /**
2768  * \def MBEDTLS_ECDSA_C
2769  *
2770  * Enable the elliptic curve DSA library.
2771  *
2772  * Module:  library/ecdsa.c
2773  * Caller:
2774  *
2775  * This module is used by the following key exchanges:
2776  *      ECDHE-ECDSA
2777  *
2778  * Requires: MBEDTLS_ECP_C, MBEDTLS_ASN1_WRITE_C, MBEDTLS_ASN1_PARSE_C,
2779  *           and at least one MBEDTLS_ECP_DP_XXX_ENABLED for a
2780  *           short Weierstrass curve.
2781  */
2782 #define MBEDTLS_ECDSA_C
2783 
2784 /**
2785  * \def MBEDTLS_ECJPAKE_C
2786  *
2787  * Enable the elliptic curve J-PAKE library.
2788  *
2789  * \warning This is currently experimental. EC J-PAKE support is based on the
2790  * Thread v1.0.0 specification; incompatible changes to the specification
2791  * might still happen. For this reason, this is disabled by default.
2792  *
2793  * Module:  library/ecjpake.c
2794  * Caller:
2795  *
2796  * This module is used by the following key exchanges:
2797  *      ECJPAKE
2798  *
2799  * Requires: MBEDTLS_ECP_C, MBEDTLS_MD_C
2800  */
2801 //#define MBEDTLS_ECJPAKE_C
2802 
2803 /**
2804  * \def MBEDTLS_ECP_C
2805  *
2806  * Enable the elliptic curve over GF(p) library.
2807  *
2808  * Module:  library/ecp.c
2809  * Caller:  library/ecdh.c
2810  *          library/ecdsa.c
2811  *          library/ecjpake.c
2812  *
2813  * Requires: MBEDTLS_BIGNUM_C and at least one MBEDTLS_ECP_DP_XXX_ENABLED
2814  */
2815 #define MBEDTLS_ECP_C
2816 
2817 /**
2818  * \def MBEDTLS_ENTROPY_C
2819  *
2820  * Enable the platform-specific entropy code.
2821  *
2822  * Module:  library/entropy.c
2823  * Caller:
2824  *
2825  * Requires: MBEDTLS_SHA512_C or MBEDTLS_SHA256_C
2826  *
2827  * This module provides a generic entropy pool
2828  */
2829 #define MBEDTLS_ENTROPY_C
2830 
2831 /**
2832  * \def MBEDTLS_ERROR_C
2833  *
2834  * Enable error code to error string conversion.
2835  *
2836  * Module:  library/error.c
2837  * Caller:
2838  *
2839  * This module enables mbedtls_strerror().
2840  */
2841 #define MBEDTLS_ERROR_C
2842 
2843 /**
2844  * \def MBEDTLS_GCM_C
2845  *
2846  * Enable the Galois/Counter Mode (GCM).
2847  *
2848  * Module:  library/gcm.c
2849  *
2850  * Requires: MBEDTLS_AES_C or MBEDTLS_CAMELLIA_C or MBEDTLS_ARIA_C
2851  *
2852  * This module enables the AES-GCM and CAMELLIA-GCM ciphersuites, if other
2853  * requisites are enabled as well.
2854  */
2855 #define MBEDTLS_GCM_C
2856 
2857 /**
2858  * \def MBEDTLS_HAVEGE_C
2859  *
2860  * Enable the HAVEGE random generator.
2861  *
2862  * Warning: the HAVEGE random generator is not suitable for virtualized
2863  *          environments
2864  *
2865  * Warning: the HAVEGE random generator is dependent on timing and specific
2866  *          processor traits. It is therefore not advised to use HAVEGE as
2867  *          your applications primary random generator or primary entropy pool
2868  *          input. As a secondary input to your entropy pool, it IS able add
2869  *          the (limited) extra entropy it provides.
2870  *
2871  * Module:  library/havege.c
2872  * Caller:
2873  *
2874  * Requires: MBEDTLS_TIMING_C
2875  *
2876  * Uncomment to enable the HAVEGE random generator.
2877  */
2878 //#define MBEDTLS_HAVEGE_C
2879 
2880 /**
2881  * \def MBEDTLS_HKDF_C
2882  *
2883  * Enable the HKDF algorithm (RFC 5869).
2884  *
2885  * Module:  library/hkdf.c
2886  * Caller:
2887  *
2888  * Requires: MBEDTLS_MD_C
2889  *
2890  * This module adds support for the Hashed Message Authentication Code
2891  * (HMAC)-based key derivation function (HKDF).
2892  */
2893 #define MBEDTLS_HKDF_C
2894 
2895 /**
2896  * \def MBEDTLS_HMAC_DRBG_C
2897  *
2898  * Enable the HMAC_DRBG random generator.
2899  *
2900  * Module:  library/hmac_drbg.c
2901  * Caller:
2902  *
2903  * Requires: MBEDTLS_MD_C
2904  *
2905  * Uncomment to enable the HMAC_DRBG random number geerator.
2906  */
2907 #define MBEDTLS_HMAC_DRBG_C
2908 
2909 /**
2910  * \def MBEDTLS_NIST_KW_C
2911  *
2912  * Enable the Key Wrapping mode for 128-bit block ciphers,
2913  * as defined in NIST SP 800-38F. Only KW and KWP modes
2914  * are supported. At the moment, only AES is approved by NIST.
2915  *
2916  * Module:  library/nist_kw.c
2917  *
2918  * Requires: MBEDTLS_AES_C and MBEDTLS_CIPHER_C
2919  */
2920 //#define MBEDTLS_NIST_KW_C
2921 
2922 /**
2923  * \def MBEDTLS_MD_C
2924  *
2925  * Enable the generic message digest layer.
2926  *
2927  * Module:  library/md.c
2928  * Caller:
2929  *
2930  * Uncomment to enable generic message digest wrappers.
2931  */
2932 #define MBEDTLS_MD_C
2933 
2934 /**
2935  * \def MBEDTLS_MD2_C
2936  *
2937  * Enable the MD2 hash algorithm.
2938  *
2939  * Module:  library/md2.c
2940  * Caller:
2941  *
2942  * Uncomment to enable support for (rare) MD2-signed X.509 certs.
2943  *
2944  * \warning   MD2 is considered a weak message digest and its use constitutes a
2945  *            security risk. If possible, we recommend avoiding dependencies on
2946  *            it, and considering stronger message digests instead.
2947  *
2948  */
2949 //#define MBEDTLS_MD2_C
2950 
2951 /**
2952  * \def MBEDTLS_MD4_C
2953  *
2954  * Enable the MD4 hash algorithm.
2955  *
2956  * Module:  library/md4.c
2957  * Caller:
2958  *
2959  * Uncomment to enable support for (rare) MD4-signed X.509 certs.
2960  *
2961  * \warning   MD4 is considered a weak message digest and its use constitutes a
2962  *            security risk. If possible, we recommend avoiding dependencies on
2963  *            it, and considering stronger message digests instead.
2964  *
2965  */
2966 //#define MBEDTLS_MD4_C
2967 
2968 /**
2969  * \def MBEDTLS_MD5_C
2970  *
2971  * Enable the MD5 hash algorithm.
2972  *
2973  * Module:  library/md5.c
2974  * Caller:  library/md.c
2975  *          library/pem.c
2976  *          library/ssl_tls.c
2977  *
2978  * This module is required for SSL/TLS up to version 1.1, and for TLS 1.2
2979  * depending on the handshake parameters. Further, it is used for checking
2980  * MD5-signed certificates, and for PBKDF1 when decrypting PEM-encoded
2981  * encrypted keys.
2982  *
2983  * \warning   MD5 is considered a weak message digest and its use constitutes a
2984  *            security risk. If possible, we recommend avoiding dependencies on
2985  *            it, and considering stronger message digests instead.
2986  *
2987  */
2988 #define MBEDTLS_MD5_C
2989 
2990 /**
2991  * \def MBEDTLS_MEMORY_BUFFER_ALLOC_C
2992  *
2993  * Enable the buffer allocator implementation that makes use of a (stack)
2994  * based buffer to 'allocate' dynamic memory. (replaces calloc() and free()
2995  * calls)
2996  *
2997  * Module:  library/memory_buffer_alloc.c
2998  *
2999  * Requires: MBEDTLS_PLATFORM_C
3000  *           MBEDTLS_PLATFORM_MEMORY (to use it within mbed TLS)
3001  *
3002  * Enable this module to enable the buffer memory allocator.
3003  */
3004 //#define MBEDTLS_MEMORY_BUFFER_ALLOC_C
3005 
3006 /**
3007  * \def MBEDTLS_NET_C
3008  *
3009  * Enable the TCP and UDP over IPv6/IPv4 networking routines.
3010  *
3011  * \note This module only works on POSIX/Unix (including Linux, BSD and OS X)
3012  * and Windows. For other platforms, you'll want to disable it, and write your
3013  * own networking callbacks to be passed to \c mbedtls_ssl_set_bio().
3014  *
3015  * \note See also our Knowledge Base article about porting to a new
3016  * environment:
3017  * https://tls.mbed.org/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS
3018  *
3019  * Module:  library/net_sockets.c
3020  *
3021  * This module provides networking routines.
3022  */
3023 #define MBEDTLS_NET_C
3024 
3025 /**
3026  * \def MBEDTLS_OID_C
3027  *
3028  * Enable the OID database.
3029  *
3030  * Module:  library/oid.c
3031  * Caller:  library/asn1write.c
3032  *          library/pkcs5.c
3033  *          library/pkparse.c
3034  *          library/pkwrite.c
3035  *          library/rsa.c
3036  *          library/x509.c
3037  *          library/x509_create.c
3038  *          library/x509_crl.c
3039  *          library/x509_crt.c
3040  *          library/x509_csr.c
3041  *          library/x509write_crt.c
3042  *          library/x509write_csr.c
3043  *
3044  * This modules translates between OIDs and internal values.
3045  */
3046 #define MBEDTLS_OID_C
3047 
3048 /**
3049  * \def MBEDTLS_PADLOCK_C
3050  *
3051  * Enable VIA Padlock support on x86.
3052  *
3053  * Module:  library/padlock.c
3054  * Caller:  library/aes.c
3055  *
3056  * Requires: MBEDTLS_HAVE_ASM
3057  *
3058  * This modules adds support for the VIA PadLock on x86.
3059  */
3060 #define MBEDTLS_PADLOCK_C
3061 
3062 /**
3063  * \def MBEDTLS_PEM_PARSE_C
3064  *
3065  * Enable PEM decoding / parsing.
3066  *
3067  * Module:  library/pem.c
3068  * Caller:  library/dhm.c
3069  *          library/pkparse.c
3070  *          library/x509_crl.c
3071  *          library/x509_crt.c
3072  *          library/x509_csr.c
3073  *
3074  * Requires: MBEDTLS_BASE64_C
3075  *
3076  * This modules adds support for decoding / parsing PEM files.
3077  */
3078 #define MBEDTLS_PEM_PARSE_C
3079 
3080 /**
3081  * \def MBEDTLS_PEM_WRITE_C
3082  *
3083  * Enable PEM encoding / writing.
3084  *
3085  * Module:  library/pem.c
3086  * Caller:  library/pkwrite.c
3087  *          library/x509write_crt.c
3088  *          library/x509write_csr.c
3089  *
3090  * Requires: MBEDTLS_BASE64_C
3091  *
3092  * This modules adds support for encoding / writing PEM files.
3093  */
3094 #define MBEDTLS_PEM_WRITE_C
3095 
3096 /**
3097  * \def MBEDTLS_PK_C
3098  *
3099  * Enable the generic public (asymetric) key layer.
3100  *
3101  * Module:  library/pk.c
3102  * Caller:  library/ssl_tls.c
3103  *          library/ssl_cli.c
3104  *          library/ssl_srv.c
3105  *
3106  * Requires: MBEDTLS_RSA_C or MBEDTLS_ECP_C
3107  *
3108  * Uncomment to enable generic public key wrappers.
3109  */
3110 #define MBEDTLS_PK_C
3111 
3112 /**
3113  * \def MBEDTLS_PK_PARSE_C
3114  *
3115  * Enable the generic public (asymetric) key parser.
3116  *
3117  * Module:  library/pkparse.c
3118  * Caller:  library/x509_crt.c
3119  *          library/x509_csr.c
3120  *
3121  * Requires: MBEDTLS_PK_C
3122  *
3123  * Uncomment to enable generic public key parse functions.
3124  */
3125 #define MBEDTLS_PK_PARSE_C
3126 
3127 /**
3128  * \def MBEDTLS_PK_WRITE_C
3129  *
3130  * Enable the generic public (asymetric) key writer.
3131  *
3132  * Module:  library/pkwrite.c
3133  * Caller:  library/x509write.c
3134  *
3135  * Requires: MBEDTLS_PK_C
3136  *
3137  * Uncomment to enable generic public key write functions.
3138  */
3139 #define MBEDTLS_PK_WRITE_C
3140 
3141 /**
3142  * \def MBEDTLS_PKCS5_C
3143  *
3144  * Enable PKCS#5 functions.
3145  *
3146  * Module:  library/pkcs5.c
3147  *
3148  * Requires: MBEDTLS_MD_C
3149  *
3150  * This module adds support for the PKCS#5 functions.
3151  */
3152 #define MBEDTLS_PKCS5_C
3153 
3154 /**
3155  * \def MBEDTLS_PKCS11_C
3156  *
3157  * Enable wrapper for PKCS#11 smartcard support via the pkcs11-helper library.
3158  *
3159  * \deprecated This option is deprecated and will be removed in a future
3160  *             version of Mbed TLS.
3161  *
3162  * Module:  library/pkcs11.c
3163  * Caller:  library/pk.c
3164  *
3165  * Requires: MBEDTLS_PK_C
3166  *
3167  * This module enables SSL/TLS PKCS #11 smartcard support.
3168  * Requires the presence of the PKCS#11 helper library (libpkcs11-helper)
3169  */
3170 //#define MBEDTLS_PKCS11_C
3171 
3172 /**
3173  * \def MBEDTLS_PKCS12_C
3174  *
3175  * Enable PKCS#12 PBE functions.
3176  * Adds algorithms for parsing PKCS#8 encrypted private keys
3177  *
3178  * Module:  library/pkcs12.c
3179  * Caller:  library/pkparse.c
3180  *
3181  * Requires: MBEDTLS_ASN1_PARSE_C, MBEDTLS_CIPHER_C, MBEDTLS_MD_C
3182  * Can use:  MBEDTLS_ARC4_C
3183  *
3184  * This module enables PKCS#12 functions.
3185  */
3186 #define MBEDTLS_PKCS12_C
3187 
3188 /**
3189  * \def MBEDTLS_PLATFORM_C
3190  *
3191  * Enable the platform abstraction layer that allows you to re-assign
3192  * functions like calloc(), free(), snprintf(), printf(), fprintf(), exit().
3193  *
3194  * Enabling MBEDTLS_PLATFORM_C enables to use of MBEDTLS_PLATFORM_XXX_ALT
3195  * or MBEDTLS_PLATFORM_XXX_MACRO directives, allowing the functions mentioned
3196  * above to be specified at runtime or compile time respectively.
3197  *
3198  * \note This abstraction layer must be enabled on Windows (including MSYS2)
3199  * as other module rely on it for a fixed snprintf implementation.
3200  *
3201  * Module:  library/platform.c
3202  * Caller:  Most other .c files
3203  *
3204  * This module enables abstraction of common (libc) functions.
3205  */
3206 #define MBEDTLS_PLATFORM_C
3207 
3208 /**
3209  * \def MBEDTLS_POLY1305_C
3210  *
3211  * Enable the Poly1305 MAC algorithm.
3212  *
3213  * Module:  library/poly1305.c
3214  * Caller:  library/chachapoly.c
3215  */
3216 #define MBEDTLS_POLY1305_C
3217 
3218 /**
3219  * \def MBEDTLS_PSA_CRYPTO_C
3220  *
3221  * Enable the Platform Security Architecture cryptography API.
3222  *
3223  * Module:  library/psa_crypto.c
3224  *
3225  * Requires: either MBEDTLS_CTR_DRBG_C and MBEDTLS_ENTROPY_C,
3226  *           or MBEDTLS_HMAC_DRBG_C and MBEDTLS_ENTROPY_C,
3227  *           or MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG.
3228  *
3229  */
3230 #define MBEDTLS_PSA_CRYPTO_C
3231 
3232 /**
3233  * \def MBEDTLS_PSA_CRYPTO_SE_C
3234  *
3235  * Enable secure element support in the Platform Security Architecture
3236  * cryptography API.
3237  *
3238  * \warning This feature is not yet suitable for production. It is provided
3239  *          for API evaluation and testing purposes only.
3240  *
3241  * Module:  library/psa_crypto_se.c
3242  *
3243  * Requires: MBEDTLS_PSA_CRYPTO_C, MBEDTLS_PSA_CRYPTO_STORAGE_C
3244  *
3245  */
3246 //#define MBEDTLS_PSA_CRYPTO_SE_C
3247 
3248 /**
3249  * \def MBEDTLS_PSA_CRYPTO_STORAGE_C
3250  *
3251  * Enable the Platform Security Architecture persistent key storage.
3252  *
3253  * Module:  library/psa_crypto_storage.c
3254  *
3255  * Requires: MBEDTLS_PSA_CRYPTO_C,
3256  *           either MBEDTLS_PSA_ITS_FILE_C or a native implementation of
3257  *           the PSA ITS interface
3258  */
3259 #define MBEDTLS_PSA_CRYPTO_STORAGE_C
3260 
3261 /**
3262  * \def MBEDTLS_PSA_ITS_FILE_C
3263  *
3264  * Enable the emulation of the Platform Security Architecture
3265  * Internal Trusted Storage (PSA ITS) over files.
3266  *
3267  * Module:  library/psa_its_file.c
3268  *
3269  * Requires: MBEDTLS_FS_IO
3270  */
3271 #define MBEDTLS_PSA_ITS_FILE_C
3272 
3273 /**
3274  * \def MBEDTLS_RIPEMD160_C
3275  *
3276  * Enable the RIPEMD-160 hash algorithm.
3277  *
3278  * Module:  library/ripemd160.c
3279  * Caller:  library/md.c
3280  *
3281  */
3282 #define MBEDTLS_RIPEMD160_C
3283 
3284 /**
3285  * \def MBEDTLS_RSA_C
3286  *
3287  * Enable the RSA public-key cryptosystem.
3288  *
3289  * Module:  library/rsa.c
3290  *          library/rsa_internal.c
3291  * Caller:  library/ssl_cli.c
3292  *          library/ssl_srv.c
3293  *          library/ssl_tls.c
3294  *          library/x509.c
3295  *
3296  * This module is used by the following key exchanges:
3297  *      RSA, DHE-RSA, ECDHE-RSA, RSA-PSK
3298  *
3299  * Requires: MBEDTLS_BIGNUM_C, MBEDTLS_OID_C
3300  */
3301 #define MBEDTLS_RSA_C
3302 
3303 /**
3304  * \def MBEDTLS_SHA1_C
3305  *
3306  * Enable the SHA1 cryptographic hash algorithm.
3307  *
3308  * Module:  library/sha1.c
3309  * Caller:  library/md.c
3310  *          library/ssl_cli.c
3311  *          library/ssl_srv.c
3312  *          library/ssl_tls.c
3313  *          library/x509write_crt.c
3314  *
3315  * This module is required for SSL/TLS up to version 1.1, for TLS 1.2
3316  * depending on the handshake parameters, and for SHA1-signed certificates.
3317  *
3318  * \warning   SHA-1 is considered a weak message digest and its use constitutes
3319  *            a security risk. If possible, we recommend avoiding dependencies
3320  *            on it, and considering stronger message digests instead.
3321  *
3322  */
3323 #define MBEDTLS_SHA1_C
3324 
3325 /**
3326  * \def MBEDTLS_SHA256_C
3327  *
3328  * Enable the SHA-224 and SHA-256 cryptographic hash algorithms.
3329  *
3330  * Module:  library/sha256.c
3331  * Caller:  library/entropy.c
3332  *          library/md.c
3333  *          library/ssl_cli.c
3334  *          library/ssl_srv.c
3335  *          library/ssl_tls.c
3336  *
3337  * This module adds support for SHA-224 and SHA-256.
3338  * This module is required for the SSL/TLS 1.2 PRF function.
3339  */
3340 #define MBEDTLS_SHA256_C
3341 
3342 /**
3343  * \def MBEDTLS_SHA512_C
3344  *
3345  * Enable the SHA-384 and SHA-512 cryptographic hash algorithms.
3346  *
3347  * Module:  library/sha512.c
3348  * Caller:  library/entropy.c
3349  *          library/md.c
3350  *          library/ssl_cli.c
3351  *          library/ssl_srv.c
3352  *
3353  * This module adds support for SHA-384 and SHA-512.
3354  */
3355 #define MBEDTLS_SHA512_C
3356 
3357 /**
3358  * \def MBEDTLS_SSL_CACHE_C
3359  *
3360  * Enable simple SSL cache implementation.
3361  *
3362  * Module:  library/ssl_cache.c
3363  * Caller:
3364  *
3365  * Requires: MBEDTLS_SSL_CACHE_C
3366  */
3367 #define MBEDTLS_SSL_CACHE_C
3368 
3369 /**
3370  * \def MBEDTLS_SSL_COOKIE_C
3371  *
3372  * Enable basic implementation of DTLS cookies for hello verification.
3373  *
3374  * Module:  library/ssl_cookie.c
3375  * Caller:
3376  */
3377 #define MBEDTLS_SSL_COOKIE_C
3378 
3379 /**
3380  * \def MBEDTLS_SSL_TICKET_C
3381  *
3382  * Enable an implementation of TLS server-side callbacks for session tickets.
3383  *
3384  * Module:  library/ssl_ticket.c
3385  * Caller:
3386  *
3387  * Requires: MBEDTLS_CIPHER_C
3388  */
3389 #define MBEDTLS_SSL_TICKET_C
3390 
3391 /**
3392  * \def MBEDTLS_SSL_CLI_C
3393  *
3394  * Enable the SSL/TLS client code.
3395  *
3396  * Module:  library/ssl_cli.c
3397  * Caller:
3398  *
3399  * Requires: MBEDTLS_SSL_TLS_C
3400  *
3401  * This module is required for SSL/TLS client support.
3402  */
3403 #define MBEDTLS_SSL_CLI_C
3404 
3405 /**
3406  * \def MBEDTLS_SSL_SRV_C
3407  *
3408  * Enable the SSL/TLS server code.
3409  *
3410  * Module:  library/ssl_srv.c
3411  * Caller:
3412  *
3413  * Requires: MBEDTLS_SSL_TLS_C
3414  *
3415  * This module is required for SSL/TLS server support.
3416  */
3417 #define MBEDTLS_SSL_SRV_C
3418 
3419 /**
3420  * \def MBEDTLS_SSL_TLS_C
3421  *
3422  * Enable the generic SSL/TLS code.
3423  *
3424  * Module:  library/ssl_tls.c
3425  * Caller:  library/ssl_cli.c
3426  *          library/ssl_srv.c
3427  *
3428  * Requires: MBEDTLS_CIPHER_C, MBEDTLS_MD_C
3429  *           and at least one of the MBEDTLS_SSL_PROTO_XXX defines
3430  *
3431  * This module is required for SSL/TLS.
3432  */
3433 #define MBEDTLS_SSL_TLS_C
3434 
3435 /**
3436  * \def MBEDTLS_THREADING_C
3437  *
3438  * Enable the threading abstraction layer.
3439  * By default mbed TLS assumes it is used in a non-threaded environment or that
3440  * contexts are not shared between threads. If you do intend to use contexts
3441  * between threads, you will need to enable this layer to prevent race
3442  * conditions. See also our Knowledge Base article about threading:
3443  * https://tls.mbed.org/kb/development/thread-safety-and-multi-threading
3444  *
3445  * Module:  library/threading.c
3446  *
3447  * This allows different threading implementations (self-implemented or
3448  * provided).
3449  *
3450  * You will have to enable either MBEDTLS_THREADING_ALT or
3451  * MBEDTLS_THREADING_PTHREAD.
3452  *
3453  * Enable this layer to allow use of mutexes within mbed TLS
3454  */
3455 //#define MBEDTLS_THREADING_C
3456 
3457 /**
3458  * \def MBEDTLS_TIMING_C
3459  *
3460  * Enable the semi-portable timing interface.
3461  *
3462  * \note The provided implementation only works on POSIX/Unix (including Linux,
3463  * BSD and OS X) and Windows. On other platforms, you can either disable that
3464  * module and provide your own implementations of the callbacks needed by
3465  * \c mbedtls_ssl_set_timer_cb() for DTLS, or leave it enabled and provide
3466  * your own implementation of the whole module by setting
3467  * \c MBEDTLS_TIMING_ALT in the current file.
3468  *
3469  * \note See also our Knowledge Base article about porting to a new
3470  * environment:
3471  * https://tls.mbed.org/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS
3472  *
3473  * Module:  library/timing.c
3474  * Caller:  library/havege.c
3475  *
3476  * This module is used by the HAVEGE random number generator.
3477  */
3478 #define MBEDTLS_TIMING_C
3479 
3480 /**
3481  * \def MBEDTLS_VERSION_C
3482  *
3483  * Enable run-time version information.
3484  *
3485  * Module:  library/version.c
3486  *
3487  * This module provides run-time version information.
3488  */
3489 #define MBEDTLS_VERSION_C
3490 
3491 /**
3492  * \def MBEDTLS_X509_USE_C
3493  *
3494  * Enable X.509 core for using certificates.
3495  *
3496  * Module:  library/x509.c
3497  * Caller:  library/x509_crl.c
3498  *          library/x509_crt.c
3499  *          library/x509_csr.c
3500  *
3501  * Requires: MBEDTLS_ASN1_PARSE_C, MBEDTLS_BIGNUM_C, MBEDTLS_OID_C,
3502  *           MBEDTLS_PK_PARSE_C
3503  *
3504  * This module is required for the X.509 parsing modules.
3505  */
3506 #define MBEDTLS_X509_USE_C
3507 
3508 /**
3509  * \def MBEDTLS_X509_CRT_PARSE_C
3510  *
3511  * Enable X.509 certificate parsing.
3512  *
3513  * Module:  library/x509_crt.c
3514  * Caller:  library/ssl_cli.c
3515  *          library/ssl_srv.c
3516  *          library/ssl_tls.c
3517  *
3518  * Requires: MBEDTLS_X509_USE_C
3519  *
3520  * This module is required for X.509 certificate parsing.
3521  */
3522 #define MBEDTLS_X509_CRT_PARSE_C
3523 
3524 /**
3525  * \def MBEDTLS_X509_CRL_PARSE_C
3526  *
3527  * Enable X.509 CRL parsing.
3528  *
3529  * Module:  library/x509_crl.c
3530  * Caller:  library/x509_crt.c
3531  *
3532  * Requires: MBEDTLS_X509_USE_C
3533  *
3534  * This module is required for X.509 CRL parsing.
3535  */
3536 #define MBEDTLS_X509_CRL_PARSE_C
3537 
3538 /**
3539  * \def MBEDTLS_X509_CSR_PARSE_C
3540  *
3541  * Enable X.509 Certificate Signing Request (CSR) parsing.
3542  *
3543  * Module:  library/x509_csr.c
3544  * Caller:  library/x509_crt_write.c
3545  *
3546  * Requires: MBEDTLS_X509_USE_C
3547  *
3548  * This module is used for reading X.509 certificate request.
3549  */
3550 #define MBEDTLS_X509_CSR_PARSE_C
3551 
3552 /**
3553  * \def MBEDTLS_X509_CREATE_C
3554  *
3555  * Enable X.509 core for creating certificates.
3556  *
3557  * Module:  library/x509_create.c
3558  *
3559  * Requires: MBEDTLS_BIGNUM_C, MBEDTLS_OID_C, MBEDTLS_PK_WRITE_C
3560  *
3561  * This module is the basis for creating X.509 certificates and CSRs.
3562  */
3563 #define MBEDTLS_X509_CREATE_C
3564 
3565 /**
3566  * \def MBEDTLS_X509_CRT_WRITE_C
3567  *
3568  * Enable creating X.509 certificates.
3569  *
3570  * Module:  library/x509_crt_write.c
3571  *
3572  * Requires: MBEDTLS_X509_CREATE_C
3573  *
3574  * This module is required for X.509 certificate creation.
3575  */
3576 #define MBEDTLS_X509_CRT_WRITE_C
3577 
3578 /**
3579  * \def MBEDTLS_X509_CSR_WRITE_C
3580  *
3581  * Enable creating X.509 Certificate Signing Requests (CSR).
3582  *
3583  * Module:  library/x509_csr_write.c
3584  *
3585  * Requires: MBEDTLS_X509_CREATE_C
3586  *
3587  * This module is required for X.509 certificate request writing.
3588  */
3589 #define MBEDTLS_X509_CSR_WRITE_C
3590 
3591 /**
3592  * \def MBEDTLS_XTEA_C
3593  *
3594  * Enable the XTEA block cipher.
3595  *
3596  * Module:  library/xtea.c
3597  * Caller:
3598  */
3599 #define MBEDTLS_XTEA_C
3600 
3601 /* \} name SECTION: mbed TLS modules */
3602 
3603 /**
3604  * \name SECTION: Module configuration options
3605  *
3606  * This section allows for the setting of module specific sizes and
3607  * configuration options. The default values are already present in the
3608  * relevant header files and should suffice for the regular use cases.
3609  *
3610  * Our advice is to enable options and change their values here
3611  * only if you have a good reason and know the consequences.
3612  *
3613  * Please check the respective header file for documentation on these
3614  * parameters (to prevent duplicate documentation).
3615  * \{
3616  */
3617 
3618 /* MPI / BIGNUM options */
3619 //#define MBEDTLS_MPI_WINDOW_SIZE            6 /**< Maximum window size used. */
3620 //#define MBEDTLS_MPI_MAX_SIZE            1024 /**< Maximum number of bytes for usable MPIs. */
3621 
3622 /* CTR_DRBG options */
3623 //#define MBEDTLS_CTR_DRBG_ENTROPY_LEN               48 /**< Amount of entropy used per seed by default (48 with SHA-512, 32 with SHA-256) */
3624 //#define MBEDTLS_CTR_DRBG_RESEED_INTERVAL        10000 /**< Interval before reseed is performed by default */
3625 //#define MBEDTLS_CTR_DRBG_MAX_INPUT                256 /**< Maximum number of additional input bytes */
3626 //#define MBEDTLS_CTR_DRBG_MAX_REQUEST             1024 /**< Maximum number of requested bytes per call */
3627 //#define MBEDTLS_CTR_DRBG_MAX_SEED_INPUT           384 /**< Maximum size of (re)seed buffer */
3628 
3629 /* HMAC_DRBG options */
3630 //#define MBEDTLS_HMAC_DRBG_RESEED_INTERVAL   10000 /**< Interval before reseed is performed by default */
3631 //#define MBEDTLS_HMAC_DRBG_MAX_INPUT           256 /**< Maximum number of additional input bytes */
3632 //#define MBEDTLS_HMAC_DRBG_MAX_REQUEST        1024 /**< Maximum number of requested bytes per call */
3633 //#define MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT      384 /**< Maximum size of (re)seed buffer */
3634 
3635 /* ECP options */
3636 //#define MBEDTLS_ECP_MAX_BITS             521 /**< Maximum bit size of groups. Normally determined automatically from the configured curves. */
3637 //#define MBEDTLS_ECP_WINDOW_SIZE            4 /**< Maximum window size used */
3638 //#define MBEDTLS_ECP_FIXED_POINT_OPTIM      1 /**< Enable fixed-point speed-up */
3639 
3640 /* Entropy options */
3641 //#define MBEDTLS_ENTROPY_MAX_SOURCES                20 /**< Maximum number of sources supported */
3642 //#define MBEDTLS_ENTROPY_MAX_GATHER                128 /**< Maximum amount requested from entropy sources */
3643 //#define MBEDTLS_ENTROPY_MIN_HARDWARE               32 /**< Default minimum number of bytes required for the hardware entropy source mbedtls_hardware_poll() before entropy is released */
3644 
3645 /* Memory buffer allocator options */
3646 //#define MBEDTLS_MEMORY_ALIGN_MULTIPLE      4 /**< Align on multiples of this value */
3647 
3648 /* Platform options */
3649 //#define MBEDTLS_PLATFORM_STD_MEM_HDR   <stdlib.h> /**< Header to include if MBEDTLS_PLATFORM_NO_STD_FUNCTIONS is defined. Don't define if no header is needed. */
3650 //#define MBEDTLS_PLATFORM_STD_CALLOC        calloc /**< Default allocator to use, can be undefined */
3651 //#define MBEDTLS_PLATFORM_STD_FREE            free /**< Default free to use, can be undefined */
3652 //#define MBEDTLS_PLATFORM_STD_EXIT            exit /**< Default exit to use, can be undefined */
3653 //#define MBEDTLS_PLATFORM_STD_TIME            time /**< Default time to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */
3654 //#define MBEDTLS_PLATFORM_STD_FPRINTF      fprintf /**< Default fprintf to use, can be undefined */
3655 //#define MBEDTLS_PLATFORM_STD_PRINTF        printf /**< Default printf to use, can be undefined */
3656 /* Note: your snprintf must correctly zero-terminate the buffer! */
3657 //#define MBEDTLS_PLATFORM_STD_SNPRINTF    snprintf /**< Default snprintf to use, can be undefined */
3658 //#define MBEDTLS_PLATFORM_STD_EXIT_SUCCESS       0 /**< Default exit value to use, can be undefined */
3659 //#define MBEDTLS_PLATFORM_STD_EXIT_FAILURE       1 /**< Default exit value to use, can be undefined */
3660 //#define MBEDTLS_PLATFORM_STD_NV_SEED_READ   mbedtls_platform_std_nv_seed_read /**< Default nv_seed_read function to use, can be undefined */
3661 //#define MBEDTLS_PLATFORM_STD_NV_SEED_WRITE  mbedtls_platform_std_nv_seed_write /**< Default nv_seed_write function to use, can be undefined */
3662 //#define MBEDTLS_PLATFORM_STD_NV_SEED_FILE  "seedfile" /**< Seed file to read/write with default implementation */
3663 
3664 /* To Use Function Macros MBEDTLS_PLATFORM_C must be enabled */
3665 /* MBEDTLS_PLATFORM_XXX_MACRO and MBEDTLS_PLATFORM_XXX_ALT cannot both be defined */
3666 //#define MBEDTLS_PLATFORM_CALLOC_MACRO        calloc /**< Default allocator macro to use, can be undefined */
3667 //#define MBEDTLS_PLATFORM_FREE_MACRO            free /**< Default free macro to use, can be undefined */
3668 //#define MBEDTLS_PLATFORM_EXIT_MACRO            exit /**< Default exit macro to use, can be undefined */
3669 //#define MBEDTLS_PLATFORM_TIME_MACRO            time /**< Default time macro to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */
3670 //#define MBEDTLS_PLATFORM_TIME_TYPE_MACRO       time_t /**< Default time macro to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */
3671 //#define MBEDTLS_PLATFORM_FPRINTF_MACRO      fprintf /**< Default fprintf macro to use, can be undefined */
3672 //#define MBEDTLS_PLATFORM_PRINTF_MACRO        printf /**< Default printf macro to use, can be undefined */
3673 /* Note: your snprintf must correctly zero-terminate the buffer! */
3674 //#define MBEDTLS_PLATFORM_SNPRINTF_MACRO    snprintf /**< Default snprintf macro to use, can be undefined */
3675 //#define MBEDTLS_PLATFORM_VSNPRINTF_MACRO    vsnprintf /**< Default vsnprintf macro to use, can be undefined */
3676 //#define MBEDTLS_PLATFORM_NV_SEED_READ_MACRO   mbedtls_platform_std_nv_seed_read /**< Default nv_seed_read function to use, can be undefined */
3677 //#define MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO  mbedtls_platform_std_nv_seed_write /**< Default nv_seed_write function to use, can be undefined */
3678 
3679 /**
3680  * \brief       This macro is invoked by the library when an invalid parameter
3681  *              is detected that is only checked with #MBEDTLS_CHECK_PARAMS
3682  *              (see the documentation of that option for context).
3683  *
3684  *              When you leave this undefined here, the library provides
3685  *              a default definition. If the macro #MBEDTLS_CHECK_PARAMS_ASSERT
3686  *              is defined, the default definition is `assert(cond)`,
3687  *              otherwise the default definition calls a function
3688  *              mbedtls_param_failed(). This function is declared in
3689  *              `platform_util.h` for the benefit of the library, but
3690  *              you need to define in your application.
3691  *
3692  *              When you define this here, this replaces the default
3693  *              definition in platform_util.h (which no longer declares the
3694  *              function mbedtls_param_failed()) and it is your responsibility
3695  *              to make sure this macro expands to something suitable (in
3696  *              particular, that all the necessary declarations are visible
3697  *              from within the library - you can ensure that by providing
3698  *              them in this file next to the macro definition).
3699  *              If you define this macro to call `assert`, also define
3700  *              #MBEDTLS_CHECK_PARAMS_ASSERT so that library source files
3701  *              include `<assert.h>`.
3702  *
3703  *              Note that you may define this macro to expand to nothing, in
3704  *              which case you don't have to worry about declarations or
3705  *              definitions. However, you will then be notified about invalid
3706  *              parameters only in non-void functions, and void function will
3707  *              just silently return early on invalid parameters, which
3708  *              partially negates the benefits of enabling
3709  *              #MBEDTLS_CHECK_PARAMS in the first place, so is discouraged.
3710  *
3711  * \param cond  The expression that should evaluate to true, but doesn't.
3712  */
3713 //#define MBEDTLS_PARAM_FAILED( cond )               assert( cond )
3714 
3715 /** \def MBEDTLS_CHECK_RETURN
3716  *
3717  * This macro is used at the beginning of the declaration of a function
3718  * to indicate that its return value should be checked. It should
3719  * instruct the compiler to emit a warning or an error if the function
3720  * is called without checking its return value.
3721  *
3722  * There is a default implementation for popular compilers in platform_util.h.
3723  * You can override the default implementation by defining your own here.
3724  *
3725  * If the implementation here is empty, this will effectively disable the
3726  * checking of functions' return values.
3727  */
3728 //#define MBEDTLS_CHECK_RETURN __attribute__((__warn_unused_result__))
3729 
3730 /** \def MBEDTLS_IGNORE_RETURN
3731  *
3732  * This macro requires one argument, which should be a C function call.
3733  * If that function call would cause a #MBEDTLS_CHECK_RETURN warning, this
3734  * warning is suppressed.
3735  */
3736 //#define MBEDTLS_IGNORE_RETURN( result ) ((void) !(result))
3737 
3738 /* PSA options */
3739 /**
3740  * Use HMAC_DRBG with the specified hash algorithm for HMAC_DRBG for the
3741  * PSA crypto subsystem.
3742  *
3743  * If this option is unset:
3744  * - If CTR_DRBG is available, the PSA subsystem uses it rather than HMAC_DRBG.
3745  * - Otherwise, the PSA subsystem uses HMAC_DRBG with either
3746  *   #MBEDTLS_MD_SHA512 or #MBEDTLS_MD_SHA256 based on availability and
3747  *   on unspecified heuristics.
3748  */
3749 //#define MBEDTLS_PSA_HMAC_DRBG_MD_TYPE MBEDTLS_MD_SHA256
3750 
3751 /** \def MBEDTLS_PSA_KEY_SLOT_COUNT
3752  * Restrict the PSA library to supporting a maximum amount of simultaneously
3753  * loaded keys. A loaded key is a key stored by the PSA Crypto core as a
3754  * volatile key, or a persistent key which is loaded temporarily by the
3755  * library as part of a crypto operation in flight.
3756  *
3757  * If this option is unset, the library will fall back to a default value of
3758  * 32 keys.
3759  */
3760 //#define MBEDTLS_PSA_KEY_SLOT_COUNT 32
3761 
3762 /* SSL Cache options */
3763 //#define MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT       86400 /**< 1 day  */
3764 //#define MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES      50 /**< Maximum entries in cache */
3765 
3766 /* SSL options */
3767 
3768 /** \def MBEDTLS_SSL_MAX_CONTENT_LEN
3769  *
3770  * Maximum length (in bytes) of incoming and outgoing plaintext fragments.
3771  *
3772  * This determines the size of both the incoming and outgoing TLS I/O buffers
3773  * in such a way that both are capable of holding the specified amount of
3774  * plaintext data, regardless of the protection mechanism used.
3775  *
3776  * To configure incoming and outgoing I/O buffers separately, use
3777  * #MBEDTLS_SSL_IN_CONTENT_LEN and #MBEDTLS_SSL_OUT_CONTENT_LEN,
3778  * which overwrite the value set by this option.
3779  *
3780  * \note When using a value less than the default of 16KB on the client, it is
3781  *       recommended to use the Maximum Fragment Length (MFL) extension to
3782  *       inform the server about this limitation. On the server, there
3783  *       is no supported, standardized way of informing the client about
3784  *       restriction on the maximum size of incoming messages, and unless
3785  *       the limitation has been communicated by other means, it is recommended
3786  *       to only change the outgoing buffer size #MBEDTLS_SSL_OUT_CONTENT_LEN
3787  *       while keeping the default value of 16KB for the incoming buffer.
3788  *
3789  * Uncomment to set the maximum plaintext size of both
3790  * incoming and outgoing I/O buffers.
3791  */
3792 //#define MBEDTLS_SSL_MAX_CONTENT_LEN             16384
3793 
3794 /** \def MBEDTLS_SSL_IN_CONTENT_LEN
3795  *
3796  * Maximum length (in bytes) of incoming plaintext fragments.
3797  *
3798  * This determines the size of the incoming TLS I/O buffer in such a way
3799  * that it is capable of holding the specified amount of plaintext data,
3800  * regardless of the protection mechanism used.
3801  *
3802  * If this option is undefined, it inherits its value from
3803  * #MBEDTLS_SSL_MAX_CONTENT_LEN.
3804  *
3805  * \note When using a value less than the default of 16KB on the client, it is
3806  *       recommended to use the Maximum Fragment Length (MFL) extension to
3807  *       inform the server about this limitation. On the server, there
3808  *       is no supported, standardized way of informing the client about
3809  *       restriction on the maximum size of incoming messages, and unless
3810  *       the limitation has been communicated by other means, it is recommended
3811  *       to only change the outgoing buffer size #MBEDTLS_SSL_OUT_CONTENT_LEN
3812  *       while keeping the default value of 16KB for the incoming buffer.
3813  *
3814  * Uncomment to set the maximum plaintext size of the incoming I/O buffer
3815  * independently of the outgoing I/O buffer.
3816  */
3817 //#define MBEDTLS_SSL_IN_CONTENT_LEN              16384
3818 
3819 /** \def MBEDTLS_SSL_CID_IN_LEN_MAX
3820  *
3821  * The maximum length of CIDs used for incoming DTLS messages.
3822  *
3823  */
3824 //#define MBEDTLS_SSL_CID_IN_LEN_MAX 32
3825 
3826 /** \def MBEDTLS_SSL_CID_OUT_LEN_MAX
3827  *
3828  * The maximum length of CIDs used for outgoing DTLS messages.
3829  *
3830  */
3831 //#define MBEDTLS_SSL_CID_OUT_LEN_MAX 32
3832 
3833 /** \def MBEDTLS_SSL_CID_PADDING_GRANULARITY
3834  *
3835  * This option controls the use of record plaintext padding
3836  * when using the Connection ID extension in DTLS 1.2.
3837  *
3838  * The padding will always be chosen so that the length of the
3839  * padded plaintext is a multiple of the value of this option.
3840  *
3841  * Note: A value of \c 1 means that no padding will be used
3842  *       for outgoing records.
3843  *
3844  * Note: On systems lacking division instructions,
3845  *       a power of two should be preferred.
3846  *
3847  */
3848 //#define MBEDTLS_SSL_CID_PADDING_GRANULARITY 16
3849 
3850 /** \def MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY
3851  *
3852  * This option controls the use of record plaintext padding
3853  * in TLS 1.3.
3854  *
3855  * The padding will always be chosen so that the length of the
3856  * padded plaintext is a multiple of the value of this option.
3857  *
3858  * Note: A value of \c 1 means that no padding will be used
3859  *       for outgoing records.
3860  *
3861  * Note: On systems lacking division instructions,
3862  *       a power of two should be preferred.
3863  */
3864 //#define MBEDTLS_SSL_TLS1_3_PADDING_GRANULARITY 1
3865 
3866 /** \def MBEDTLS_SSL_OUT_CONTENT_LEN
3867  *
3868  * Maximum length (in bytes) of outgoing plaintext fragments.
3869  *
3870  * This determines the size of the outgoing TLS I/O buffer in such a way
3871  * that it is capable of holding the specified amount of plaintext data,
3872  * regardless of the protection mechanism used.
3873  *
3874  * If this option undefined, it inherits its value from
3875  * #MBEDTLS_SSL_MAX_CONTENT_LEN.
3876  *
3877  * It is possible to save RAM by setting a smaller outward buffer, while keeping
3878  * the default inward 16384 byte buffer to conform to the TLS specification.
3879  *
3880  * The minimum required outward buffer size is determined by the handshake
3881  * protocol's usage. Handshaking will fail if the outward buffer is too small.
3882  * The specific size requirement depends on the configured ciphers and any
3883  * certificate data which is sent during the handshake.
3884  *
3885  * Uncomment to set the maximum plaintext size of the outgoing I/O buffer
3886  * independently of the incoming I/O buffer.
3887  */
3888 //#define MBEDTLS_SSL_OUT_CONTENT_LEN             16384
3889 
3890 /** \def MBEDTLS_SSL_DTLS_MAX_BUFFERING
3891  *
3892  * Maximum number of heap-allocated bytes for the purpose of
3893  * DTLS handshake message reassembly and future message buffering.
3894  *
3895  * This should be at least 9/8 * MBEDTLS_SSL_IN_CONTENT_LEN
3896  * to account for a reassembled handshake message of maximum size,
3897  * together with its reassembly bitmap.
3898  *
3899  * A value of 2 * MBEDTLS_SSL_IN_CONTENT_LEN (32768 by default)
3900  * should be sufficient for all practical situations as it allows
3901  * to reassembly a large handshake message (such as a certificate)
3902  * while buffering multiple smaller handshake messages.
3903  *
3904  */
3905 //#define MBEDTLS_SSL_DTLS_MAX_BUFFERING             32768
3906 
3907 //#define MBEDTLS_SSL_DEFAULT_TICKET_LIFETIME     86400 /**< Lifetime of session tickets (if enabled) */
3908 //#define MBEDTLS_PSK_MAX_LEN               32 /**< Max size of TLS pre-shared keys, in bytes (default 256 bits) */
3909 //#define MBEDTLS_SSL_COOKIE_TIMEOUT        60 /**< Default expiration delay of DTLS cookies, in seconds if HAVE_TIME, or in number of cookies issued */
3910 
3911 /** \def MBEDTLS_TLS_EXT_CID
3912  *
3913  * At the time of writing, the CID extension has not been assigned its
3914  * final value. Set this configuration option to make Mbed TLS use a
3915  * different value.
3916  *
3917  * A future minor revision of Mbed TLS may change the default value of
3918  * this option to match evolving standards and usage.
3919  */
3920 //#define MBEDTLS_TLS_EXT_CID                        254
3921 
3922 /**
3923  * Complete list of ciphersuites to use, in order of preference.
3924  *
3925  * \warning No dependency checking is done on that field! This option can only
3926  * be used to restrict the set of available ciphersuites. It is your
3927  * responsibility to make sure the needed modules are active.
3928  *
3929  * Use this to save a few hundred bytes of ROM (default ordering of all
3930  * available ciphersuites) and a few to a few hundred bytes of RAM.
3931  *
3932  * The value below is only an example, not the default.
3933  */
3934 //#define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
3935 
3936 /* X509 options */
3937 //#define MBEDTLS_X509_MAX_INTERMEDIATE_CA   8   /**< Maximum number of intermediate CAs in a verification chain. */
3938 //#define MBEDTLS_X509_MAX_FILE_PATH_LEN     512 /**< Maximum length of a path/filename string in bytes including the null terminator character ('\0'). */
3939 
3940 /**
3941  * Allow SHA-1 in the default TLS configuration for TLS 1.2 handshake
3942  * signature and ciphersuite selection. Without this build-time option, SHA-1
3943  * support must be activated explicitly through mbedtls_ssl_conf_sig_hashes.
3944  * The use of SHA-1 in TLS <= 1.1 and in HMAC-SHA-1 is always allowed by
3945  * default. At the time of writing, there is no practical attack on the use
3946  * of SHA-1 in handshake signatures, hence this option is turned on by default
3947  * to preserve compatibility with existing peers, but the general
3948  * warning applies nonetheless:
3949  *
3950  * \warning   SHA-1 is considered a weak message digest and its use constitutes
3951  *            a security risk. If possible, we recommend avoiding dependencies
3952  *            on it, and considering stronger message digests instead.
3953  *
3954  */
3955 //#define MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE
3956 
3957 /**
3958  * Uncomment the macro to let mbed TLS use your alternate implementation of
3959  * mbedtls_platform_zeroize(). This replaces the default implementation in
3960  * platform_util.c.
3961  *
3962  * mbedtls_platform_zeroize() is a widely used function across the library to
3963  * zero a block of memory. The implementation is expected to be secure in the
3964  * sense that it has been written to prevent the compiler from removing calls
3965  * to mbedtls_platform_zeroize() as part of redundant code elimination
3966  * optimizations. However, it is difficult to guarantee that calls to
3967  * mbedtls_platform_zeroize() will not be optimized by the compiler as older
3968  * versions of the C language standards do not provide a secure implementation
3969  * of memset(). Therefore, MBEDTLS_PLATFORM_ZEROIZE_ALT enables users to
3970  * configure their own implementation of mbedtls_platform_zeroize(), for
3971  * example by using directives specific to their compiler, features from newer
3972  * C standards (e.g using memset_s() in C11) or calling a secure memset() from
3973  * their system (e.g explicit_bzero() in BSD).
3974  */
3975 //#define MBEDTLS_PLATFORM_ZEROIZE_ALT
3976 
3977 /**
3978  * Uncomment the macro to let Mbed TLS use your alternate implementation of
3979  * mbedtls_platform_gmtime_r(). This replaces the default implementation in
3980  * platform_util.c.
3981  *
3982  * gmtime() is not a thread-safe function as defined in the C standard. The
3983  * library will try to use safer implementations of this function, such as
3984  * gmtime_r() when available. However, if Mbed TLS cannot identify the target
3985  * system, the implementation of mbedtls_platform_gmtime_r() will default to
3986  * using the standard gmtime(). In this case, calls from the library to
3987  * gmtime() will be guarded by the global mutex mbedtls_threading_gmtime_mutex
3988  * if MBEDTLS_THREADING_C is enabled. We recommend that calls from outside the
3989  * library are also guarded with this mutex to avoid race conditions. However,
3990  * if the macro MBEDTLS_PLATFORM_GMTIME_R_ALT is defined, Mbed TLS will
3991  * unconditionally use the implementation for mbedtls_platform_gmtime_r()
3992  * supplied at compile time.
3993  */
3994 //#define MBEDTLS_PLATFORM_GMTIME_R_ALT
3995 
3996 /**
3997  * Enable the verified implementations of ECDH primitives from Project Everest
3998  * (currently only Curve25519). This feature changes the layout of ECDH
3999  * contexts and therefore is a compatibility break for applications that access
4000  * fields of a mbedtls_ecdh_context structure directly. See also
4001  * MBEDTLS_ECDH_LEGACY_CONTEXT in include/mbedtls/ecdh.h.
4002  */
4003 //#define MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED
4004 
4005 /* \} name SECTION: Customisation configuration options */
4006 
4007 /* Target and application specific configurations
4008  *
4009  * Allow user to override any previous default.
4010  *
4011  */
4012 #if defined(MBEDTLS_USER_CONFIG_FILE)
4013 #include MBEDTLS_USER_CONFIG_FILE
4014 #endif
4015 
4016 #if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
4017 #include "mbedtls/config_psa.h"
4018 #endif
4019 
4020 #include "mbedtls/check_config.h"
4021 
4022 #endif /* MBEDTLS_CONFIG_H */
4023