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