Skip to content

Commit e820662

Browse files
committed
Update config-default.h to the latest from Mbed TLS
config-default.h should always be a verbatim copy of the default configuration (include/mbedtls/config.h) from Mbed TLS.
1 parent 67ea2c5 commit e820662

File tree

1 file changed

+230
-24
lines changed

1 file changed

+230
-24
lines changed

configs/config-default.h

Lines changed: 230 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
*
140140
* System has time.h, time(), and an implementation for
141141
* 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
143143
* the date should be correct). This is used to verify the validity period of
144144
* X.509 certificates.
145145
*
@@ -226,6 +226,7 @@
226226
//#define MBEDTLS_PLATFORM_FPRINTF_ALT
227227
//#define MBEDTLS_PLATFORM_PRINTF_ALT
228228
//#define MBEDTLS_PLATFORM_SNPRINTF_ALT
229+
//#define MBEDTLS_PLATFORM_VSNPRINTF_ALT
229230
//#define MBEDTLS_PLATFORM_NV_SEED_ALT
230231
//#define MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT
231232

@@ -256,6 +257,48 @@
256257
*/
257258
//#define MBEDTLS_DEPRECATED_REMOVED
258259

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+
259302
/* \} name SECTION: System support */
260303

261304
/**
@@ -359,7 +402,7 @@
359402
* \note Because of a signature change, the core AES encryption and decryption routines are
360403
* currently named mbedtls_aes_internal_encrypt and mbedtls_aes_internal_decrypt,
361404
* 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
363406
* must stay untouched.
364407
*
365408
* \note If you use the AES_xxx_ALT macros, then is is recommended to also set
@@ -414,11 +457,11 @@
414457
* unsigned char mbedtls_internal_ecp_grp_capable(
415458
* const mbedtls_ecp_group *grp )
416459
* 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 )
418461
* The mbedtls_internal_ecp_grp_capable function should return 1 if the
419462
* replacement functions implement arithmetic for the given group and 0
420463
* 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
422465
* called before and after each point operation and provide an opportunity to
423466
* implement optimized set up and tear down instructions.
424467
*
@@ -1159,6 +1202,30 @@
11591202
*/
11601203
#define MBEDTLS_PKCS1_V21
11611204

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+
11621229
/**
11631230
* \def MBEDTLS_RSA_NO_CRT
11641231
*
@@ -1496,7 +1563,7 @@
14961563
* \def MBEDTLS_SSL_SESSION_TICKETS
14971564
*
14981565
* 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
15001567
* session store remains the responsibility of the application, though).
15011568
* Server-side, you also need to provide callbacks for writing and parsing
15021569
* tickets, including authenticated encryption and key management. Example
@@ -1582,6 +1649,24 @@
15821649
*/
15831650
//#define MBEDTLS_THREADING_PTHREAD
15841651

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+
15851670
/**
15861671
* \def MBEDTLS_VERSION_FEATURES
15871672
*
@@ -1662,7 +1747,7 @@
16621747
*
16631748
* \warning TLS-level compression MAY REDUCE SECURITY! See for example the
16641749
* 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.
16661751
*
16671752
* \note Currently compression can't be used with DTLS.
16681753
*
@@ -2590,6 +2675,65 @@
25902675
*/
25912676
#define MBEDTLS_POLY1305_C
25922677

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+
25932737
/**
25942738
* \def MBEDTLS_RIPEMD160_C
25952739
*
@@ -2974,7 +3118,7 @@
29743118
//#define MBEDTLS_PLATFORM_STD_TIME time /**< Default time to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */
29753119
//#define MBEDTLS_PLATFORM_STD_FPRINTF fprintf /**< Default fprintf to use, can be undefined */
29763120
//#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! */
29783122
//#define MBEDTLS_PLATFORM_STD_SNPRINTF snprintf /**< Default snprintf to use, can be undefined */
29793123
//#define MBEDTLS_PLATFORM_STD_EXIT_SUCCESS 0 /**< Default exit value to use, can be undefined */
29803124
//#define MBEDTLS_PLATFORM_STD_EXIT_FAILURE 1 /**< Default exit value to use, can be undefined */
@@ -2991,11 +3135,42 @@
29913135
//#define MBEDTLS_PLATFORM_TIME_TYPE_MACRO time_t /**< Default time macro to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */
29923136
//#define MBEDTLS_PLATFORM_FPRINTF_MACRO fprintf /**< Default fprintf macro to use, can be undefined */
29933137
//#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! */
29953139
//#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 */
29963141
//#define MBEDTLS_PLATFORM_NV_SEED_READ_MACRO mbedtls_platform_std_nv_seed_read /**< Default nv_seed_read function to use, can be undefined */
29973142
//#define MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO mbedtls_platform_std_nv_seed_write /**< Default nv_seed_write function to use, can be undefined */
29983143

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+
29993174
/* SSL Cache options */
30003175
//#define MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT 86400 /**< 1 day */
30013176
//#define MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES 50 /**< Maximum entries in cache */
@@ -3004,31 +3179,65 @@
30043179

30053180
/** \def MBEDTLS_SSL_MAX_CONTENT_LEN
30063181
*
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.
30083191
*
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.
30103200
*
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.
30143203
*/
30153204
//#define MBEDTLS_SSL_MAX_CONTENT_LEN 16384
30163205

30173206
/** \def MBEDTLS_SSL_IN_CONTENT_LEN
30183207
*
3019-
* Maximum incoming fragment length in bytes.
3208+
* Maximum length (in bytes) of incoming plaintext fragments.
30203209
*
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.
30233228
*/
30243229
//#define MBEDTLS_SSL_IN_CONTENT_LEN 16384
30253230

30263231
/** \def MBEDTLS_SSL_OUT_CONTENT_LEN
30273232
*
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.
30293238
*
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.
30323241
*
30333242
* It is possible to save RAM by setting a smaller outward buffer, while keeping
30343243
* the default inward 16384 byte buffer to conform to the TLS specification.
@@ -3038,11 +3247,8 @@
30383247
* The specific size requirement depends on the configured ciphers and any
30393248
* certificate data which is sent during the handshake.
30403249
*
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.
30463252
*/
30473253
//#define MBEDTLS_SSL_OUT_CONTENT_LEN 16384
30483254

0 commit comments

Comments
 (0)