[c] dd

Viewer

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

Editor

You can edit this paste and save as new:


File Description
  • dd
  • Paste Code
  • 15 Oct-2021
  • 128 Kb
You can Share it: