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