Skip to content

Commit 85440ef

Browse files
Merge pull request #74 from ceolin/v3.6.4
update to 3.6.4
2 parents 5f88993 + e25ac53 commit 85440ef

File tree

139 files changed

+4646
-1273
lines changed

Some content is hidden

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

139 files changed

+4646
-1273
lines changed

.pylintrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,17 @@ disable=locally-disabled,locally-enabled,logging-format-interpolation,no-else-re
7070
# Don't diplay statistics. Just the facts.
7171
reports=no
7272

73+
[STRING]
74+
# Complain about
75+
# ```
76+
# list_of_strings = [
77+
# 'foo' # <-- missing comma
78+
# 'bar',
79+
# 'corge',
80+
# ]
81+
# ```
82+
check-str-concat-over-line-jumps=yes
83+
7384
[VARIABLES]
7485
# Allow unused variables if their name starts with an underscore.
7586
# [unused-argument]

CMakeLists.txt

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ cmake_policy(SET CMP0012 NEW)
4040
if(TEST_CPP)
4141
project("Mbed TLS"
4242
LANGUAGES C CXX
43-
VERSION 3.6.3
43+
VERSION 3.6.4
4444
)
4545
else()
4646
project("Mbed TLS"
4747
LANGUAGES C
48-
VERSION 3.6.3
48+
VERSION 3.6.4
4949
)
5050
endif()
5151

@@ -346,35 +346,37 @@ if(ENABLE_TESTING OR ENABLE_PROGRAMS)
346346
if(GEN_FILES)
347347
add_custom_command(
348348
OUTPUT
349-
${CMAKE_CURRENT_SOURCE_DIR}/framework/tests/include/test/test_keys.h
350-
WORKING_DIRECTORY
351-
${CMAKE_CURRENT_SOURCE_DIR}/tests
349+
${CMAKE_CURRENT_BINARY_DIR}/tests/include/test/test_keys.h
350+
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/tests/include/test
352351
COMMAND
353352
"${MBEDTLS_PYTHON_EXECUTABLE}"
354353
"${CMAKE_CURRENT_SOURCE_DIR}/framework/scripts/generate_test_keys.py"
355354
"--output"
356-
"${CMAKE_CURRENT_SOURCE_DIR}/framework/tests/include/test/test_keys.h"
355+
"${CMAKE_CURRENT_BINARY_DIR}/tests/include/test/test_keys.h"
357356
DEPENDS
358357
${CMAKE_CURRENT_SOURCE_DIR}/framework/scripts/generate_test_keys.py
359358
)
360-
add_custom_target(test_keys_header DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/framework/tests/include/test/test_keys.h)
359+
add_custom_target(test_keys_header
360+
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/tests/include/test/test_keys.h)
361361
add_custom_command(
362362
OUTPUT
363-
${CMAKE_CURRENT_SOURCE_DIR}/tests/src/test_certs.h
363+
${CMAKE_CURRENT_BINARY_DIR}/tests/include/test/test_certs.h
364+
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/tests/include/test
364365
WORKING_DIRECTORY
365366
${CMAKE_CURRENT_SOURCE_DIR}/tests
366367
COMMAND
367368
"${MBEDTLS_PYTHON_EXECUTABLE}"
368369
"${CMAKE_CURRENT_SOURCE_DIR}/framework/scripts/generate_test_cert_macros.py"
369370
"--output"
370-
"${CMAKE_CURRENT_SOURCE_DIR}/tests/src/test_certs.h"
371+
"${CMAKE_CURRENT_BINARY_DIR}/tests/include/test/test_certs.h"
371372
DEPENDS
372373
${CMAKE_CURRENT_SOURCE_DIR}/framework/scripts/generate_test_cert_macros.py
373374
)
374-
add_custom_target(test_certs_header DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tests/src/test_certs.h)
375+
add_custom_target(test_certs_header DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/tests/include/test/test_certs.h)
375376
add_dependencies(mbedtls_test test_keys_header test_certs_header)
376377
endif()
377378
target_include_directories(mbedtls_test
379+
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/tests/include
378380
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/framework/tests/include
379381
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tests/include
380382
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
@@ -465,7 +467,7 @@ if(NOT DISABLE_PACKAGE_CONFIG_AND_INSTALL)
465467
write_basic_package_version_file(
466468
"cmake/MbedTLSConfigVersion.cmake"
467469
COMPATIBILITY SameMajorVersion
468-
VERSION 3.6.3)
470+
VERSION 3.6.4)
469471

