|
139 | 139 | *
|
140 | 140 | * System has time.h, time(), and an implementation for
|
141 | 141 | * mbedtls_platform_gmtime_r() (see below).
|
142 |
| - * The time needs to be correct (not necesarily very accurate, but at least |
| 142 | + * The time needs to be correct (not necessarily very accurate, but at least |
143 | 143 | * the date should be correct). This is used to verify the validity period of
|
144 | 144 | * X.509 certificates.
|
145 | 145 | *
|
|
226 | 226 | //#define MBEDTLS_PLATFORM_FPRINTF_ALT
|
227 | 227 | //#define MBEDTLS_PLATFORM_PRINTF_ALT
|
228 | 228 | //#define MBEDTLS_PLATFORM_SNPRINTF_ALT
|
| 229 | +//#define MBEDTLS_PLATFORM_VSNPRINTF_ALT |
229 | 230 | //#define MBEDTLS_PLATFORM_NV_SEED_ALT
|
230 | 231 | //#define MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT
|
231 | 232 |
|
|
256 | 257 | */
|
257 | 258 | //#define MBEDTLS_DEPRECATED_REMOVED
|
258 | 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, it will: |
| 285 | + * - invoke the macro MBEDTLS_PARAM_FAILED() which by default expands to a |
| 286 | + * call to the function mbedtls_param_failed() |
| 287 | + * - immediately return (with a specific error code unless the function |
| 288 | + * returns void and can't communicate an error). |
| 289 | + * |
| 290 | + * When defining this flag, you also need to: |
| 291 | + * - either provide a definition of the function mbedtls_param_failed() in |
| 292 | + * your application (see platform_util.h for its prototype) as the library |
| 293 | + * calls that function, but does not provide a default definition for it, |
| 294 | + * - or provide a different definition of the macro MBEDTLS_PARAM_FAILED() |
| 295 | + * below if the above mechanism is not flexible enough to suit your needs. |
| 296 | + * See the documentation of this macro later in this file. |
| 297 | + * |
| 298 | + * Uncomment to enable validation of application-controlled parameters. |
| 299 | + */ |
| 300 | +//#define MBEDTLS_CHECK_PARAMS |
| 301 | + |
259 | 302 | /* \} name SECTION: System support */
|
260 | 303 |
|
261 | 304 | /**
|
|
359 | 402 | * \note Because of a signature change, the core AES encryption and decryption routines are
|
360 | 403 | * currently named mbedtls_aes_internal_encrypt and mbedtls_aes_internal_decrypt,
|
361 | 404 | * respectively. When setting up alternative implementations, these functions should
|
362 |
| - * be overriden, but the wrapper functions mbedtls_aes_decrypt and mbedtls_aes_encrypt |
| 405 | + * be overridden, but the wrapper functions mbedtls_aes_decrypt and mbedtls_aes_encrypt |
363 | 406 | * must stay untouched.
|
364 | 407 | *
|
365 | 408 | * \note If you use the AES_xxx_ALT macros, then is is recommended to also set
|
|
414 | 457 | * unsigned char mbedtls_internal_ecp_grp_capable(
|
415 | 458 | * const mbedtls_ecp_group *grp )
|
416 | 459 | * int mbedtls_internal_ecp_init( const mbedtls_ecp_group *grp )
|
417 |
| - * void mbedtls_internal_ecp_deinit( const mbedtls_ecp_group *grp ) |
| 460 | + * void mbedtls_internal_ecp_free( const mbedtls_ecp_group *grp ) |
418 | 461 | * The mbedtls_internal_ecp_grp_capable function should return 1 if the
|
419 | 462 | * replacement functions implement arithmetic for the given group and 0
|
420 | 463 | * otherwise.
|
421 |
| - * The functions mbedtls_internal_ecp_init and mbedtls_internal_ecp_deinit are |
| 464 | + * The functions mbedtls_internal_ecp_init and mbedtls_internal_ecp_free are |
422 | 465 | * called before and after each point operation and provide an opportunity to
|
423 | 466 | * implement optimized set up and tear down instructions.
|
424 | 467 | *
|
|
1159 | 1202 | */
|
1160 | 1203 | #define MBEDTLS_PKCS1_V21
|
1161 | 1204 |
|
| 1205 | +/** |
| 1206 | + * \def MBEDTLS_PSA_CRYPTO_SPM |
| 1207 | + * |
| 1208 | + * When MBEDTLS_PSA_CRYPTO_SPM is defined, the code is built for SPM (Secure |
| 1209 | + * Partition Manager) integration which separates the code into two parts: a |
| 1210 | + * NSPE (Non-Secure Process Environment) and an SPE (Secure Process |
| 1211 | + * Environment). |
| 1212 | + * |
| 1213 | + * Module: library/psa_crypto.c |
| 1214 | + * Requires: MBEDTLS_PSA_CRYPTO_C |
| 1215 | + * |
| 1216 | + */ |
| 1217 | +//#define MBEDTLS_PSA_CRYPTO_SPM |
| 1218 | + |
| 1219 | +/** |
| 1220 | + * \def MBEDTLS_PSA_HAS_ITS_IO |
| 1221 | + * |
| 1222 | + * Enable the non-volatile secure storage usage. |
| 1223 | + * |
| 1224 | + * This is crucial on systems that do not have a HW TRNG support. |
| 1225 | + * |
| 1226 | + */ |
| 1227 | +//#define MBEDTLS_PSA_HAS_ITS_IO |
| 1228 | + |
1162 | 1229 | /**
|
1163 | 1230 | * \def MBEDTLS_RSA_NO_CRT
|
1164 | 1231 | *
|
|
1496 | 1563 | * \def MBEDTLS_SSL_SESSION_TICKETS
|
1497 | 1564 | *
|
1498 | 1565 | * Enable support for RFC 5077 session tickets in SSL.
|
1499 |
| - * Client-side, provides full support for session tickets (maintainance of a |
| 1566 | + * Client-side, provides full support for session tickets (maintenance of a |
1500 | 1567 | * session store remains the responsibility of the application, though).
|
1501 | 1568 | * Server-side, you also need to provide callbacks for writing and parsing
|
1502 | 1569 | * tickets, including authenticated encryption and key management. Example
|
|
1582 | 1649 | */
|
1583 | 1650 | //#define MBEDTLS_THREADING_PTHREAD
|
1584 | 1651 |
|
| 1652 | +/** |
| 1653 | + * \def MBEDTLS_USE_PSA_CRYPTO |
| 1654 | + * |
| 1655 | + * Make the X.509 and TLS library use PSA for cryptographic operations, see |
| 1656 | + * #MBEDTLS_PSA_CRYPTO_C. |
| 1657 | + * |
| 1658 | + * Note: this option is still in progress, the full X.509 and TLS modules are |
| 1659 | + * not covered yet, but parts that are not ported to PSA yet will still work |
| 1660 | + * as usual, so enabling this option should not break backwards compatibility. |
| 1661 | + * |
| 1662 | + * \warning Support for PSA is still an experimental feature. |
| 1663 | + * Any public API that depends on this option may change |
| 1664 | + * at any time until this warning is removed. |
| 1665 | + * |
| 1666 | + * Requires: MBEDTLS_PSA_CRYPTO_C. |
| 1667 | + */ |
| 1668 | +//#define MBEDTLS_USE_PSA_CRYPTO |
| 1669 | + |
1585 | 1670 | /**
|
1586 | 1671 | * \def MBEDTLS_VERSION_FEATURES
|
1587 | 1672 | *
|
|
1662 | 1747 | *
|
1663 | 1748 | * \warning TLS-level compression MAY REDUCE SECURITY! See for example the
|
1664 | 1749 | * CRIME attack. Before enabling this option, you should examine with care if
|
1665 |
| - * CRIME or similar exploits may be a applicable to your use case. |
| 1750 | + * CRIME or similar exploits may be applicable to your use case. |
1666 | 1751 | *
|
1667 | 1752 | * \note Currently compression can't be used with DTLS.
|
1668 | 1753 | *
|
|
2590 | 2675 | */
|
2591 | 2676 | #define MBEDTLS_POLY1305_C
|
2592 | 2677 |
|
| 2678 | +/** |
| 2679 | + * \def MBEDTLS_PSA_CRYPTO_C |
| 2680 | + * |
| 2681 | + * Enable the Platform Security Architecture cryptography API. |
| 2682 | + * |
| 2683 | + * \note This option only has an effect when the build option |
| 2684 | + * USE_CRYPTO_SUBMODULE is also in use. |
| 2685 | + * |
| 2686 | + * \warning This feature is experimental and available on an opt-in basis only. |
| 2687 | + * PSA APIs are subject to change at any time. The implementation comes with |
| 2688 | + * less assurance and support than the rest of Mbed TLS. |
| 2689 | + * |
| 2690 | + * Module: crypto/library/psa_crypto.c |
| 2691 | + * |
| 2692 | + * Requires: MBEDTLS_CTR_DRBG_C, MBEDTLS_ENTROPY_C |
| 2693 | + * |
| 2694 | + */ |
| 2695 | +//#define MBEDTLS_PSA_CRYPTO_C |
| 2696 | + |
| 2697 | +/** |
| 2698 | + * \def MBEDTLS_PSA_CRYPTO_STORAGE_C |
| 2699 | + * |
| 2700 | + * Enable the Platform Security Architecture persistent key storage. |
| 2701 | + * |
| 2702 | + * Module: library/psa_crypto_storage.c |
| 2703 | + * |
| 2704 | + * Requires: MBEDTLS_PSA_CRYPTO_C and one of either |
| 2705 | + * MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C or MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C |
| 2706 | + * (but not both) |
| 2707 | + * |
| 2708 | + */ |
| 2709 | +//#define MBEDTLS_PSA_CRYPTO_STORAGE_C |
| 2710 | + |
| 2711 | +/** |
| 2712 | + * \def MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C |
| 2713 | + * |
| 2714 | + * Enable persistent key storage over files for the |
| 2715 | + * Platform Security Architecture cryptography API. |
| 2716 | + * |
| 2717 | + * Module: library/psa_crypto_storage_file.c |
| 2718 | + * |
| 2719 | + * Requires: MBEDTLS_PSA_CRYPTO_C, MBEDTLS_FS_IO |
| 2720 | + * |
| 2721 | + */ |
| 2722 | +//#define MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C |
| 2723 | + |
| 2724 | +/** |
| 2725 | + * \def MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C |
| 2726 | + * |
| 2727 | + * Enable persistent key storage over PSA ITS for the |
| 2728 | + * Platform Security Architecture cryptography API. |
| 2729 | + * |
| 2730 | + * Module: library/psa_crypto_storage_its.c |
| 2731 | + * |
| 2732 | + * Requires: MBEDTLS_PSA_CRYPTO_C, MBEDTLS_PSA_HAS_ITS_IO |
| 2733 | + * |
| 2734 | + */ |
| 2735 | +//#define MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C |
| 2736 | + |
2593 | 2737 | /**
|
2594 | 2738 | * \def MBEDTLS_RIPEMD160_C
|
2595 | 2739 | *
|
|
2974 | 3118 | //#define MBEDTLS_PLATFORM_STD_TIME time /**< Default time to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */
|
2975 | 3119 | //#define MBEDTLS_PLATFORM_STD_FPRINTF fprintf /**< Default fprintf to use, can be undefined */
|
2976 | 3120 | //#define MBEDTLS_PLATFORM_STD_PRINTF printf /**< Default printf to use, can be undefined */
|
2977 |
| -/* Note: your snprintf must correclty zero-terminate the buffer! */ |
| 3121 | +/* Note: your snprintf must correctly zero-terminate the buffer! */ |
2978 | 3122 | //#define MBEDTLS_PLATFORM_STD_SNPRINTF snprintf /**< Default snprintf to use, can be undefined */
|
2979 | 3123 | //#define MBEDTLS_PLATFORM_STD_EXIT_SUCCESS 0 /**< Default exit value to use, can be undefined */
|
2980 | 3124 | //#define MBEDTLS_PLATFORM_STD_EXIT_FAILURE 1 /**< Default exit value to use, can be undefined */
|
|
2991 | 3135 | //#define MBEDTLS_PLATFORM_TIME_TYPE_MACRO time_t /**< Default time macro to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */
|
2992 | 3136 | //#define MBEDTLS_PLATFORM_FPRINTF_MACRO fprintf /**< Default fprintf macro to use, can be undefined */
|
2993 | 3137 | //#define MBEDTLS_PLATFORM_PRINTF_MACRO printf /**< Default printf macro to use, can be undefined */
|
2994 |
| -/* Note: your snprintf must correclty zero-terminate the buffer! */ |
| 3138 | +/* Note: your snprintf must correctly zero-terminate the buffer! */ |
2995 | 3139 | //#define MBEDTLS_PLATFORM_SNPRINTF_MACRO snprintf /**< Default snprintf macro to use, can be undefined */
|
| 3140 | +//#define MBEDTLS_PLATFORM_VSNPRINTF_MACRO vsnprintf /**< Default vsnprintf macro to use, can be undefined */ |
2996 | 3141 | //#define MBEDTLS_PLATFORM_NV_SEED_READ_MACRO mbedtls_platform_std_nv_seed_read /**< Default nv_seed_read function to use, can be undefined */
|
2997 | 3142 | //#define MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO mbedtls_platform_std_nv_seed_write /**< Default nv_seed_write function to use, can be undefined */
|
2998 | 3143 |
|
| 3144 | +/** |
| 3145 | + * \brief This macro is invoked by the library when an invalid parameter |
| 3146 | + * is detected that is only checked with MBEDTLS_CHECK_PARAMS |
| 3147 | + * (see the documentation of that option for context). |
| 3148 | + * |
| 3149 | + * When you leave this undefined here, a default definition is |
| 3150 | + * provided that invokes the function mbedtls_param_failed(), |
| 3151 | + * which is declared in platform_util.h for the benefit of the |
| 3152 | + * library, but that you need to define in your application. |
| 3153 | + * |
| 3154 | + * When you define this here, this replaces the default |
| 3155 | + * definition in platform_util.h (which no longer declares the |
| 3156 | + * function mbedtls_param_failed()) and it is your responsibility |
| 3157 | + * to make sure this macro expands to something suitable (in |
| 3158 | + * particular, that all the necessary declarations are visible |
| 3159 | + * from within the library - you can ensure that by providing |
| 3160 | + * them in this file next to the macro definition). |
| 3161 | + * |
| 3162 | + * Note that you may define this macro to expand to nothing, in |
| 3163 | + * which case you don't have to worry about declarations or |
| 3164 | + * definitions. However, you will then be notified about invalid |
| 3165 | + * parameters only in non-void functions, and void function will |
| 3166 | + * just silently return early on invalid parameters, which |
| 3167 | + * partially negates the benefits of enabling |
| 3168 | + * #MBEDTLS_CHECK_PARAMS in the first place, so is discouraged. |
| 3169 | + * |
| 3170 | + * \param cond The expression that should evaluate to true, but doesn't. |
| 3171 | + */ |
| 3172 | +//#define MBEDTLS_PARAM_FAILED( cond ) assert( cond ) |
| 3173 | + |
2999 | 3174 | /* SSL Cache options */
|
3000 | 3175 | //#define MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT 86400 /**< 1 day */
|
3001 | 3176 | //#define MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES 50 /**< Maximum entries in cache */
|
|
3004 | 3179 |
|
3005 | 3180 | /** \def MBEDTLS_SSL_MAX_CONTENT_LEN
|
3006 | 3181 | *
|
3007 |
| - * Maximum fragment length in bytes. |
| 3182 | + * Maximum length (in bytes) of incoming and outgoing plaintext fragments. |
| 3183 | + * |
| 3184 | + * This determines the size of both the incoming and outgoing TLS I/O buffers |
| 3185 | + * in such a way that both are capable of holding the specified amount of |
| 3186 | + * plaintext data, regardless of the protection mechanism used. |
| 3187 | + * |
| 3188 | + * To configure incoming and outgoing I/O buffers separately, use |
| 3189 | + * #MBEDTLS_SSL_IN_CONTENT_LEN and #MBEDTLS_SSL_OUT_CONTENT_LEN, |
| 3190 | + * which overwrite the value set by this option. |
3008 | 3191 | *
|
3009 |
| - * Determines the size of both the incoming and outgoing TLS I/O buffers. |
| 3192 | + * \note When using a value less than the default of 16KB on the client, it is |
| 3193 | + * recommended to use the Maximum Fragment Length (MFL) extension to |
| 3194 | + * inform the server about this limitation. On the server, there |
| 3195 | + * is no supported, standardized way of informing the client about |
| 3196 | + * restriction on the maximum size of incoming messages, and unless |
| 3197 | + * the limitation has been communicated by other means, it is recommended |
| 3198 | + * to only change the outgoing buffer size #MBEDTLS_SSL_OUT_CONTENT_LEN |
| 3199 | + * while keeping the default value of 16KB for the incoming buffer. |
3010 | 3200 | *
|
3011 |
| - * Uncommenting MBEDTLS_SSL_IN_CONTENT_LEN and/or MBEDTLS_SSL_OUT_CONTENT_LEN |
3012 |
| - * will override this length by setting maximum incoming and/or outgoing |
3013 |
| - * fragment length, respectively. |
| 3201 | + * Uncomment to set the maximum plaintext size of both |
| 3202 | + * incoming and outgoing I/O buffers. |
3014 | 3203 | */
|
3015 | 3204 | //#define MBEDTLS_SSL_MAX_CONTENT_LEN 16384
|
3016 | 3205 |
|
3017 | 3206 | /** \def MBEDTLS_SSL_IN_CONTENT_LEN
|
3018 | 3207 | *
|
3019 |
| - * Maximum incoming fragment length in bytes. |
| 3208 | + * Maximum length (in bytes) of incoming plaintext fragments. |
3020 | 3209 | *
|
3021 |
| - * Uncomment to set the size of the inward TLS buffer independently of the |
3022 |
| - * outward buffer. |
| 3210 | + * This determines the size of the incoming TLS I/O buffer in such a way |
| 3211 | + * that it is capable of holding the specified amount of plaintext data, |
| 3212 | + * regardless of the protection mechanism used. |
| 3213 | + * |
| 3214 | + * If this option is undefined, it inherits its value from |
| 3215 | + * #MBEDTLS_SSL_MAX_CONTENT_LEN. |
| 3216 | + * |
| 3217 | + * \note When using a value less than the default of 16KB on the client, it is |
| 3218 | + * recommended to use the Maximum Fragment Length (MFL) extension to |
| 3219 | + * inform the server about this limitation. On the server, there |
| 3220 | + * is no supported, standardized way of informing the client about |
| 3221 | + * restriction on the maximum size of incoming messages, and unless |
| 3222 | + * the limitation has been communicated by other means, it is recommended |
| 3223 | + * to only change the outgoing buffer size #MBEDTLS_SSL_OUT_CONTENT_LEN |
| 3224 | + * while keeping the default value of 16KB for the incoming buffer. |
| 3225 | + * |
| 3226 | + * Uncomment to set the maximum plaintext size of the incoming I/O buffer |
| 3227 | + * independently of the outgoing I/O buffer. |
3023 | 3228 | */
|
3024 | 3229 | //#define MBEDTLS_SSL_IN_CONTENT_LEN 16384
|
3025 | 3230 |
|
3026 | 3231 | /** \def MBEDTLS_SSL_OUT_CONTENT_LEN
|
3027 | 3232 | *
|
3028 |
| - * Maximum outgoing fragment length in bytes. |
| 3233 | + * Maximum length (in bytes) of outgoing plaintext fragments. |
| 3234 | + * |
| 3235 | + * This determines the size of the outgoing TLS I/O buffer in such a way |
| 3236 | + * that it is capable of holding the specified amount of plaintext data, |
| 3237 | + * regardless of the protection mechanism used. |
3029 | 3238 | *
|
3030 |
| - * Uncomment to set the size of the outward TLS buffer independently of the |
3031 |
| - * inward buffer. |
| 3239 | + * If this option undefined, it inherits its value from |
| 3240 | + * #MBEDTLS_SSL_MAX_CONTENT_LEN. |
3032 | 3241 | *
|
3033 | 3242 | * It is possible to save RAM by setting a smaller outward buffer, while keeping
|
3034 | 3243 | * the default inward 16384 byte buffer to conform to the TLS specification.
|
|
3038 | 3247 | * The specific size requirement depends on the configured ciphers and any
|
3039 | 3248 | * certificate data which is sent during the handshake.
|
3040 | 3249 | *
|
3041 |
| - * For absolute minimum RAM usage, it's best to enable |
3042 |
| - * MBEDTLS_SSL_MAX_FRAGMENT_LENGTH and reduce MBEDTLS_SSL_MAX_CONTENT_LEN. This |
3043 |
| - * reduces both incoming and outgoing buffer sizes. However this is only |
3044 |
| - * guaranteed if the other end of the connection also supports the TLS |
3045 |
| - * max_fragment_len extension. Otherwise the connection may fail. |
| 3250 | + * Uncomment to set the maximum plaintext size of the outgoing I/O buffer |
| 3251 | + * independently of the incoming I/O buffer. |
3046 | 3252 | */
|
3047 | 3253 | //#define MBEDTLS_SSL_OUT_CONTENT_LEN 16384
|
3048 | 3254 |
|
|
0 commit comments