12311 Commits

Author SHA1 Message Date
Gilles Peskine
4fdb917aae
Merge pull request #10966 from bjwtaylor/tl13-transform-resource-leak-3.6
Backport 3.6: Fix resource leak in populate transform
2026-10-27 12:34:56 +00:00
Valerio Setti
a96c1dffcd
Merge pull request #10655 from bjwtaylor/no-program-failure-3.6
Backport 3.6: Add fix for -DENABLE_PROGRAMS=OFF build error
2026-10-21 15:41:20 +00:00
Gilles Peskine
2a96043825
Merge pull request #10984 from MechatronikMonkey/fix-empty-authority-key-id-3.6
Backport 3.6: x509_crt: accept empty AuthorityKeyIdentifier sequence
2026-10-21 15:12:17 +00:00
Gilles Peskine
c78fb2bb80
Merge pull request #10928 from nvxbug/tls12-handshake-len-bounds-3.6
Backport 3.6: Fix off-by-one over-read in TLS 1.2 ClientHello and CertificateRequest
2026-10-21 15:08:34 +00:00
v1rtu3x
07192886c1 tests: Clarify pathLenConstraint values in test descriptions
Signed-off-by: v1rtu3x <149050962+v1rtu3x@users.noreply.github.com>
(cherry picked from commit 1b3bbfd4a24b3d3c17cf5ac94c4576bba81f6ce5)
2026-10-21 13:44:32 +03:00
v1rtu3x
5af05a964a x509: Accept basicConstraints with omitted cA
RFC 5280 defines cA as BOOLEAN DEFAULT FALSE, so a basicConstraints
extension containing only pathLenConstraint (SEQUENCE { INTEGER n })
is syntactically valid and must be interpreted as cA=FALSE. The fix
for CVE-2026-49300 rejected this encoding outright, breaking
compatibility with certificates emitted by devices such as
Eaton/CODESYS PLCs.

Tolerate MBEDTLS_ERR_ASN1_UNEXPECTED_TAG from the cA BOOLEAN parse,
keeping cA FALSE and letting the existing INTEGER parser validate
pathLenConstraint. The INTEGER value is never used to determine cA,
so the CVE fix is preserved.

Fixes #11006

Signed-off-by: v1rtu3x <149050962+v1rtu3x@users.noreply.github.com>
(cherry picked from commit 62dd8a556c01cc289d4fb3f19352a78ede90dac2)
2026-10-21 13:09:57 +03:00
Ben Taylor
23370efdea Add comment explaining the derivation of the number of keys
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
(cherry picked from commit e0766f1b4a2133ea043e10cef86cc1c76f69b49b)
2026-10-21 08:24:45 +01:00
Ben Taylor
86ba516295 Add test for tansform setup resource leak
This is a manual backport, not a direct cherry-pick, because 3.6 can build TLS without PSA-backed transforms. Gate the regression on MBEDTLS_USE_PSA_CRYPTO.

Signed-off-by: Ben Taylor <ben.taylor@linaro.org>

(cherry picked from commit 95e95268a4c26608612f34f2bb76ff1dfa9ded0a)
2026-10-21 08:24:45 +01:00
subotac
83a9004401 Reject overflowing numeric OID components
Backport of f79eac885dec294d6e441bada15be1605dcb75b0. Adapt the check and tests to the 3.6 OID parser.

Refs Mbed-TLS/mbedtls#10911.

Signed-off-by: subotac <73706465+subotac@users.noreply.github.com>
2026-10-06 23:18:23 +03:00
Naveed
ebcb95c130 Add regression tests for ssl_context_load length checks
Backport the ssl_context_load_rejects_oob_length test function from
development in its final form, with cases for the serialized in_cid,
out_cid and ALPN lengths.

mbedtls_test_ssl_dtls_join_endpoints() and
mbedtls_test_ssl_perform_connection() do not exist on this branch, so
set up the DTLS endpoints and run the handshake with the helpers that
do: mbedtls_test_ssl_endpoint_init() with message queues,
mbedtls_test_mock_socket_connect() and
mbedtls_test_move_handshake_to_state(). Exchange application data
explicitly before saving the context, as
mbedtls_test_ssl_perform_connection() does on development: the server
keeps its handshake structure until then, and
mbedtls_ssl_context_save() refuses to run while it exists.

Signed-off-by: Naveed <naveed@bugqore.com>
2026-10-04 22:53:31 +05:30
Christopher Müller
a8c0f87bfb tests: x509parse: add empty and truncated AuthorityKeyIdentifier tests
An empty AuthorityKeyIdentifier SEQUENCE must parse. A [0] tag without
a length must still be rejected; that case already passed before the
fix and guards against loosening the check too much.

