Skip to content

Commit a2d62f9

Browse files
authored
Merge pull request #14652 from Patater/upgrade-mbedtls-2.25.0
tls: Upgrade to Mbed TLS v2.25.0
2 parents 8c2db15 + c780165 commit a2d62f9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+7032
-2140
lines changed

connectivity/mbedtls/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ target_sources(mbed-mbedtls
8484
source/ssl_srv.c
8585
source/ssl_ticket.c
8686
source/ssl_tls.c
87+
source/ssl_tls13_keys.c
8788
source/threading.c
8889
source/timing.c
8990
source/version.c

connectivity/mbedtls/VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
mbedtls-2.22.0
1+
v2.25.0

connectivity/mbedtls/include/mbedtls/bignum.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@
6161
* Maximum window size used for modular exponentiation. Default: 6
6262
* Minimum value: 1. Maximum value: 6.
6363
*
64-
* Result is an array of ( 2 << MBEDTLS_MPI_WINDOW_SIZE ) MPIs used
64+
* Result is an array of ( 2 ** MBEDTLS_MPI_WINDOW_SIZE ) MPIs used
6565
* for the sliding window calculation. (So 64 by default)
6666
*
6767
* Reduction in size, reduces speed.
6868
*/
69-
#define MBEDTLS_MPI_WINDOW_SIZE 6 /**< Maximum windows size used. */
69+
#define MBEDTLS_MPI_WINDOW_SIZE 6 /**< Maximum window size used. */
7070
#endif /* !MBEDTLS_MPI_WINDOW_SIZE */
7171

7272
#if !defined(MBEDTLS_MPI_MAX_SIZE)

connectivity/mbedtls/include/mbedtls/ccm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ void mbedtls_ccm_free( mbedtls_ccm_context *ctx );
148148
* than zero, \p output must be a writable buffer of at least
149149
* that length.
150150
* \param tag The buffer holding the authentication field. This must be a
151-
* readable buffer of at least \p tag_len Bytes.
151+
* writable buffer of at least \p tag_len Bytes.
152152
* \param tag_len The length of the authentication field to generate in Bytes:
153153
* 4, 6, 8, 10, 12, 14 or 16.
154154
*
@@ -193,7 +193,7 @@ int mbedtls_ccm_encrypt_and_tag( mbedtls_ccm_context *ctx, size_t length,
193193
* than zero, \p output must be a writable buffer of at least
194194
* that length.
195195
* \param tag The buffer holding the authentication field. This must be a
196-
* readable buffer of at least \p tag_len Bytes.
196+
* writable buffer of at least \p tag_len Bytes.
197197
* \param tag_len The length of the authentication field to generate in Bytes:
198198
* 0, 4, 6, 8, 10, 12, 14 or 16.
199199
*

connectivity/mbedtls/include/mbedtls/check_config.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,11 @@
604604
#error "MBEDTLS_PSA_ITS_FILE_C defined, but not all prerequisites"
605605
#endif
606606

607+
#if defined(MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER) && \
608+
defined(MBEDTLS_USE_PSA_CRYPTO)
609+
#error "MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER defined, but it cannot coexist with MBEDTLS_USE_PSA_CRYPTO."
610+
#endif
611+
607612
#if defined(MBEDTLS_RSA_C) && ( !defined(MBEDTLS_BIGNUM_C) || \
608613
!defined(MBEDTLS_OID_C) )
609614
#error "MBEDTLS_RSA_C defined, but not all prerequisites"
@@ -866,6 +871,10 @@
866871
#endif /* MBEDTLS_DEPRECATED_REMOVED */
867872
#endif /* MBEDTLS_SSL_HW_RECORD_ACCEL */
868873

874+
#if defined(MBEDTLS_SSL_DTLS_SRTP) && ( !defined(MBEDTLS_SSL_PROTO_DTLS) )
875+
#error "MBEDTLS_SSL_DTLS_SRTP defined, but not all prerequisites"
876+
#endif
877+
869878
/*
870879
* Avoid warning from -pedantic. This is a convenient place for this
871880
* workaround since this is included by every single file before the

connectivity/mbedtls/include/mbedtls/cipher.h

Lines changed: 206 additions & 36 deletions
Large diffs are not rendered by default.

connectivity/mbedtls/include/mbedtls/cipher_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ typedef enum
134134
typedef struct
135135
{
136136
psa_algorithm_t alg;
137-
psa_key_handle_t slot;
137+
psa_key_id_t slot;
138138
mbedtls_cipher_psa_key_ownership slot_state;
139139
} mbedtls_cipher_context_psa;
140140
#endif /* MBEDTLS_USE_PSA_CRYPTO */

connectivity/mbedtls/include/mbedtls/config.h

Lines changed: 72 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@
880880
* may result in a compromise of the long-term signing key. This is avoided by
881881
* the deterministic variant.
882882
*
883-
* Requires: MBEDTLS_HMAC_DRBG_C
883+
* Requires: MBEDTLS_HMAC_DRBG_C, MBEDTLS_ECDSA_C
884884
*
885885
* Comment this macro to disable deterministic ECDSA.
886886
*/
@@ -1274,20 +1274,17 @@
12741274
*/
12751275
//#define MBEDTLS_ENTROPY_NV_SEED
12761276

1277-
/* MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER
1277+
/* MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
12781278
*
1279-
* In PSA key storage, encode the owner of the key.
1279+
* Enable key identifiers that encode a key owner identifier.
12801280
*
1281-
* This is only meaningful when building the library as part of a
1282-
* multi-client service. When you activate this option, you must provide
1283-
* an implementation of the type psa_key_owner_id_t and a translation
1284-
* from psa_key_file_id_t to file name in all the storage backends that
1285-
* you wish to support.
1281+
* The owner of a key is identified by a value of type ::mbedtls_key_owner_id_t
1282+
* which is currently hard-coded to be int32_t.
12861283
*
12871284
* Note that this option is meant for internal use only and may be removed
1288-
* without notice.
1285+
* without notice. It is incompatible with MBEDTLS_USE_PSA_CRYPTO.
12891286
*/
1290-
//#define MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER
1287+
//#define MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
12911288

12921289
/**
12931290
* \def MBEDTLS_MEMORY_DEBUG
@@ -1345,6 +1342,17 @@
13451342
*/
13461343
#define MBEDTLS_PKCS1_V21
13471344

1345+
/** \def MBEDTLS_PSA_CRYPTO_DRIVERS
1346+
*
1347+
* Enable support for the experimental PSA crypto driver interface.
1348+
*
1349+
* Requires: MBEDTLS_PSA_CRYPTO_C
1350+
*
1351+
* \warning This interface is experimental and may change or be removed
1352+
* without notice.
1353+
*/
1354+
//#define MBEDTLS_PSA_CRYPTO_DRIVERS
1355+
13481356
/**
13491357
* \def MBEDTLS_PSA_CRYPTO_SPM
13501358
*
@@ -1820,6 +1828,37 @@
18201828
*/
18211829
#define MBEDTLS_SSL_DTLS_HELLO_VERIFY
18221830

1831+
/**
1832+
* \def MBEDTLS_SSL_DTLS_SRTP
1833+
*
1834+
* Enable support for negotation of DTLS-SRTP (RFC 5764)
1835+
* through the use_srtp extension.
1836+
*
1837+
* \note This feature provides the minimum functionality required
1838+
* to negotiate the use of DTLS-SRTP and to allow the derivation of
1839+
* the associated SRTP packet protection key material.
1840+
* In particular, the SRTP packet protection itself, as well as the
1841+
* demultiplexing of RTP and DTLS packets at the datagram layer
1842+
* (see Section 5 of RFC 5764), are not handled by this feature.
1843+
* Instead, after successful completion of a handshake negotiating
1844+
* the use of DTLS-SRTP, the extended key exporter API
1845+
* mbedtls_ssl_conf_export_keys_ext_cb() should be used to implement
1846+
* the key exporter described in Section 4.2 of RFC 5764 and RFC 5705
1847+
* (this is implemented in the SSL example programs).
1848+
* The resulting key should then be passed to an SRTP stack.
1849+
*
1850+
* Setting this option enables the runtime API
1851+
* mbedtls_ssl_conf_dtls_srtp_protection_profiles()
1852+
* through which the supported DTLS-SRTP protection
1853+
* profiles can be configured. You must call this API at
1854+
* runtime if you wish to negotiate the use of DTLS-SRTP.
1855+
*
1856+
* Requires: MBEDTLS_SSL_PROTO_DTLS
1857+
*
1858+
* Uncomment this to enable support for use_srtp extension.
1859+
*/
1860+
//#define MBEDTLS_SSL_DTLS_SRTP
1861+
18231862
/**
18241863
* \def MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE
18251864
*
@@ -2027,6 +2066,24 @@
20272066
*/
20282067
//#define MBEDTLS_USE_PSA_CRYPTO
20292068

2069+
/**
2070+
* \def MBEDTLS_PSA_CRYPTO_CONFIG
2071+
*
2072+
* This setting allows support for cryptographic mechanisms through the PSA
2073+
* API to be configured separately from support through the mbedtls API.
2074+
*
2075+
* Uncomment this to enable use of PSA Crypto configuration settings which
2076+
* can be found in include/psa/crypto_config.h.
2077+
*
2078+
* If you enable this option and write your own configuration file, you must
2079+
* include mbedtls/config_psa.h in your configuration file. The default
2080+
* provided mbedtls/config.h contains the necessary inclusion.
2081+
*
2082+
* This feature is still experimental and is not ready for production since
2083+
* it is not completed.
2084+
*/
2085+
//#define MBEDTLS_PSA_CRYPTO_CONFIG
2086+
20302087
/**
20312088
* \def MBEDTLS_VERSION_FEATURES
20322089
*
@@ -3466,7 +3523,7 @@
34663523
*/
34673524

34683525
/* MPI / BIGNUM options */
3469-
//#define MBEDTLS_MPI_WINDOW_SIZE 6 /**< Maximum windows size used. */
3526+
//#define MBEDTLS_MPI_WINDOW_SIZE 6 /**< Maximum window size used. */
34703527
#define MBEDTLS_MPI_MAX_SIZE 512
34713528

34723529
/* CTR_DRBG options */
@@ -3819,6 +3876,10 @@
38193876
#include MBEDTLS_USER_CONFIG_FILE
38203877
#endif
38213878

3879+
#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
3880+
#include "mbedtls/config_psa.h"
3881+
#endif
3882+
38223883
#include "mbedtls/check_config.h"
38233884

38243885

0 commit comments

Comments
 (0)