Skip to content

Commit 2ae19f5

Browse files
committed
Update mbedTLS to 3.6.3
1 parent 7c254e8 commit 2ae19f5

Some content is hidden

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

50 files changed

+1017
-363
lines changed

vendor/mbedtls/3rdparty/everest/include/everest/kremlin/c_endianness.h

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include <string.h>
88
#include <inttypes.h>
99

10+
#include "kremlin/internal/callconv.h"
11+
1012
/******************************************************************************/
1113
/* Implementing C.fst (part 2: endian-ness macros) */
1214
/******************************************************************************/

vendor/mbedtls/3rdparty/everest/include/everest/kremlin/internal/callconv.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@
2727
/* Since KreMLin emits the inline keyword unconditionally, we follow the
2828
* guidelines at https://gcc.gnu.org/onlinedocs/gcc/Inline.html and make this
2929
* __inline__ to ensure the code compiles with -std=c90 and earlier. */
30-
#ifdef __GNUC__
30+
#if defined(__GNUC__)
3131
# define inline __inline__
32+
#elif defined(_MSC_VER)
33+
# define inline __inline
3234
#endif
3335

3436
/* GCC-specific attribute syntax; everyone else gets the standard C inline

vendor/mbedtls/3rdparty/everest/include/everest/vs2013/inttypes.h

-36
This file was deleted.

vendor/mbedtls/3rdparty/everest/include/everest/vs2013/stdbool.h

-31
This file was deleted.

vendor/mbedtls/include/mbedtls/build_info.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@
2626
*/
2727
#define MBEDTLS_VERSION_MAJOR 3
2828
#define MBEDTLS_VERSION_MINOR 6
29-
#define MBEDTLS_VERSION_PATCH 2
29+
#define MBEDTLS_VERSION_PATCH 3
3030

3131
/**
3232
* The single version number has the following structure:
3333
* MMNNPP00
3434
* Major version | Minor version | Patch version
3535
*/
36-
#define MBEDTLS_VERSION_NUMBER 0x03060200
37-
#define MBEDTLS_VERSION_STRING "3.6.2"
38-
#define MBEDTLS_VERSION_STRING_FULL "Mbed TLS 3.6.2"
36+
#define MBEDTLS_VERSION_NUMBER 0x03060300
37+
#define MBEDTLS_VERSION_STRING "3.6.3"
38+
#define MBEDTLS_VERSION_STRING_FULL "Mbed TLS 3.6.3"
3939

4040
/* Macros for build-time platform detection */
4141

vendor/mbedtls/include/mbedtls/check_config.h

+8
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@
247247
#if defined(MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN) && !defined(MBEDTLS_HAS_MEMSAN)
248248
#error "MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN requires building with MemorySanitizer"
249249
#endif
250+
#if defined(MBEDTLS_HAS_MEMSAN) && defined(MBEDTLS_HAVE_ASM)
251+
#error "MemorySanitizer does not support assembly implementation"
252+
#endif
250253
#undef MBEDTLS_HAS_MEMSAN // temporary macro defined above
251254

252255
#if defined(MBEDTLS_CCM_C) && \
@@ -738,6 +741,11 @@
738741
#error "MBEDTLS_PSA_INJECT_ENTROPY is not compatible with MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG"
739742
#endif
740743

744+
#if defined(MBEDTLS_PSA_KEY_STORE_DYNAMIC) && \
745+
defined(MBEDTLS_PSA_STATIC_KEY_SLOTS)
746+
#error "MBEDTLS_PSA_KEY_STORE_DYNAMIC and MBEDTLS_PSA_STATIC_KEY_SLOTS cannot be defined simultaneously"
747+
#endif
748+
741749
#if defined(MBEDTLS_PSA_ITS_FILE_C) && \
742750
!defined(MBEDTLS_FS_IO)
743751
#error "MBEDTLS_PSA_ITS_FILE_C defined, but not all prerequisites"

vendor/mbedtls/include/mbedtls/config_adjust_legacy_crypto.h

+67-8
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@
4848
#endif
4949
#endif /* _MINGW32__ || (_MSC_VER && (_MSC_VER <= 1900)) */
5050