Backport to 3.6: the dependencies use the legacy configuration macros
(MBEDTLS_PK_CAN_ECDSA_SOME, MBEDTLS_ECP_HAVE_SECP256R1,
MBEDTLS_MD_CAN_SHA256) instead of PSA_WANT_*, and the expected error is
written as a sum, like the neighbouring AuthorityKeyIdentifier tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Christopher Müller <chris@mechatronikmonkey.de>
2026-10-03 14:28:29 +02:00
Gilles Peskine
eea0f8c0c1 Clarify that this is the "calling script"
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-09-15 12:04:47 +02:00
Gilles Peskine
32da0ae9c3 Improve docstring following the split
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-09-15 12:04:47 +02:00
Gilles Peskine
22885b6bd9 Import PSA compliance test script entry point from the framework
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-09-15 12:04:47 +02:00
minosgalanakis
d6664ceac9
Merge pull request #10920 from yiwu0b11/psa-its-uid0-errorcode-fix-3.6
[Backport 3.6] PSA its function uid0 errorcode fix
2026-09-02 14:46:59 +00:00
Gilles Peskine
154a78c78b
Merge pull request #10912 from yiwu0b11/cmake-config-3.6
[Backport 3.6] Cmake custom compile-time config support
2026-09-01 14:43:32 +00:00
Valerio Setti
e6e01cd4d9
Merge pull request #10586 from gilles-peskine-arm/all.sh-silence-support-failures-3.6
Backport 3.6: Silence support failures in all.sh
2026-08-31 14:36:50 +00:00
Naveed
3500aaa3f3 adapt test dependencies to 3.6 macro names
Signed-off-by: Naveed <naveed@bugqore.com>
2026-08-24 21:58:33 +05:30
Naveed
6cffad7e1b rework handshake length checks per review
ClientHello: narrow the session-id check to the session id itself, check
the cookie length byte before reading it, and let the ciphersuite-list
length check cover both transports.

CertificateRequest: make the signature-algorithms check also reserve the
two certificate-authorities length bytes instead of adding a separate
check, use the available < needed pattern throughout, and reject an
odd-length signature-algorithms list.

Add injected truncated-ClientHello test cases (TLS 1.2-only builds).

Signed-off-by: Naveed <naveed@bugqore.com>
2026-08-24 21:58:01 +05:30
Yi Wu
7d443f3534 improve test coverage
Signed-off-by: Yi Wu <yi.wu2@arm.com>
2026-08-21 15:14:20 +01:00
Gilles Peskine
70058ce4b6
Merge pull request #10845 from gilles-peskine-arm/issue1585-backport3.6-visualc
[3.6 only] Test mbedtls_ssl_session_reset()
2026-08-20 16:01:14 +00:00
Yi Wu
51a8076902 CMake improvements: relocatable, transformation, and more test
Signed-off-by: Yi Wu <yi.wu2@arm.com>
2026-08-20 09:10:41 +01:00
Yi Wu
d039c5fe50 test: use TEST_EQUAL for ITS UID 0 errors
Signed-off-by: Yi Wu <yi.wu2@arm.com>
2026-08-12 20:18:29 +01:00
Yi Wu
9a23f70ee0 Reject UID 0 in pas_its
function changed: psa_its_set, _get, _get_info, _remove

Signed-off-by: Yi Wu <yi.wu2@arm.com>
2026-08-12 16:00:36 +01:00
Yi Wu
1e8647ff92 CMake: add support for config options
Signed-off-by: Yi Wu <yi.wu2@arm.com>
2026-08-10 08:58:34 +01:00
Naveed
61a2877a8e Force sentinel session ID length in serialized-load test
Signed-off-by: Naveed <naveed@bugqore.com>
2026-08-03 13:45:52 +05:30
Naveed
b6d607d310 Reject out-of-bounds session ID length in ssl_tls12_session_load
Signed-off-by: Naveed <naveed@bugqore.com>
2026-08-03 13:45:52 +05:30
Manuel Pégourié-Gonnard
7902021aeb Move context verifier to a better place
In terms of CMake, we want it to be part of the mbedtls_test_helpers
object collection, which as the name does not suggest, is actually for
SSL, and not part of mbedtls_test which is generic.

The easiest way to achieve that is to move the source file to
test_helpers which again as the name does not reflect is for SSL.

