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