51+
/* If MBEDTLS_PSA_CRYPTO_C is defined, make sure MBEDTLS_PSA_CRYPTO_CLIENT
52+
* is defined as well to include all PSA code.
53+
*/
54+
#if defined(MBEDTLS_PSA_CRYPTO_C)
55+
#define MBEDTLS_PSA_CRYPTO_CLIENT
56+
#endif /* MBEDTLS_PSA_CRYPTO_C */
57+
5158
/* Auto-enable CIPHER_C when any of the unauthenticated ciphers is builtin
5259
* in PSA. */
5360
#if defined(MBEDTLS_PSA_CRYPTO_C) && \
@@ -158,7 +165,66 @@
158165
#define MBEDTLS_MD_SHA3_512_VIA_PSA
159166
#define MBEDTLS_MD_SOME_PSA
160167
#endif
161-
#endif /* MBEDTLS_PSA_CRYPTO_C */
168+
169+
#elif defined(MBEDTLS_PSA_CRYPTO_CLIENT)
170+
171+
#if defined(PSA_WANT_ALG_MD5)
172+
#define MBEDTLS_MD_CAN_MD5
173+
#define MBEDTLS_MD_MD5_VIA_PSA
174+
#define MBEDTLS_MD_SOME_PSA
175+
#endif
176+
#if defined(PSA_WANT_ALG_SHA_1)
177+
#define MBEDTLS_MD_CAN_SHA1
178+
#define MBEDTLS_MD_SHA1_VIA_PSA
179+
#define MBEDTLS_MD_SOME_PSA
180+
#endif
181+
#if defined(PSA_WANT_ALG_SHA_224)
182+
#define MBEDTLS_MD_CAN_SHA224
183+
#define MBEDTLS_MD_SHA224_VIA_PSA
184+
#define MBEDTLS_MD_SOME_PSA
185+
#endif
186+
#if defined(PSA_WANT_ALG_SHA_256)
187+
#define MBEDTLS_MD_CAN_SHA256
188+
#define MBEDTLS_MD_SHA256_VIA_PSA
189+
#define MBEDTLS_MD_SOME_PSA
190+
#endif
191+
#if defined(PSA_WANT_ALG_SHA_384)
192+
#define MBEDTLS_MD_CAN_SHA384
193+
#define MBEDTLS_MD_SHA384_VIA_PSA
194+
#define MBEDTLS_MD_SOME_PSA
195+
#endif
196+
#if defined(PSA_WANT_ALG_SHA_512)
197+
#define MBEDTLS_MD_CAN_SHA512
198+
#define MBEDTLS_MD_SHA512_VIA_PSA
199+
#define MBEDTLS_MD_SOME_PSA
200+
#endif
201+
#if defined(PSA_WANT_ALG_RIPEMD160)
202+
#define MBEDTLS_MD_CAN_RIPEMD160
203+
#define MBEDTLS_MD_RIPEMD160_VIA_PSA
204+
#define MBEDTLS_MD_SOME_PSA
205+
#endif
206+
#if defined(PSA_WANT_ALG_SHA3_224)
207+
#define MBEDTLS_MD_CAN_SHA3_224
208+
#define MBEDTLS_MD_SHA3_224_VIA_PSA
209+
#define MBEDTLS_MD_SOME_PSA
210+
#endif
211+
#if defined(PSA_WANT_ALG_SHA3_256)
212+
#define MBEDTLS_MD_CAN_SHA3_256
213+
#define MBEDTLS_MD_SHA3_256_VIA_PSA
214+
#define MBEDTLS_MD_SOME_PSA
215+
#endif
216+
#if defined(PSA_WANT_ALG_SHA3_384)
217+
#define MBEDTLS_MD_CAN_SHA3_384
218+
#define MBEDTLS_MD_SHA3_384_VIA_PSA
219+
#define MBEDTLS_MD_SOME_PSA
220+
#endif
221+
#if defined(PSA_WANT_ALG_SHA3_512)
222+
#define MBEDTLS_MD_CAN_SHA3_512
223+
#define MBEDTLS_MD_SHA3_512_VIA_PSA
224+
#define MBEDTLS_MD_SOME_PSA
225+
#endif
226+
227+
#endif /* !MBEDTLS_PSA_CRYPTO_CLIENT && !MBEDTLS_PSA_CRYPTO_C */
162228

163229
/* Built-in implementations */
164230
#if defined(MBEDTLS_MD5_C)
@@ -352,13 +418,6 @@
352418
#define MBEDTLS_PK_CAN_ECDSA_SOME
353419
#endif
354420

355-
/* If MBEDTLS_PSA_CRYPTO_C is defined, make sure MBEDTLS_PSA_CRYPTO_CLIENT
356-
* is defined as well to include all PSA code.
357-
*/
358-
#if defined(MBEDTLS_PSA_CRYPTO_C)
359-
#define MBEDTLS_PSA_CRYPTO_CLIENT
360-
#endif /* MBEDTLS_PSA_CRYPTO_C */
361-
362421
/* Helpers to state that each key is supported either on the builtin or PSA side. */
363422
#if defined(MBEDTLS_ECP_DP_SECP521R1_ENABLED) || defined(PSA_WANT_ECC_SECP_R1_521)
364423
#define MBEDTLS_ECP_HAVE_SECP521R1