Then we just need ssl_server2 and ssl_client2 to link to
mbedtls_test_helpers.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-07-29 11:36:43 +02:00
Valerio Setti
41ada48936 tests: generate_ssl_session_reset_check: adjust rules for 3.6 branch
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-07-29 11:36:43 +02:00
Valerio Setti
9c2ef6a4da tests: ssl_helpers: run ssl_context reset check only when the SSL context is setup
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-07-29 11:36:43 +02:00
Valerio Setti
2c35acc231 tests: generate_ssl_session_reset_check: remove trailing whitespace
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-07-29 11:36:27 +02:00
Valerio Setti
eb9fd86745 tests: generate_ssl_session_reset_check: pacify pylint
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-07-29 11:36:27 +02:00
Valerio Setti
96423d43d0 tests: generate_ssl_session_reset_check: order rules as fields in the struct
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-07-29 11:36:27 +02:00
Valerio Setti
778a0546a5 tests: ssl_helpers: fix documentation of mbedtls_test_ssl_check_context_after_session_reset
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-07-29 11:36:27 +02:00
Valerio Setti
40f82abadb tests: ssl_context_reset_verifier: add missing semicolon in generated file
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-07-29 11:36:27 +02:00
Valerio Setti
d36dedc033 tests: generate_ssl_session_reset_check: add missing semicolon in generated file
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-07-29 11:36:27 +02:00
Valerio Setti
c2568cb96b tests|programs: call check_context_after_session_reset whenever mbedtls_ssl_session_reset
Call mbedtls_test_ssl_check_context_after_session_reset both in programs
(ssl_client2 and ssl_server2) and tests to ensure that the SSL context
has been properly handled when mbedtls_ssl_session_reset was called.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-07-29 11:36:27 +02:00
Valerio Setti
0568836744 tests: add prototype and implementation of mbedtls_test_ssl_check_context_after_session_reset
Ideally the implementation shouldn't be checked in git, but for the time
being there is no support in building source code for tests from the
binary folder, so it's accepted as a temporary solution.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-07-29 11:36:27 +02:00
Valerio Setti
066f0f98a8 tests: scripts: add generate_ssl_session_reset_check.py
Togethere with the framework counterpart ('ssl_session_reset_check.py')
this script is used to automatically generate the function
'mbedtls_test_ssl_check_context_after_session_reset()'.
The goal of this function is to verify that 'mbedtls_ssl_session_reset()'
properly handled (reset or keep) all the fields of the
'mbedtls_ssl_context' structure.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-07-29 11:36:27 +02:00
Valerio Setti
b4eb39217b tests: ssl: split ssl_helpers between public and internal functions
Move functions in "ssl_helpers.h" that depend on internal headers to
"ssl_helpers_internal.h". This allows to include "ssl_helpers.h" also
in programs (which do not have access to internal headers).

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-07-29 11:36:27 +02:00
Ben Taylor
aacb344f31 Add parentheses to unsafe macros
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>

This is a manual backport, not a direct cherry-pick, because the 3.6 branch uses different file paths and keeps a direct PSA_ALG_JPAKE comparison in the PAKE size macros.

(cherry picked from commit ebda5da117af7e57bad47bc3337e364365a8f357)
2026-07-21 10:21:43 +01:00
Minos Galanakis
d5b20d4a1e Revert "Added generated files"
This reverts commit 3b42ba863ee7cd0bcd14bb57156af0961f8febd9.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-07-07 17:26:50 +01:00
Ben Taylor
c606923ce5 Add fix for -DENABLE_PROGRAMS=OFF build error
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-07-02 13:25:38 +01:00
Minos Galanakis
3b42ba863e Added generated files
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-06-26 21:18:01 +01:00
Minos Galanakis
b767964cef Bump version --version 3.6.7
./scripts/bump_version.sh --version 3.6.7

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-06-26 15:32:38 +01:00
Minos Galanakis
4476f02593 Merge remote-tracking branch 'restricted/mbedtls-3.6-restricted' into mbedtls-3.6.7.rc 2026-06-26 15:19:55 +01:00
Ronald Cron
b71ec46f4f tls13_fetch_handshake_msg(): Remove require_record_boundary parameter
Deduce it from the handshake message type

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-06-24 16:16:08 +02:00
Ronald Cron
4303dc6136 tls13_record_boundary_alignement: Append empty hs msg
Append an empty handshake message to expand
the record instead of just a zero byte.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-06-24 16:16:08 +02:00
Ronald Cron
13ab16f1ef Various improvements of tls13_(drop_early_data|record_boundary_alignment)()
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-06-24 16:16:08 +02:00
Ronald Cron
1d0ff13c89 test_suite_ssl: Add initialization to all zeroes of test endpoint structs
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-06-24 16:16:07 +02:00