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