vendor/mbedtls/include/mbedtls/config_adjust_legacy_from_psa.h

-19
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
(defined(PSA_WANT_ECC_SECP_R1_384) && !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_384)) || \
7070
(defined(PSA_WANT_ECC_SECP_R1_521) && !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_R1_521)) || \
7171
(defined(PSA_WANT_ECC_SECP_K1_192) && !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_192)) || \
72-
(defined(PSA_WANT_ECC_SECP_K1_224) && !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_224)) || \
7372
(defined(PSA_WANT_ECC_SECP_K1_256) && !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_256))
7473
#define MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_CURVES
7574
#define MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_WEIERSTRASS_CURVES
@@ -225,17 +224,6 @@
225224
#endif /* missing accel */
226225
#endif /* PSA_WANT_ECC_SECP_K1_192 */
227226

228-
#if defined(PSA_WANT_ECC_SECP_K1_224)
229-
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_224) || \
230-
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_KEY_TYPES) || \
231-
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_ALGS)
232-
#define MBEDTLS_PSA_BUILTIN_ECC_SECP_K1_224 1
233-
#define MBEDTLS_ECP_DP_SECP224K1_ENABLED
234-
/* https://github.com/Mbed-TLS/mbedtls/issues/3541 */
235-
#error "SECP224K1 is buggy via the PSA API in Mbed TLS."
236-
#endif /* missing accel */
237-
#endif /* PSA_WANT_ECC_SECP_K1_224 */
238-
239227
#if defined(PSA_WANT_ECC_SECP_K1_256)
240228
#if !defined(MBEDTLS_PSA_ACCEL_ECC_SECP_K1_256) || \
241229
defined(MBEDTLS_PSA_ECC_ACCEL_INCOMPLETE_KEY_TYPES) || \
@@ -782,13 +770,6 @@
782770
#define PSA_HAVE_SOFT_BLOCK_CIPHER 1
783771
#endif
784772

785-
#if defined(PSA_WANT_ALG_CBC_MAC)
786-
#if !defined(MBEDTLS_PSA_ACCEL_ALG_CBC_MAC)
787-
#error "CBC-MAC is not yet supported via the PSA API in Mbed TLS."
788-
#define MBEDTLS_PSA_BUILTIN_ALG_CBC_MAC 1
789-
#endif /* !MBEDTLS_PSA_ACCEL_ALG_CBC_MAC */
790-
#endif /* PSA_WANT_ALG_CBC_MAC */
791-
792773
#if defined(PSA_WANT_ALG_CMAC)
793774
#if !defined(MBEDTLS_PSA_ACCEL_ALG_CMAC) || \
794775
defined(PSA_HAVE_SOFT_BLOCK_CIPHER)

vendor/mbedtls/include/mbedtls/config_adjust_psa_superset_legacy.h

-7
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,6 @@
136136
#endif /* PSA_WANT_ECC_SECP_K1_192 */
137137
#endif /* MBEDTLS_ECP_DP_SECP192K1_ENABLED */
138138

139-
/* SECP224K1 is buggy via the PSA API (https://github.com/Mbed-TLS/mbedtls/issues/3541) */
140-
#if 0 && defined(MBEDTLS_ECP_DP_SECP224K1_ENABLED)
141-
#if !defined(PSA_WANT_ECC_SECP_K1_224)
142-
#define PSA_WANT_ECC_SECP_K1_224 1
143-
#endif /* PSA_WANT_ECC_SECP_K1_224 */
144-
#endif /* MBEDTLS_ECP_DP_SECP224K1_ENABLED */
145-
146139
#if defined(MBEDTLS_ECP_DP_SECP256K1_ENABLED)
147140
#if !defined(PSA_WANT_ECC_SECP_K1_256)
148141
#define PSA_WANT_ECC_SECP_K1_256 1

vendor/mbedtls/include/mbedtls/debug.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,16 @@
108108
*
109109
* This module provides debugging functions.
110110
*/
111-
#if (defined(__MINGW32__) && __USE_MINGW_ANSI_STDIO == 0) || (defined(_MSC_VER) && _MSC_VER < 1800)
111+
#if defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER < 1900)
112112
#include <inttypes.h>
113113
#define MBEDTLS_PRINTF_SIZET PRIuPTR
114114
#define MBEDTLS_PRINTF_LONGLONG "I64d"
115115
#else \
116-
/* (defined(__MINGW32__) && __USE_MINGW_ANSI_STDIO == 0) || (defined(_MSC_VER) && _MSC_VER < 1800) */
116+
/* defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER < 1900) */
117117
#define MBEDTLS_PRINTF_SIZET "zu"
118118
#define MBEDTLS_PRINTF_LONGLONG "lld"
119119
#endif \
120-
/* (defined(__MINGW32__) && __USE_MINGW_ANSI_STDIO == 0) || (defined(_MSC_VER) && _MSC_VER < 1800) */
120+
/* defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER < 1900) */
121121