470472
install(
471473
FILES "${CMAKE_CURRENT_BINARY_DIR}/cmake/MbedTLSConfig.cmake"

ChangeLog

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,115 @@
11
Mbed TLS ChangeLog (Sorted per branch, date)
22

3+
= Mbed TLS 3.6.4 branch released 2025-06-30
4+
5+
Features
6+
* Add the function mbedtls_ssl_export_keying_material() which allows the
7+
client and server to extract additional shared symmetric keys from an SSL
8+
session, according to the TLS-Exporter specification in RFC 8446 and 5705.
9+
This requires MBEDTLS_SSL_KEYING_MATERIAL_EXPORT to be defined in
10+
mbedtls_config.h.
11+
12+
Security
13+
* Fix a buffer overread in mbedtls_lms_import_public_key() when the input is
14+
less than 3 bytes. Reported by Linh Le and Ngan Nguyen from Calif.
15+
CVE-2025-49601
16+
* Fix a vulnerability in LMS verification through which an adversary could
17+
get an invalid signature accepted if they could cause a hash accelerator
18+
to fail. Found and reported by Linh Le and Ngan Nguyen from Calif.
19+
CVE-2025-49600
20+
* On x86/amd64 platforms, with some compilers, when the library is
21+
compiled with support for both AESNI and software AES and AESNI is
22+
available in hardware, an adversary with fine control over which
23+
threads make progress in a multithreaded program could force software
24+
AES to be used for some time when the program starts. This could allow
25+
the adversary to conduct timing attacks and potentially recover the
26+
key. In particular, this attacker model may be possible against an SGX
27+
enclave.
28+
The same vulnerability affects GCM acceleration, which could allow
29+
a similarly powerful adversary to craft GCM forgeries.
30+
CVE-2025-52496
31+
* Fix possible use-after-free or double-free in code calling
32+
mbedtls_x509_string_to_names(). This was caused by the function calling
33+
mbedtls_asn1_free_named_data_list() on its head argument, while the
34+
documentation did no suggest it did, making it likely for callers relying
35+
on the documented behaviour to still hold pointers to memory blocks after
36+
they were free()d, resulting in high risk of use-after-free or double-free,
37+
with consequences ranging up to arbitrary code execution.
38+
In particular, the two sample programs x509/cert_write and x509/cert_req
39+
were affected (use-after-free if the san string contains more than one DN).
40+
Code that does not call mbedtls_string_to_names() directly is not affected.
41+
Found by Linh Le and Ngan Nguyen from Calif.
42+
CVE-2025-47917
43+
* Fix a bug in mbedtls_asn1_store_named_data() where it would sometimes leave
44+
an item in the output list in an inconsistent state with val.p == NULL but
45+
val.len > 0. This impacts applications that call this function directly,
46+
or indirectly via mbedtls_x509_string_to_names() or one of the
47+
mbedtls_x509write_{crt,csr}_set_{subject,issuer}_name() functions. The
48+
inconsistent state of the output could then cause a NULL dereference either
49+
inside the same call to mbedtls_x509_string_to_names(), or in subsequent
50+
users of the output structure, such as mbedtls_x509_write_names(). This
51+
only affects applications that create (as opposed to consume) X.509
52+
certificates, CSRs or CRLs, or that call mbedtls_asn1_store_named_data()
53+
directly. Found by Linh Le and Ngan Nguyen from Calif.
54+
CVE-2025-48965
55+
* Fix an integer underflow that could occur when parsing malformed PEM
56+
keys, which could be used by an attacker capable of feeding encrypted
57+
PEM keys to a user. This could cause a crash or information disclosure.
58+
Found and reported by Linh Le and Ngan Nguyen from Calif.
59+
CVE-2025-52497
60+
* Fix a timing side channel in the implementation of PKCS#7 padding
61+
which would allow an attacker who can request decryption of arbitrary
62+
ciphertexts to recover the plaintext through a timing oracle attack.
63+
Reported by Ka Lok Wu from Stony Brook University and Doria Tang from
64+
The Chinese University of Hong Kong.
65+
CVE-2025-49087
66+
67+
Bugfix
68+
* Fix failures of PSA multipart or interruptible operations when the
69+
library or the application is built with a compiler where
70+
"union foo x = {0}" does not initialize non-default members of the
71+
union, such as GCC 15 and some versions of Clang 18. This affected MAC
72+
multipart operations, MAC-based key derivation operations, interruptible
73+
signature, interruptible verification, and potentially other operations
74+
when using third-party drivers. This also affected one-shot MAC
75+
operations using the built-in implementation. Fixes #9814.
76+
* On entry to PSA driver entry points that set up a multipart operation
77+
("xxx_setup"), the operation object is supposed to be all-bits-zero.
78+
This was sometimes not the case when an operation object is reused,
79+
or with compilers where "union foo x = {0}" does not initialize
80+
non-default members of the union. The PSA core now ensures that this
81+
guarantee is met in all cases. Fixes #9975.
82+
* Resolved build issue with C++ projects using Mbed TLS 3.6 when compiling
83+
with the MSVC toolset v142 and earlier. Fixes mbedtls issue #7087.
84+
* Silence spurious -Wunterminated-string-initialization warnings introduced
85+
by GCC 15. Fixes #9944.
86+
* Fix a sloppy check in LMS public key import, which could lead to accepting
87+
keys with a different LMS or LM-OTS types on some platforms. Specifically,
88+
this could happen on platforms where enum types are smaller than 32 bits
89+
and compiler optimization is enabled. Found and reported by Linh Le and
90+
Ngan Nguyen from Calif.
91+
* Fix a race condition on x86/amd64 platforms in AESNI support detection
92+
that could lead to using software AES in some threads at the very
93+
beginning of a multithreaded program. Reported by Solar Designer.
94+
Fixes #9840.
95+
* Fix mbedtls_base64_decode() on inputs that did not have the correct
96+
number of trailing equal signs, or had 4*k+1 digits. They were accepted
97+
as long as they had at most two trailing equal signs. They are now
98+
rejected. Furthermore, before, on inputs with too few equal signs, the
99+
function reported the correct size in *olen when it returned
100+
MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL, but truncated the output to the
101+
last multiple of 3 bytes.
102+
* When calling mbedtls_asn1_write_raw_buffer() with NULL, 0 as the last two
103+
arguments, undefined behaviour would be triggered, in the form of a call to
104+
memcpy(..., NULL, 0). This was harmless in practice, but could trigger
105+
complains from sanitizers or static analyzers.
106+
107+
Changes
108+
* The function mbedtls_x509_string_to_names() now requires its head argument
109+
to point to NULL on entry. This makes it likely that existing risky uses of
110+
this function (see the entry in the Security section) will be detected and
111+
fixed.
112+
3113
= Mbed TLS 3.6.3 branch released 2025-03-24
4114

5115
Default behavior changes
@@ -35,6 +145,7 @@ Security
35145
The library will now prevent the handshake and return
36146
MBEDTLS_ERR_SSL_CERTIFICATE_VERIFICATION_WITHOUT_HOSTNAME
37147
if mbedtls_ssl_set_hostname() has not been called.
148+
Reported by Daniel Stenberg.
38149
CVE-2025-27809
39150
* Zeroize a temporary heap buffer used in psa_key_derivation_output_key()
40151
when deriving an ECC key pair.

doxygen/input/doc_mainpage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111

1212
/**
13-
* @mainpage Mbed TLS v3.6.3 API Documentation
13+
* @mainpage Mbed TLS v3.6.4 API Documentation
1414
*
1515
* This documentation describes the internal structure of Mbed TLS. It was
1616
* automatically generated from specially formatted comment blocks in

doxygen/mbedtls.doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
PROJECT_NAME = "Mbed TLS v3.6.3"
1+
PROJECT_NAME = "Mbed TLS v3.6.4"
22
OUTPUT_DIRECTORY = ../apidoc/
33
FULL_PATH_NAMES = NO
44
OPTIMIZE_OUTPUT_FOR_C = YES

framework/scripts/all-core.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,7 @@ pre_check_tools () {
853853
case " $RUN_COMPONENTS " in
854854
*_armcc*)
855855
ARMC6_CC="$ARMC6_BIN_DIR/armclang"
856+
ARMC6_LINK="$ARMC6_BIN_DIR/armlink"
856857
ARMC6_AR="$ARMC6_BIN_DIR/armar"
857858
ARMC6_FROMELF="$ARMC6_BIN_DIR/fromelf"
858859
check_tools "$ARMC6_CC" "$ARMC6_AR" "$ARMC6_FROMELF";;

framework/scripts/all-helpers.sh

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ helper_libtestdriver1_adjust_config() {
6767
scripts/config.py "$base_config"
6868
fi
6969

70-
# Enable PSA-based config (necessary to use drivers)
71-
# MBEDTLS_PSA_CRYPTO_CONFIG is a legacy setting which should only be set on 3.6 LTS branches.
7270
if in_mbedtls_repo && in_3_6_branch; then
71+
# Enable PSA-based config (necessary to use drivers)
72+
# MBEDTLS_PSA_CRYPTO_CONFIG is a legacy setting which should only be set on 3.6 LTS branches.
7373
scripts/config.py set MBEDTLS_PSA_CRYPTO_CONFIG
74-
fi
7574

76-
# Dynamic secure element support is a deprecated feature and needs to be disabled here.
77-
# This is done to have the same form of psa_key_attributes_s for libdriver and library.
78-
scripts/config.py unset MBEDTLS_PSA_CRYPTO_SE_C
75+
# Dynamic secure element support is a deprecated feature and needs to be disabled here.
76+
# This is done to have the same form of psa_key_attributes_s for libdriver and library.
77+
scripts/config.py unset MBEDTLS_PSA_CRYPTO_SE_C
78+
fi
7979

8080
# If threading is enabled on the normal build, then we need to enable it in the drivers as well,
8181
# otherwise we will end up running multithreaded tests without mutexes to protect them.
@@ -139,9 +139,11 @@ helper_psasim_config() {
139139
scripts/config.py full
140140
scripts/config.py unset MBEDTLS_PSA_CRYPTO_C
141141
scripts/config.py unset MBEDTLS_PSA_CRYPTO_STORAGE_C
142-
# Dynamic secure element support is a deprecated feature and it is not
143-
# available when CRYPTO_C and PSA_CRYPTO_STORAGE_C are disabled.
144-
scripts/config.py unset MBEDTLS_PSA_CRYPTO_SE_C
142+
if in_mbedtls_repo && in_3_6_branch; then
143+
# Dynamic secure element support is a deprecated feature and it is not
144+
# available when CRYPTO_C and PSA_CRYPTO_STORAGE_C are disabled.
145+
scripts/config.py unset MBEDTLS_PSA_CRYPTO_SE_C
146+
fi
145147
# Disable potentially problematic features
146148
scripts/config.py unset MBEDTLS_X509_RSASSA_PSS_SUPPORT
147149
scripts/config.py unset MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
@@ -151,8 +153,10 @@ helper_psasim_config() {
151153
else
152154
scripts/config.py crypto_full
153155
scripts/config.py unset MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS
154-
# We need to match the client with MBEDTLS_PSA_CRYPTO_SE_C
155-
scripts/config.py unset MBEDTLS_PSA_CRYPTO_SE_C
156+
if in_mbedtls_repo && in_3_6_branch; then
157+
# We need to match the client with MBEDTLS_PSA_CRYPTO_SE_C
158+
scripts/config.py unset MBEDTLS_PSA_CRYPTO_SE_C
159+
fi
156160
# Also ensure MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER not set (to match client)
157161
scripts/config.py unset MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
158162
fi
@@ -254,9 +258,10 @@ helper_armc6_build_test()
254258
FLAGS="$1"
255259

256260
msg "build: ARM Compiler 6 ($FLAGS)"
261+
257262
make clean
258263
ARM_TOOL_VARIANT="ult" CC="$ARMC6_CC" AR="$ARMC6_AR" CFLAGS="$FLAGS" \
259-
WARNING_CFLAGS='-Werror -xc -std=c99' make lib
264+
WARNING_CFLAGS='-Werror -xc -std=c99' make lib
260265

261266
msg "size: ARM Compiler 6 ($FLAGS)"
262267
"$ARMC6_FROMELF" -z library/*.o
@@ -268,6 +273,24 @@ helper_armc6_build_test()
268273
fi
269274
}
270275

276+
helper_armc6_cmake_build_test()
277+
{
278+
FLAGS="$1"
279+
280+
msg "build: CMake + ARM Compiler 6 ($FLAGS)"
281+
282+
cmake -DCMAKE_SYSTEM_NAME="Generic" -DCMAKE_SYSTEM_PROCESSOR="cortex-m0" \
283+
-DCMAKE_C_COMPILER="$ARMC6_CC" -DCMAKE_C_LINKER="$ARMC6_LINK" \
284+
-DCMAKE_AR="$ARMC6_AR" -DCMAKE_C_FLAGS="$FLAGS" \
285+
-DCMAKE_C_COMPILER_WORKS=TRUE -DENABLE_TESTING=OFF \
286+
-DENABLE_PROGRAMS=OFF "$TF_PSA_CRYPTO_ROOT_DIR"
287+
make
288+
289+
msg "size: ARM Compiler 6 ($FLAGS)"
290+
"$ARMC6_FROMELF" -z ${PSA_CORE_PATH}/CMakeFiles/tfpsacrypto.dir/*.o
291+
"$ARMC6_FROMELF" -z ${BUILTIN_SRC_PATH}/../CMakeFiles/builtin.dir/src/*.o
292+
}
293+
271294
clang_version() {
272295
if command -v clang > /dev/null ; then
273296
clang --version|grep version|sed -E 's#.*version ([0-9]+).*#\1#'

framework/scripts/check-doxy-blocks.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
# C/header files in the following directories will be checked
1919
my @mbedtls_directories = qw(include/mbedtls library doxygen/input);
2020
my @tf_psa_crypto_directories = qw(include/psa include/tf-psa-crypto
21+
include/mbedtls
2122
drivers/builtin/include/mbedtls
2223
drivers/builtin/src core doxygen/input);
2324

framework/scripts/check_names.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -701,9 +701,12 @@ def comprehensive_parse(self):
701701
all_macros["public"] = self.parse_macros([
702702
"include/psa/*.h",
703703
"include/tf-psa-crypto/*.h",
704+
"include/mbedtls/*.h",
704705
"drivers/builtin/include/mbedtls/*.h",
705706
"drivers/everest/include/everest/everest.h",
706-
"drivers/everest/include/everest/x25519.h"
707+
"drivers/everest/include/everest/x25519.h",
708+
"drivers/everest/include/tf-psa-crypto/private/everest/everest.h",
709+
"drivers/everest/include/tf-psa-crypto/private/everest/x25519.h"
707710
])
708711
all_macros["internal"] = self.parse_macros([
709712
"core/*.h",
@@ -717,31 +720,40 @@ def comprehensive_parse(self):
717720
enum_consts = self.parse_enum_consts([
718721
"include/psa/*.h",
719722
"include/tf-psa-crypto/*.h",
723+
"include/mbedtls/*.h",
720724
"drivers/builtin/include/mbedtls/*.h",
721725
"core/*.h",
722726
"drivers/builtin/src/*.h",
723727
"core/*.c",
724728
"drivers/builtin/src/*.c",
725729
"drivers/everest/include/everest/everest.h",
726-
"drivers/everest/include/everest/x25519.h"
730+
"drivers/everest/include/everest/x25519.h",
731+
"drivers/everest/include/tf-psa-crypto/private/everest/everest.h",
732+
"drivers/everest/include/tf-psa-crypto/private/everest/x25519.h"
727733
])
728734
identifiers, excluded_identifiers = self.parse_identifiers([
729735
"include/psa/*.h",
730736
"include/tf-psa-crypto/*.h",
737+
"include/mbedtls/*.h",
731738
"drivers/builtin/include/mbedtls/*.h",
732739
"core/*.h",
733740
"drivers/builtin/src/*.h",
734741
"drivers/everest/include/everest/everest.h",
735-
"drivers/everest/include/everest/x25519.h"
742+
"drivers/everest/include/everest/x25519.h",
743+
"drivers/everest/include/tf-psa-crypto/private/everest/everest.h",
744+
"drivers/everest/include/tf-psa-crypto/private/everest/x25519.h"
736745
], ["drivers/p256-m/p256-m/p256-m.h"])
737746
mbed_psa_words = self.parse_mbed_psa_words([
738747
"include/psa/*.h",
739748
"include/tf-psa-crypto/*.h",
749+
"include/mbedtls/*.h",
740750
"drivers/builtin/include/mbedtls/*.h",
741751
"core/*.h",
742752
"drivers/builtin/src/*.h",
743753
"drivers/everest/include/everest/everest.h",
744754
"drivers/everest/include/everest/x25519.h",
755+
"drivers/everest/include/tf-psa-crypto/private/everest/everest.h",
756+
"drivers/everest/include/tf-psa-crypto/private/everest/x25519.h",
745757
"core/*.c",
746758
"drivers/builtin/src/*.c",
747759
"drivers/everest/library/everest.c",

0 commit comments

Comments
 (0)