122122
#if !defined(MBEDTLS_PRINTF_MS_TIME)
123123
#include <inttypes.h>

vendor/mbedtls/include/mbedtls/entropy.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717

1818
#include "md.h"
1919

20-
#if defined(MBEDTLS_MD_CAN_SHA512) && !defined(MBEDTLS_ENTROPY_FORCE_SHA256)
20+
#if (defined(MBEDTLS_MD_CAN_SHA512) || defined(PSA_WANT_ALG_SHA_512)) && \
21+
!defined(MBEDTLS_ENTROPY_FORCE_SHA256)
2122
#define MBEDTLS_ENTROPY_SHA512_ACCUMULATOR
2223
#define MBEDTLS_ENTROPY_MD MBEDTLS_MD_SHA512
2324
#define MBEDTLS_ENTROPY_BLOCK_SIZE 64 /**< Block size of entropy accumulator (SHA-512) */
2425
#else
25-
#if defined(MBEDTLS_MD_CAN_SHA256)
26+
#if (defined(MBEDTLS_MD_CAN_SHA256) || defined(PSA_WANT_ALG_SHA_256))
2627
#define MBEDTLS_ENTROPY_SHA256_ACCUMULATOR
2728
#define MBEDTLS_ENTROPY_MD MBEDTLS_MD_SHA256
2829
#define MBEDTLS_ENTROPY_BLOCK_SIZE 32 /**< Block size of entropy accumulator (SHA-256) */

vendor/mbedtls/include/mbedtls/error.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
* MD 5 5
8282
* HKDF 5 1 (Started from top)
8383
* PKCS7 5 12 (Started from 0x5300)
84-
* SSL 5 2 (Started from 0x5F00)
84+
* SSL 5 3 (Started from 0x5F00)
8585
* CIPHER 6 8 (Started from 0x6080)
8686
* SSL 6 22 (Started from top, plus 0x6000)
8787
* SSL 7 20 (Started from 0x7000, gaps at

vendor/mbedtls/include/mbedtls/gcm.h

+13-10
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,9 @@ int mbedtls_gcm_setkey(mbedtls_gcm_context *ctx,
115115
/**
116116
* \brief This function performs GCM encryption or decryption of a buffer.
117117
*
118-
* \note For encryption, the output buffer can be the same as the
119-
* input buffer. For decryption, the output buffer cannot be
120-
* the same as input buffer. If the buffers overlap, the output
121-
* buffer must trail at least 8 Bytes behind the input buffer.
118+
* \note The output buffer \p output can be the same as the input
119+
* buffer \p input. If \p output is greater than \p input, they
120+
* cannot overlap.
122121
*
123122
* \warning When this function performs a decryption, it outputs the
124123
* authentication tag and does not verify that the data is
@@ -179,9 +178,11 @@ int mbedtls_gcm_crypt_and_tag(mbedtls_gcm_context *ctx,
179178
* \brief This function performs a GCM authenticated decryption of a
180179
* buffer.
181180
*
182-
* \note For decryption, the output buffer cannot be the same as
183-
* input buffer. If the buffers overlap, the output buffer
184-
* must trail at least 8 Bytes behind the input buffer.
181+
* \note The output buffer \p output can be the same as the input
182+
* buffer \p input. If \p output is greater than \p input, they
183+
* cannot overlap. Implementations which require
184+
* MBEDTLS_GCM_ALT to be enabled may not provide support for
185+
* overlapping buffers.
185186
*
186187
* \param ctx The GCM context. This must be initialized.
187188
* \param length The length of the ciphertext to decrypt, which is also
@@ -287,9 +288,11 @@ int mbedtls_gcm_update_ad(mbedtls_gcm_context *ctx,
287288
* to this function during an operation, then it is
288289
* correct to use \p output_size = \p input_length.
289290
*
290-
* \note For decryption, the output buffer cannot be the same as
291-
* input buffer. If the buffers overlap, the output buffer
292-
* must trail at least 8 Bytes behind the input buffer.
291+
* \note The output buffer \p output can be the same as the input
292+
* buffer \p input. If \p output is greater than \p input, they
293+
* cannot overlap. Implementations which require
294+
* MBEDTLS_GCM_ALT to be enabled may not provide support for
295+
* overlapping buffers.
293296
*
294297
* \param ctx The GCM context. This must be initialized.
295298
* \param input The buffer holding the input data. If \p input_length

0 commit comments

Comments
 (0)