Compare commits

..

257 Commits

Author SHA1 Message Date
Minos Galanakis
0a8fda272a ChangeLog: Removed CVE-ID
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-07-01 12:02:14 +01:00
Minos Galanakis
5b6dd79f67 Update BRANCHES.md
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-06-29 18:32:24 +01:00
Minos Galanakis
d1f3eee6b5 ChangeLog: Removed todo placeholder for CVE
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-06-29 18:32:24 +01:00
Minos Galanakis
0f9f57a047 Changelog: Added reference to tf-psa-crypto update
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-06-29 18:32:24 +01:00
Minos Galanakis
5089e9f623 Assemble Changelog
./framework/scripts/assemble_changelog.py

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-06-29 18:28:30 +01:00
Minos Galanakis
0c5fe5c677 Bump version --version 4.1.1
./scripts/bump_version.sh --version 4.1.1

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-06-29 18:28:30 +01:00
Minos Galanakis
2bab33486e Updated tf-psa-crypto submodule
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-06-29 18:28:30 +01:00
Minos Galanakis
b05e6e0e0a Merge remote-tracking branch 'mbedtls-4.1-restricted' into mbedtls-4.1.1.rc 2026-06-26 22:05:03 +01:00
Ronald Cron
c0dbff0cf8
Merge pull request #1683 from valeriosetti/issue1585-backport4.1
[4.1] Stale DTLS- SRTP negotiation state after session_reset() (ARM-RZ7EMQAA)
2026-06-26 12:17:19 +02:00
Ronald Cron
316296466b
Merge pull request #1686 from minosgalanakis/security/mlfbyt4c_tls13_policy_bypass_changelog_4.1
Add Attribution CVE mbedtls:mbedtls4.1-restricted
2026-06-25 15:57:24 +02:00
Ronald Cron
cc5f7bc061
Merge pull request #10785 from minosgalanakis/mbedtls-4.1-release-sync
Mbedtls 4.1.1 release sync
2026-06-25 12:09:50 +00:00
Minos Galanakis
caad5d95e5 Updated tf-psa-crypto pointer
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-06-25 00:53:15 +01:00
Minos Galanakis
f43bdae2d2 Updated framework pointer
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-06-25 00:52:36 +01:00
Gilles Peskine
fe4733b1de
Merge pull request #10790 from bensze01/readthedocs-4.1
[Backport 4.1] Upgrade readthedocs builder to Ubuntu 26.04
2026-06-24 18:48:16 +00:00
Gilles Peskine
f885248356
Merge pull request #1681 from ronald-cron-arm/hsm-do-not-span-key-change-4.1
4.1: Hsm do not span key change
2026-06-24 19:22:12 +02:00
Bence Szépkúti
a493f22738 Upgrade readthedocs builder to Ubuntu 26.04
The 20.04 runner is no longer supported.

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2026-06-24 17:02:37 +02:00
Ronald Cron
45d892ea3d Check ServerHello record boundary alignment only in TLS 1.3 case
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-06-24 16:00:25 +02:00
Ronald Cron
0fe502312d 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:00:25 +02:00
Ronald Cron
1208d1cc25 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:00:25 +02:00
Ronald Cron
4165fe1dc2 Various improvements of tls13_(drop_early_data|record_boundary_alignment)()
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-06-24 16:00:25 +02:00
Ronald Cron
1235722aa1 tls13: Rework mbedtls_ssl_tls13_fetch_handshake_msg()
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-06-24 16:00:25 +02:00
Ronald Cron
7dc69f331f tls13: Improve argument name
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-06-24 16:00:25 +02:00
Ronald Cron
d13352bc40 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:00:25 +02:00
Ronald Cron
62a9fa9f48 Fix typos
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-06-24 16:00:25 +02:00
Ronald Cron
c4db00209a Add change log
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-06-24 16:00:25 +02:00
Ronald Cron
0501eeb804 test_suite_ssl: Test EndOfEarlyData on record boundary enforcement
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-06-24 16:00:25 +02:00
Ronald Cron
996adce4b6 test_suite_ssl: Test client Finished on record boundary enforcement
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-06-24 16:00:25 +02:00
Ronald Cron
d00518a2ec test_suite_ssl: Test server Finished on record boundary enforcement
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-06-24 16:00:25 +02:00
Ronald Cron
b9793ca124 test_suite_ssl: Test ServerHello on record boundary enforcement
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-06-24 16:00:24 +02:00
Ronald Cron
dd97c26e9a test_suite_ssl: Test ClientHello on record boundary check
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-06-24 16:00:24 +02:00
Ronald Cron
f17c5ff90d tls13: Add record boundary checks
RFC 8446 (TLS 1.3 specification), Section 5.1, states:

Handshake messages MAY be coalesced into a single TLSPlaintext record
or fragmented across several records, provided that:
    ...
    -Handshake messages MUST NOT span key changes. Implementations
    MUST verify that all messages immediately preceding a key change
    align with a record boundary; if not, then they MUST terminate the
    connection with an "unexpected_message" alert. Because the
    ClientHello, EndOfEarlyData, ServerHello, Finished, and KeyUpdate
    messages can immediately precede a key change, implementations
    MUST send these messages in alignment with a record boundary.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-06-24 16:00:24 +02:00
Ronald Cron
2aaedab1eb test_suite_ssl: Add early data drop tests
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-06-24 16:00:23 +02:00
Minos Galanakis
1d3ac2843c Changelog. Added attribution/CVE for 1569
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-06-24 14:40:53 +01:00
Valerio Setti
3b84f44c7f tests: ssl_helpers: run ssl_context reset check only when the SSL context is setup
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-24 15:38:32 +02:00
Ronald Cron
5aac408d2a
Merge pull request #1657 from bjwtaylor/ssl-ignores-failure-restricted-4.1
Backport 4.1: Fix issues in ssl where it ignores the failure return
2026-06-24 15:03:12 +02:00
Valerio Setti
8ef4559dfa framework: update reference
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-24 14:42:10 +02:00
Valerio Setti
de1f7218d5 tests: generate_ssl_session_reset_check: remove trailing whitespace
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-24 14:42:10 +02:00
Valerio Setti
7a2a3179e2 tests: generate_ssl_session_reset_check: pacify pylint
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-24 14:42:10 +02:00
Valerio Setti
fd072d7103 tests: generate_ssl_session_reset_check: order rules as fields in the struct
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-24 14:42:10 +02:00
Valerio Setti
57b2f5d4aa tests: ssl_helpers: fix documentation of mbedtls_test_ssl_check_context_after_session_reset
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-24 14:42:10 +02:00
Valerio Setti
b291d59927 tests: ssl_context_reset_verifier: add missing semicolon in generated file
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-24 14:42:10 +02:00
Valerio Setti
673568a6a1 tests: generate_ssl_session_reset_check: add missing semicolon in generated file
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-24 14:42:10 +02:00
Valerio Setti
f4dcb5c692 changelog: add note for documentation fix for mbedtls_ssl_set_cid
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-24 14:42:10 +02:00
Valerio Setti
aa6c52b6cd include: ssl: fix documentation of mbedtls_ssl_set_cid
Specify that the configured CID will apply to all subsequent handshakes
not just to the next one.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-24 14:42:10 +02:00
Valerio Setti
f8a7d87fe1 changelog: add reset for some fields of the SSL context structure
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-24 14:42:10 +02:00
Valerio Setti
4b086ed04e library: ssl: reset some SSL context's fields in mbedtls_ssl_session_reset
Following fields were not properly reset when mbedtls_ssl_session_reset
was called:

- badmac_seen
- dtls_srtp_info
- alert_reason
- alert_type

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-24 14:42:10 +02:00
Valerio Setti
0e35789157 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-06-24 14:42:10 +02:00
Valerio Setti
e19a4cfd80 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-06-24 14:42:10 +02:00
Valerio Setti
0ff7a2e8b7 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-06-24 14:42:10 +02:00
Valerio Setti
150f1c7b40 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-06-24 14:42:10 +02:00
Valerio Setti
be883e19f5 include: ssl: add a typedef for unused data in mbedtls_ssl_config and mbedtls_ssl_context
Add mbedtls_ssl_unused_data_t type instead of embedding the union inside
both structures.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-24 14:42:10 +02:00
Ben Taylor
7cbd8582ee Correct error handling in mbedtls_ssl_reset_checksum
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:44 +01:00
Ben Taylor
14cec6ffc1 Fix error codes for tls_transcript_error_propagation
Co-authored-by: Ronald Cron <ronald.cron@arm.com>
Signed-off-by: Ben Taylor <32939606+bjwtaylor@users.noreply.github.com>
2026-06-24 11:05:44 +01:00
Ben Taylor
356e535ff5 Improve tls_transcript_error_propagation testing to check for error codes
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:44 +01:00
Ben Taylor
f234fc5a3c Update regression test
Co-authored-by: Ronald Cron <ronald.cron@arm.com>
Signed-off-by: Ben Taylor <32939606+bjwtaylor@users.noreply.github.com>
2026-06-24 11:05:44 +01:00
Ben Taylor
809820934c restore missing ext_len set
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:44 +01:00
Ben Taylor
c742ab0a97 remove trailing whitespace
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:44 +01:00
Ben Taylor
52a1b95067 Update ChangeLog with CVE number
Co-authored-by: Ronald Cron <ronald.cron@arm.com>
Signed-off-by: Ben Taylor <32939606+bjwtaylor@users.noreply.github.com>
2026-06-24 11:05:44 +01:00
Ben Taylor
3e6608a5b6 Update ChangeLog to add CVE
Co-authored-by: Gilles Peskine <gilles.peskine@arm.com>
Signed-off-by: Ben Taylor <32939606+bjwtaylor@users.noreply.github.com>
2026-06-24 11:05:44 +01:00
Ben Taylor
62d3b1ecc0 Update dependencies for skipped test
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:44 +01:00
Ben Taylor
9709c1a6e5 fix code style
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:44 +01:00
Ben Taylor
470aeeed9d Improve ChangeLog
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:44 +01:00
Ben Taylor
2e2bbed8f0 Update error handling of return from ssl_write_ecjpake_kkpp_ext
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:44 +01:00
Ben Taylor
76aa4682ce Improve testing
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:44 +01:00
Ben Taylor
6ed6d0e491 Update ChangeLog
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:44 +01:00
Ben Taylor
b0f812d68d Fix reporters in ChangeLog
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:44 +01:00
Ben Taylor
0e3e118220 Remove check for NULL pointer
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:44 +01:00
Ben Taylor
f9a3d649ff Tidy up ChangeLog
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:44 +01:00
Ben Taylor
8c27b60597 Add Reported by to ChangeLog
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:44 +01:00
Ben Taylor
5aa6ab3408 Fix code style issues
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:44 +01:00
Ben Taylor
bc111eed27 Add fix for missing return from ssl_write_ecjpake_kkpp_ext
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:44 +01:00
Ben Taylor
86140ccd4a Add additional fix for return with error
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:44 +01:00
Ben Taylor
d93c7b6289 Add client tests for RMS computation error
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:44 +01:00
Ben Taylor
64b837bef9 Add unsupported trigger check
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:43 +01:00
Ben Taylor
6b60598c88 Add further documentation to tls_abort_transcript_context
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:43 +01:00
Ben Taylor
4570537978 Fix issues with hanging seed length
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:43 +01:00
Ben Taylor
a58163a339 Fixed code style
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:43 +01:00
Ben Taylor
0a0c86dca4 refactor initialisation in tls_transcript_error_propagation, so that the variables are initialised straight after they are declared
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:43 +01:00
Ben Taylor
cdad2f42b7 Add additional guard for sha256 in tests
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:43 +01:00
Ben Taylor
d6e6012544 Improve layout of the code for debugging with breakpoints
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:43 +01:00
Ben Taylor
d6019b932d Add security impact
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:43 +01:00
Ben Taylor
29bdcc319a Update ChangeLog
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:43 +01:00
Ben Taylor
d066076211 Add ChangeLog
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:43 +01:00
Ronald Cron
762b68fe26 Improve dependencies and error handling
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:05:42 +01:00
Ben Taylor
591a5f24c2 tests: ssl: add regression tests for EMS/RMS error propagation
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:04:57 +01:00
Ben Taylor
4e26c248ec ssl: propagate transcript-hash computation failures
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-24 11:03:39 +01:00
Gilles Peskine
657760964e
Merge pull request #1660 from bjwtaylor/info-leak-in-ssl_write_new_session_ticket-4.1
Info leak in ssl write new session ticket 4.1
2026-06-24 09:42:16 +02:00
Gilles Peskine
7674b49934
Merge pull request #1656 from valeriosetti/issue1598-backport4.1
[4.1] PKCS7 accepts weak hashes
2026-06-23 16:40:44 +02:00
Minos Galanakis
a6d2af8cdb Added attribution
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-06-23 10:52:01 +01:00
Minos Galanakis
5998104fd6 Added CVE
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-06-22 22:35:54 +01:00
Ronald Cron
788a536868
Merge pull request #1673 from bjwtaylor/pkcs-free-stale-pointers-4.1
Pkcs free stale pointers 4.1
2026-06-22 17:54:49 +02:00
minosgalanakis
0e69eb6990
Merge pull request #1667 from gilles-peskine-arm/badmac_seen_or_in_hsfraglen-test-4.1
Backport 4.1: test badmac_seen with renegotiation
2026-06-22 15:49:58 +01:00
Valerio Setti
5b67d61d02 pkcs7: do not mention PK algorithms in the documentation
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-22 11:46:29 +02:00
Valerio Setti
ba5c9383ab config-options-current: add new symbol MBEDTLS_PKCS7_ALLOW_WEAK_SIGNATURES
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-22 11:46:29 +02:00
Valerio Setti
dfa6a1441e pkcs7: improve documentation and changelog for MBEDTLS_PKCS7_ALLOW_WEAK_SIGNATURES
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-22 11:46:29 +02:00
Valerio Setti
4008c7f811 pkcs7: mention MBEDTLS_PKCS7_ALLOW_WEAK_SIGNATURES in pkcs7.h documentation
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-22 11:46:29 +02:00
Valerio Setti
0b556f5a2d pkcs7: add MBEDTLS_PKCS7_ALLOW_WEAK_SIGNATURES build symbol
It allows weak hash algorithms to be used in PKCS7. It's only added in the
LTS branch for backward compatibility, but it's disabled by default because
that's the safest choice.

This commit also updates test data in order to test the new build symbol.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-22 11:46:29 +02:00
Valerio Setti
4b193e5f80 framework: update reference
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-22 11:46:28 +02:00
Valerio Setti
269312540c tests: pkcs7: adjust test dependencies
Newly added tests for RIPEMD160 and MD5 still require SHA-256 for the
certificate being used. SHA-1 is instead useless in this case.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-22 11:45:56 +02:00
Valerio Setti
d0e97ad6d8 pkcs7: update documentation adding a note about rejecting weak hash algs
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-22 11:45:56 +02:00
Valerio Setti
eb8c3f4b4d changelog: update documentation for PKCS7 changes
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-22 11:45:56 +02:00
Valerio Setti
154e70b444 test_suite_pkcs7: adjust numbering of tests
Some newly added tests had duplicate numbers with what was already there.
This commit fixes the duplication problem.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-22 11:45:56 +02:00
Valerio Setti
7cc706ca5a pkcs7: replace MBEDTLS_ERR_PKCS7_VERIFY_FAIL with MBEDTLS_ERR_PKCS7_VERIFY_FAIL
This also updates test data.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-22 11:45:56 +02:00
Valerio Setti
f27a1572e3 pkcs7: split MD/PK check in mbedtls_pkcs7_data_or_hash_verify
Follow the default Mbed TLS coding style and ease debugging (i.e. placing
of breakpoints).

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-22 11:45:56 +02:00
Valerio Setti
9253f375c2 tests: pkcs7: add negative tests using MD5 and RIPEMD160
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-22 11:45:56 +02:00
Valerio Setti
2ae1ec8fdc changelog: add note for PKCS7 rejecting weak hash algorithms
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-22 11:45:56 +02:00
Valerio Setti
de9ee5d6ee tests: pkcs7: adjust return code in SHA-1 based PKCS7 test
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-22 11:45:56 +02:00
Valerio Setti
b4d729fb02 pkcs7: fail verification if MD alg or sig_alg are not secure
Add a check on mbedtls_pkcs7_data_or_hash_verify() so that the verification
fails if the MD alg specified in PKCS7 structure or the signature
algorithm specified in the X.509 certificate are not in the list of
secure algorithms (i.e. mbedtls_x509_crt_profile_default).

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-22 11:45:56 +02:00
Valerio Setti
9bcea79cb5 x509: make profile checking functions internally available
Following functions

- x509_profile_check_md_alg
- x509_profile_check_pk_alg

are made non-static and moved to x509_internal.h so that other library
files can used them.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-22 11:45:56 +02:00
Valerio Setti
227bb646b1 x509_crt: add SHA3 algs to mbedtls_x509_crt_profile_default
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-22 11:45:56 +02:00
Valerio Setti
833a926a92 x509_crt: remove old invalid comment
ssl_preset_default_hashes was removed in
f0cda410a4bca0f45f66bdbf0714cd0eb2ea4718 but the comment in 'x509_crt.c'
wasn't updated.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-06-22 11:45:56 +02:00
Gilles Peskine
e106d8ad1c
Merge pull request #10761 from Nadav0077/harden-serialized-load-4.1
Backport to 4.1: harden serialized data deserialization
2026-06-19 20:18:03 +00:00
Gilles Peskine
2660eea3f0
Merge pull request #1629 from gilles-peskine-arm/basic-constaints-sequence-check-4.1
Backport 4.1: Fix CA bit forgery through invalid basicConstraints
2026-06-18 15:36:46 +02:00
Ben Taylor
c20cd06cb4 Add in the two additional checks that were dropped.
Co-authored-by: Ronald Cron <ronald.cron@arm.com>
Signed-off-by: Ben Taylor <32939606+bjwtaylor@users.noreply.github.com>
2026-06-18 13:04:13 +01:00
Ben Taylor
37e0f109ac Remove pkcs7_parse_free_resets_context as it duplicates pkcs7_parse_reuse
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-18 13:04:13 +01:00
Ben Taylor
5dabb64533 Add CVE ID to ChangeLog
Co-authored-by: Gilles Peskine <gilles.peskine@arm.com>
Signed-off-by: Ben Taylor <32939606+bjwtaylor@users.noreply.github.com>
2026-06-18 13:04:13 +01:00
Ben Taylor
a74bbc78e6 Remove whitespace in ChangeLog
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-18 13:04:13 +01:00
Ben Taylor
c4c4ef07c1 Correct changelog style
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-18 13:04:13 +01:00
Ben Taylor
7448a04683 Add further testing
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-18 13:04:13 +01:00
Ben Taylor
15a6367373 Update ChangeLog
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-18 13:04:13 +01:00
Ben Taylor
54284cc451 Update ChangeLog
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-18 13:04:13 +01:00
Ben Taylor
fbaf177f2d Fix style issues
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-18 13:04:13 +01:00
Ben Taylor
55536a07c9 Remove redundant function from pkcs7_parse_reuse
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-18 13:04:13 +01:00
Ben Taylor
434d7114a8 Add ChangeLog
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-18 13:04:13 +01:00
Ben Taylor
b1a4b07509 Add fix for stale pointer after mbedtls_pkcs7_free
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-18 13:04:13 +01:00
Gilles Peskine
49b13b34b3 Credit independent report
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-16 19:35:35 +02:00
Gilles Peskine
1f5b89077c
Merge pull request #1655 from bjwtaylor/ECDHE-PSK-integer-overflow-restricted-4.1
Backport Ecdhe psk integer overflow restricted fix to  4.1
2026-06-16 11:49:57 +02:00
Ronald Cron
5ea102945d
Merge pull request #1661 from minosgalanakis/public-sync/mbedtls-4.1-14062026
[Sync] Merge mbedtls-4.1 into Merge mbedtls-4.1-restricted
2026-06-16 09:02:13 +02:00
Ronald Cron
9d54126d0e
Merge pull request #1646 from bjwtaylor/oob-key-exchange-restricted-4.1
Add fix for OOB key exchange error 4.1
2026-06-15 22:42:15 +02:00
Gilles Peskine
dc258c9b9b Remove some test cases that are not really meaningful
Remove the "srv" variant of "DTLS proxy: server: get invalid AD record then
accept renego", where the server initiates the renegotiation process by
sending a HelloRequest. The HelloRequest message is not relevant to this
test. The first message of the actual renegotiation is the ClientHello
message from the client, and the interesting part of the test happens when
the client receives the server's response.

Remove "DTLS proxy: server: get invalid AD record then accept early
renego (cli)" and the corresponding "reject" control. This test case doesn't
really do what it is advertised to do, and in particular does not lead to a
call to `ssl_consume_current_message()` in the server. What happens is that
the client sends a ClientHello message to start the renegotiation, then it
blocks until the server has replied. So there is nothing to delay that
ClientHello after:(unlike what happens in the corresponding client-side
test, where the first flight of the renegotiation protocol contains multiple
messages, so we can delay the first of these messages after the second one).
What happens in practice is that the client times out, then resends its
ClientHello, and the proxy sends the delayed ClientHello immediately after
the resent one, which does not cause any interesting behavior in the server.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-15 19:19:33 +02:00
Gilles Peskine
046e5a43ad Explain the "get invalid AD record .*renego" tests better
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-15 19:19:15 +02:00
Gilles Peskine
cbc94fbdf4 Don't pass badmac_limit when it would have no effect
Only set `badmac_limit` on the side that actually receives a message with a
bad MAC/tag (injected by the proxy).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-15 19:19:11 +02:00
Gilles Peskine
3d5e440b41 Add DTLS handshake test with badmac_seen=1
Add a test entry point for a handshake with a specially crafted context.
This can be used for defense in depths for scenarios that we think can't
happen, but might actually happen due to a bug, or due to a new feature that
is insufficiently tested. This can also be a proxy for testing aspects of
renegotiation or session resumption in circumstances that are hard to
arrange.

In this commit, use it to test a DTLS handshake with `ssl->badmac_seen`
:(actually `ssl->badmac_seen_or_in_hsfraglen` in the 3.6 branch) set to a
nonzero value. This can't happen, as far as I know (`badmac_seen` can only
be nonzero during renegotiation, not during a nominal handshake or in
session resumption). But it could happen, for example, if
`mbedtls_ssl_session_reset()` failed to reset `badmac_seen`, as was the case
in Mbed TLS 4.0.0 to 4.1.0.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-15 19:18:47 +02:00
Gilles Peskine
cde26bd4ce Add tests for renegotiation with badmac_seen=1 on the server
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-15 19:09:24 +02:00
Gilles Peskine
4bb28f6573 Add renegotiate=2 option to ssl_client2
In `ssl_client2`, the existing option `renegotiate=1` causes the client to
initiate renegotiation immediately after the initial handshake. Add a
variant `renegotiate=2` that initiates renegotiation after one data exchange.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-15 19:09:16 +02:00
Gilles Peskine
a21f97139f Add tests for renegotiation with badmac_seen=1 on the client
After a message with a bad MAC (invalid application data record), try to
renegotiate:

* Test cases where renegotiation (nominal or delayed) is rejected.
  Nothing bad happens.
* A test where renegotiation is misparsed and rejected.
  The subsequent parsing fails.
* A test where the renegotiation request is delayed.
  This causes a heap buffer overflow in `ssl_buffer_message()`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-15 19:08:08 +02:00
Gilles Peskine
b7718ad291 Check "refusing renegotiation" log in more renegotiation tests
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-15 19:07:37 +02:00
Gilles Peskine
f99b4be7cd Add badmac_limit option to ssl_client2
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-15 19:07:33 +02:00
Gilles Peskine
1d354f2ae0 Add one-shot bad AD options to udp_proxy
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-15 19:07:28 +02:00
Gilles Peskine
1509cc4509 Add udp_proxy options to delay an encrypted handshake message
This can be used to simulate data messages received in the wrong epoch, or
to cause a handshake message to be buffered.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-15 19:07:24 +02:00
Gilles Peskine
84f66de73f Test DTLS renegotiation when badmac_seen_or_in_hsfraglen != 0
Non-regression test for a bug introduced with TLS handshake defragmentation
support in Mbed TLS 3.6.3, whereby the confusion between the `badmac_seen`
meaning and the `in_hsfraglen` meaning of `ssl->badmac_seen_or_in_hsfraglen`
causes renegotiation to be processed incorrectly after receiving a message
with a bad MAC.

The bug doesn't affect Mbed TLS 4.0.0 and above, but it's still good to have
more testing.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-15 19:06:37 +02:00
Gilles Peskine
025422b2e9 Add some hooks in mbedtls_test_ssl_perform_handshake()
Let test code customize the kitchen sink function
`mbedtls_test_ssl_perform_handshake()` at a few points.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-15 19:02:01 +02:00
Gilles Peskine
9fe8059464 Add a missing dependency
Needed by a test certificate.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-15 18:52:26 +02:00
Ronald Cron
91d7da23a8 Remove unnecessary dependency
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-06-15 18:49:12 +02:00
Ben Taylor
a98b95074a
Update ChangeLog to include CVE number
Co-authored-by: Gilles Peskine <gilles.peskine@arm.com>
Signed-off-by: Ben Taylor <32939606+bjwtaylor@users.noreply.github.com>
2026-06-15 09:20:59 +01:00
Minos Galanakis
e1896dbfd8 Merge remote-tracking branch 'public/mbedtls-4.1' into public-sync/mbedtls-4.1-14062026
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-06-14 19:36:52 +01:00
Ben Taylor
1a5e328377 Fix style issue
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-12 09:13:45 +01:00
Ben Taylor
f5cb455b5c Correct ChangeLog style
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-12 09:13:45 +01:00
Ben Taylor
ff8de9cec9 Add CVE to ChangeLog
Co-authored-by: Ronald Cron <ronald.cron@arm.com>
Signed-off-by: Ben Taylor <32939606+bjwtaylor@users.noreply.github.com>
2026-06-12 09:13:45 +01:00
Ben Taylor
4cb3470f91 Improve the wording of the ChangeLog
Co-authored-by: Ronald Cron <ronald.cron@arm.com>
Signed-off-by: Ben Taylor <32939606+bjwtaylor@users.noreply.github.com>
2026-06-12 09:13:45 +01:00
Ben Taylor
cf37056714 Add improvements to ChangeLog
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-12 09:13:45 +01:00
Ben Taylor
f2a1306c86 Correct syntax of MBEDTLS_GET_UINT32_BE in write_new_session_ticket_mem
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-11 16:24:04 +01:00
Ben Taylor
e9332e8ebe Add ChangeLog
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-11 16:24:04 +01:00
Ben Taylor
5fa28bb6cd Improve test of non-initilisation of lifetime
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-11 16:24:04 +01:00
Ben Taylor
dd5a8501c0 Improve robustness of tlen and lifetime variables
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-11 16:24:04 +01:00
Ben Taylor
56e314728b Add fix for leak
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-11 16:24:04 +01:00
Ben Taylor
75cfc5c0b9 Add test for leak
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-11 16:24:04 +01:00
Ben Taylor
1e061ee95a Add reported by and CVE placeholder
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
(cherry picked from commit ab2a7d5a3472f39190344f754e6cee5039fcba50)
2026-06-10 14:34:10 +01:00
Ben Taylor
afdbd67f21 Correct style of ChangeLog
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
(cherry picked from commit 0501e447cc19ed06b69daea5e17585e1294030cd)
2026-06-10 14:34:10 +01:00
Ben Taylor
2705873c5a Improve ChangeLog
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
(cherry picked from commit c058818451833a748da112e3b8129fd299480ceb)
2026-06-10 14:34:10 +01:00
Ben Taylor
93b10471aa Add ChangeLog
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
(cherry picked from commit e71e49e634ba49b2b630f268bc8f0dd392751ec3)
2026-06-10 14:34:10 +01:00
Ben Taylor
4afd1c1685 Add in tests for ECDHE-PSK integer overflow
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
(cherry picked from commit c567299ee6bade9547a97d3ad1dcd5f3bd98ea6f)
2026-06-10 14:34:10 +01:00
Ben Taylor
f63ca6e0af Added fix for Integer overflow using a large ECDHE Identity
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
(cherry picked from commit baf449db7e31f031ed5def0fecf417122f72d3ee)
2026-06-10 14:34:10 +01:00
Ronald Cron
b9af3cd809
Merge pull request #1608 from minosgalanakis/security/mlfbyt4c_tls13_policy_bypass_4.1
Backport 4.1: TLS1.3 client HRR policy bypass[ARM-MLFBYT4C]
2026-06-10 13:04:01 +02:00
Ronald Cron
6b175d2404
Merge pull request #10771 from mpg/security-link-4.1
[4.1] Update broken link in SECURITY.md
2026-06-05 16:49:28 +00:00
Manuel Pégourié-Gonnard
a982231904 Update broken link
I believe the existing link was to the TF wiki which has been retired
for some time now.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-06-05 12:28:01 +02:00
Gilles Peskine
6181a54b57 Add CVE-ID
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-05 11:34:32 +02:00
Gilles Peskine
3345a59385 Add attribution for the second bug
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-05 11:34:32 +02:00
Gilles Peskine
5427ccf723 Update dependencies in forward port from 3.6
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-05 11:34:32 +02:00
Gilles Peskine
4e5d350871 Switch to MBEDTLS_ERROR_ADD for combining X509 and ASN1 error codes
Since Mbed TLS 4.0, this is just the low-level error code. But keep the
combination for uniformity with the rest of the file, and to reduce the
differences with the 3.6 branch.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-05 11:34:32 +02:00
Gilles Peskine
0c8913d906 basicConstraints with leading INTEGER field: document the behavior change
Announce the security fix together with the overflow fix, since the two bugs
are pretty much indistinguishable from a black-box perspective, despite
being due to independent problems in the code.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-05 11:34:32 +02:00
Gilles Peskine
4ac13cc65f Stop accepting basicConstraints with only pathLenConstraint
In an X.509 certificate, a basicConstraints extension where the cA
field (BOOLEAN) is omitted but the pathLenConstraint field (INTEGER )is
present is syntactically valid, but RFC 5280 states that CAs MUST NOT emit
such a certificate.

Historically, since XySSL 0.9 in 2008, if a basicConstraints extension
started with an INTEGER field, we interpreted that field as a cA value. This
was a deliberate change:

> Fixed x509_get_ext() to accept some rare certificates (like
> www.openssl.org:443) which have an INTEGER instead of a BOOLEAN for
> Extension::BasicConstraints::cA.

However, 18 years later, this does not seem to be relevant, and the details
seem to have been lost. Furthermore, major implementations follow RFC 5280
and interpret `SEQUENCE { INTEGER n }` with cA being set to its default
value (FALSE) and pathLenConstraint set to `n`. This means that such a
certificate with n != 0 would be interpreted as a CA certificate in Mbed TLS
but as a leaf certificate elsewhere, which is dangerous.

Since CAs are not supposed to emit such certificates, stop accepting them
altogether.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-05 11:34:32 +02:00
Gilles Peskine
f6afd20e71 basicConstraints pathLenConstraint tests: use standard cA type
In test cases for pathLenConstraint parsing in a basicConstraints extension
of an X.509 certificate, use the standard type for the leading cA field,
namely BOOLEAN. The test data was encoding that field as INTEGER, which was
accepted as a deviation from the standard since XySSL 0.9.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-05 11:34:32 +02:00
Gilles Peskine
ef81e71061 Remove unreachable CSR extensionRequest check
It is now unreachable because:

- end_set == end_attr_data is enforced at library/x509_csr.c:236.
- end_exts == end_set is enforced at library/x509_csr.c:248.
- x509_csr_parse_extensions() only returns success if *p == end_exts, enforced
  at library/x509_csr.c:188.

So after a successful x509_csr_parse_extensions() call, *p == end_exts ==
end_set == end_attr_data. The condition at line 257 cannot be true.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-05 11:34:22 +02:00
Gilles Peskine
44b833324b Tighten CSR extensionRequest bounds
Don't allow parts of a compound (SEQUENCE or SET) to go beyond the
containing compound.

The inline CSR regression test is derived from the existing "X509 CSR
ASN.1 (OK)" DER test vector. In the extensionRequest attribute, the original
well-formed fragment is:

    a029 3027 06092a864886f70d01090e 311a 3018 ...

where 31 1a is the SET containing the Extensions sequence and 30 18 is the
contained Extensions sequence. The malformed test changes only the SET
length byte, from 1a to 19:

    a029 3027 06092a864886f70d01090e 3119 3018 ...

The attribute SEQUENCE length and the inner Extensions sequence length are
left unchanged. This makes the SET one byte too short for its containing
attribute, so the parser must reject it with
MBEDTLS_ERR_ASN1_LENGTH_MISMATCH instead of parsing the trailing byte as
data outside the SET.

There is no known security impact, just some risk reduction.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-06-05 11:34:13 +02:00
Ben Taylor
0cc307762a Add ChangeLog
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-05 10:21:36 +01:00
Ben Taylor
1ac3989db6 Add fix for OOB key exchange error
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-06-05 09:49:35 +01:00
Ronald Cron
a73dce874b
Merge pull request #1588 from gilles-peskine-arm/ssl_tls13_prepare_new_session_ticket-psa_get_random-4.1
Backport 4.1: Fix ssl_tls13_prepare_new_session_ticket returning 1 on an RNG failure
2026-05-29 16:20:07 +02:00
Ronald Cron
a9e971b1b0
Merge pull request #1634 from valeriosetti/issue1569-backport-4.1
[backport 4.1] TLS 1.3 certificate chain signature algorithm policy gap
2026-05-29 13:35:08 +02:00
Valerio Setti
bd57fb5e8a changelog: fix typos
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-05-28 13:07:51 +02:00
Valerio Setti
f0ed933ca8 changelog: add note about issue 1569 resolution
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-05-28 13:07:51 +02:00
Valerio Setti
271bf18193 ssl: improve documentation of mbedtls_ssl_conf_sig_algs()
Clarify that the 'sig_algs' set through this function are only enforced
during the key exchange and that 'mbedtls_ssl_conf_cert_profile()' should
instead be used to enforce the same algorithms when verifying certificates.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2026-05-28 13:07:51 +02:00
Gilles Peskine
9007fc4b9b Fix lax basicConstraints parsing
When parsing the basicConstraints extension, reject junk after the SEQUENCE
inside the extension (which is probably benign), and reject a SEQUENCE that
extends beyond the extension (could be very dangerous).

Add a non-regression test where a certificate that is technically malformed,
but accepted as a leaf certificate by OpenSSL and other X.509
implementations, to be accepted as a CA certificate by Mbed TLS.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-05-26 20:51:52 +02:00
Gilles Peskine
1af2443a38 Update framework with test certificate with basicConstraints overflow
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-05-26 20:51:49 +02:00
Minos Galanakis
e16f0e0b01 ssl_write_supported_groups_ext: Updated documentation
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-05-26 10:31:03 +01:00
Janos Follath
a4f79350ac
Merge pull request #10742 from valeriosetti/backport-pr10741
[backport 4.1] mbedtls_config.c missing mbedtls_platform_requirements.h
2026-05-26 09:24:50 +00:00
Nadav0077
e0a83c328d
Harden serialized data deserialization
Reject malformed TLS 1.3 serialized sessions instead of accepting
unterminated strings or extra trailing data, and reject serialized SSL
contexts whose DTLS Connection ID length exceeds the maximum supported
size instead of overflowing the internal buffer.

Backport of #10715 (development).

Signed-off-by: Nadav0077 <18245584+Nadav0077@users.noreply.github.com>
2026-05-22 13:07:17 +03:00
Minos Galanakis
2e2087d246 test_suite_ssl: Added MBEDTLS_DEBUG_C guards to logs
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-05-20 15:01:43 +01:00
Minos Galanakis
c4461967af test_suite_ssl: Restructured reject_hrr_selecting_unoffered_group
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-05-20 15:01:21 +01:00
Minos Galanakis
d3931632fa test_suite_ssl: Renamed hrr_reject_selecting_unoffered_group
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-05-20 15:01:00 +01:00
Minos Galanakis
f8adf74988 sll_client: align TLS 1.3 supported_groups filtering with PSA curve support
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-05-20 15:00:52 +01:00
minosgalanakis
e862725edd
Merge pull request #10709 from yiwu0b11/remove_unused_ffdh_code-4.1
Backport 4.1: tests: remove remaining FFDH code in compat.sh
2026-05-13 16:49:07 +00:00
Minos Galanakis
be84be5d9a test_suite_ssl: doc fixes
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-05-13 11:45:44 +01:00
Minos Galanakis
45ca9e1e06 Added ChangeLog
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-05-12 15:02:05 +01:00
Minos Galanakis
2c164902ea Adjusted dependecies for hrr_reject_unadvertised_group
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-05-12 15:02:05 +01:00
Minos Galanakis
bac133ffcb test_suite_ssl: Introduced hrr_reject_unadvertised_group
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-05-12 15:02:05 +01:00
Minos Galanakis
cec2cef6b5 tls13_client: fix HRR selected_group validation
Reject HRR selected_group unless it matches the client’s original
supported_groups and is locally supported, so unadvertised groups are not
accepted in the second ClientHello.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-05-12 15:02:05 +01:00
Ronald Cron
123216ea40
Merge pull request #10751 from gilles-peskine-arm/python-project-knowledge-directory-mbedtls-4.1
Backport 4.1: Create Python project knowledge directory
2026-05-12 13:38:11 +00:00
minosgalanakis
b2e36d7d7a
Merge pull request #1601 from mpg/mbedtls-4.1-restricted
Merge public 4.1 into -restricted
2026-05-12 09:46:03 +01:00
Manuel Pégourié-Gonnard
def1fe66ca Merge branch 'mbedtls-4.1' into mbedtls-4.1-restricted
* mbedtls-4.1:
  Update framework pointer to bring in fix for python imports
  Update tf-psa-crypto to bring in python fix
2026-05-12 09:03:27 +02:00
Manuel Pégourié-Gonnard
10ff2fc1d9
Merge pull request #10750 from bjwtaylor/broken-build-1.1
Update framework pointer to bring in fix for python imports
2026-05-11 10:50:47 +00:00
Manuel Pégourié-Gonnard
e292284ddb Merge branch 'mbedtls-4.1' into mbedtls-4.1-restricted
* mbedtls-4.1: (37 commits)
  check_config: fix error message for missing TLS 1.2 key exchanges
  check_config: add check for TLS 1.3 key exchanges
  tests: depends.py: extend pkalgs including PSA_WANT_ALG_RSA_PKCS1V15_SIGN
  tests: depends.py: fix reverse dependency for RSA
  library: check_config: remove RSA encryption requirement from ECDHE-RSA
  update ChangeLog
  add ChangeLog
  Fix build warning/error using llvm-mingw
  test: improve symlink checks
  test: versioned symlink order fix
  test: reorder if-else structure
  test: add debug output and fix for win config
  ChangeLog fix
  tests: fix DESTDIR install checks and add macOS compatibility
  ChangeLog fixes
  ChangeLog padding space fix
  Test: add symlinks and dangling link check
  ChangeLog fix
  ChangeLog newline fix
  Add changelog
  ...
2026-05-11 12:12:10 +02:00
Gilles Peskine
4f149ffc02 Update comment
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-05-08 18:00:45 +02:00
Gilles Peskine
c7b1c86e6b Prefer to load tf_psa_crypto_test_case_info from project_knowledge
Try to load the list of tests that TF-PSA-Crypto wants us to ignore in three
ways, depending on the age of the tf-psa-crypto submodule:

* Modern: import `tf_psa_crypto_test_case_info` as an ordinary module,
  expected to be found in `tf-psa-crypto/scripts/project_knowledge`.
* First location, quickly superseded: load
  `tf-psa-crypto/tests/scripts/tf_psa_crypto_test_case_info.py`,
  in a hackish way because we don't want to put that directory on the
  load path.
* Oldest: there is no `tf_psa_crypto_test_case_info.py`. Use a hard-coded
  list.

Once all the TF-PSA-Crypto branches we care about (e.g. pull requests
in progress) are updated with
`tf-psa-crypto/scripts/project_knowledge/tf_psa_crypto_test_case_info.py`,
we can drop the backward compatibilty hacks and simply
`import tf_psa_crypto_test_case_info` unconditionally and use
`tf_psa_crypto_test_case_info.INTERNAL_TEST_CASES` unconditionally.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-05-08 18:00:45 +02:00
Gilles Peskine
da2b5d6f42 Add tf-psa-crypto/scripts/project_knowledge to Python load path
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-05-08 18:00:45 +02:00
Ben Taylor
e18c52e93d Update framework pointer to bring in fix for python imports
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-05-08 11:01:05 +01:00
Ben Taylor
ce8c6708dd Update tf-psa-crypto to bring in python fix
Signed-off-by: Ben Taylor <ben.taylor@linaro.org>
2026-05-08 11:00:50 +01:00
Valerio Setti
cfb07a923d changelog: add note about fix of issue 10740
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-04-29 17:10:04 +02:00
Valerio Setti
23538fd562 include mbedtls_platform_requirements.h in mbedtls_config.c
This is required because if the user defined configuration file (not the
default one provided by mbedtls) includes files from the standard
C library then __STDC_WANT_LIB_EXT1__ won't be defined there which
cause weird build failures.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-04-29 17:10:04 +02:00
minosgalanakis
8f8b35b41c
Merge pull request #10711 from valord577/patch-1-backport-v4
[backport 4.1 #10695] Fix build warning/error using llvm-mingw
2026-04-29 14:52:04 +00:00
Gilles Peskine
ded271a8c4
Merge pull request #10696 from yiwu0b11/destdir_install_env_support-4.1
Backport 4.1: Support DESTDIR for install and add build-system test
2026-04-29 14:37:40 +00:00
Valerio Setti
5875ffa6fc
Merge pull request #10713 from valeriosetti/backport-pr10650
[backport 4.1] check_config: add missing check for TLS 1.3 key exchanges
2026-04-24 14:32:42 +00:00
Valerio Setti
b4df7bb14d
Merge pull request #10712 from valeriosetti/backport-pr10639
[backport 4.1] library: check_config: remove RSA encryption requirement from ECDHE-RSA
2026-04-24 07:30:58 +00:00
Valerio Setti
f2ab107392 check_config: fix error message for missing TLS 1.2 key exchanges
Align the error message to the one used for the same check in TLS 1.3.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-04-23 14:51:52 +02:00
Valerio Setti
1caa7db5e8 check_config: add check for TLS 1.3 key exchanges
When MBEDTLS_SSL_PROTO_TLS1_3 is enabled ensure that at least one of the
related key exchanges is also enabled.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-04-23 14:51:48 +02:00
Valerio Setti
377cbb2055 tests: depends.py: extend pkalgs including PSA_WANT_ALG_RSA_PKCS1V15_SIGN
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-04-22 17:17:41 +02:00
Valerio Setti
9d4447fdc5 tests: depends.py: fix reverse dependency for RSA
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-04-22 17:17:41 +02:00
Valerio Setti
2882b73697 library: check_config: remove RSA encryption requirement from ECDHE-RSA
ECDHE-RSA only requires RSA signature, not encryption. This commits fixes
guards in "mbedtls_check_config.h".

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-04-22 17:17:41 +02:00
valord577
fce010911c update ChangeLog
Signed-off-by: valord577 <valord577@gmail.com>
2026-04-22 11:09:29 +08:00
valord577
3bf4af0838 add ChangeLog
Signed-off-by: valord577 <valord577@gmail.com>
2026-04-22 11:09:21 +08:00
valord577
fb43ea9278 Fix build warning/error using llvm-mingw
error logs refs: https://github.com/valord577/nativepkgs/actions/runs/24490614774/job/71574726128

Signed-off-by: valord577 <valord577@gmail.com>
2026-04-22 11:09:16 +08:00
Yi Wu
c7b630ffa1 tests: remove remaining FFDH code in compat.sh
Signed-off-by: Yi Wu <yi.wu2@arm.com>
2026-04-21 10:33:54 +01:00
Ronald Cron
6a5e0139f8
Merge pull request #10703 from minosgalanakis/docs/4.1.0_changelog_fixes_bp
ChangeLog 4.1 Fixed references to TF-PSA-Crypto
2026-04-20 09:49:28 +00:00
Yi Wu
7c63e641e3 test: improve symlink checks
Signed-off-by: Yi Wu <yi.wu2@arm.com>
2026-04-20 10:48:29 +01:00
Yi Wu
6c63f39eeb test: versioned symlink order fix
Signed-off-by: Yi Wu <yi.wu2@arm.com>
2026-04-20 10:48:29 +01:00
Yi Wu
5bddf62a69 test: reorder if-else structure
Signed-off-by: Yi Wu <yi.wu2@arm.com>
2026-04-20 10:48:29 +01:00
Yi Wu
9d88e0b200 test: add debug output and fix for win config
Signed-off-by: Yi Wu <yi.wu2@arm.com>
2026-04-20 10:48:29 +01:00
Yi Wu
0dc58e196d ChangeLog fix
Signed-off-by: Yi Wu <yi.wu2@arm.com>
2026-04-20 10:48:29 +01:00
Yi Wu
ee0f8cbc11 tests: fix DESTDIR install checks and add macOS compatibility
Signed-off-by: Yi Wu <yi.wu2@arm.com>
2026-04-20 10:48:29 +01:00
Yi Wu
f645b06c38 ChangeLog fixes
Signed-off-by: Yi Wu <yi.wu2@arm.com>
2026-04-20 10:48:29 +01:00
Yi Wu
9ffdbe5bf3 ChangeLog padding space fix
Signed-off-by: Yi Wu <yi.wu2@arm.com>
2026-04-20 10:48:29 +01:00
Yi Wu
291fb02523 Test: add symlinks and dangling link check
Signed-off-by: Yi Wu <yi.wu2@arm.com>
2026-04-20 10:48:29 +01:00
Yi Wu
ff66c4efb9 ChangeLog fix
Signed-off-by: Yi Wu <yi.wu2@arm.com>
2026-04-20 10:48:29 +01:00
Yi Wu
f2d35a04ed ChangeLog newline fix
Signed-off-by: Yi Wu <yi.wu2@arm.com>
2026-04-20 10:48:29 +01:00
Yi Wu
c839d60443 Add changelog
Signed-off-by: Yi Wu <yi.wu2@arm.com>
2026-04-20 10:48:29 +01:00
Yi Wu
897daf3ea1 Support DESTDIR for install and add build-system test
Signed-off-by: Yi Wu <yi.wu2@arm.com>
2026-04-20 10:48:29 +01:00
Ronald Cron
f9990f3289
Merge pull request #10704 from Maokaman1/fix/tls12-rsa-pss-sigalgs-4.1
Backport 4.1: ssl: accept TLS 1.2 rsa_pss_rsae signature algorithms
2026-04-20 08:03:21 +00:00
Viktor Sokolovskiy
4302c8dffb Pacify uncrustify
Signed-off-by: Viktor Sokolovskiy <maokaman@gmail.com>
2026-04-18 02:02:15 +03:00
Minos Galanakis
f9610844e6 ChangeLog: Fixed a reference to TF-PSA-Crypto
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-04-17 17:17:48 +01:00
Viktor Sokolovskiy
5fc28f4016 ssl: accept TLS 1.2 rsa_pss_rsae in client SKE
Fix a TLS 1.2 client regression that caused valid ServerKeyExchange signatures using rsa_pss_rsae_* to be rejected.

Allow rsa_pss_rsae_* in the TLS 1.2 client ServerKeyExchange parse path when the algorithm is supported and was offered by the client. Add OpenSSL and GnuTLS interoperability coverage for TLS 1.2 servers that force rsa_pss_rsae_sha256.

Fixes #10668.

Signed-off-by: Viktor Sokolovskiy <maokaman@gmail.com>
2026-04-17 19:16:20 +03:00
Gilles Peskine
e589739db1
Merge pull request #10685 from gilles-peskine-arm/maintainer-scripts-create-directory-4.1
Backport 4.1: Create a directory for maintainer-only Python scripts
2026-04-15 08:19:31 +00:00
Gilles Peskine
b116c4deff
Merge pull request #10688 from gilles-peskine-arm/analyze_outcomes-read_crypto-4.1
Backport 4.1: Let TF-PSA-Crypto define test cases that Mbed TLS does not need to cover
2026-04-13 09:24:12 +00:00
Gilles Peskine
635d64362f Update crypto submodule with analyze_outcomes.py
Update framework to match.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-04-10 14:48:05 +02:00
Gilles Peskine
a4144255f1 Documentation improvements
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-04-10 14:43:46 +02:00
Gilles Peskine
eeb2e3379f INTERNAL_TEST_CASES moved to a separate data-only module
This way, when Mbed TLS's `analyze_outcomes.py` loads the python module from
TF-PSA-Crypto (because it needs to know the value of `INTERNAL_TEST_CASES`),
there's no risk that the subproject and the superproject will have different
requirements on auxiliary modules such as `mbedtls_framework.outcome_analysis`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-04-10 14:43:46 +02:00
Gilles Peskine
824b4cde5a Add copyright line
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-04-10 14:43:46 +02:00
Gilles Peskine
7f78af02c4 Move test currently covered by crypto from uncovered list to ignored list
If we can't read `INTERNAL_TEST_CASES` from
`tf-psa-crypto/tests/scripts/analyze_outcomes.py` because the script doesn't
exist, hard-code the legacy value of that information.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-04-10 14:43:46 +02:00
Gilles Peskine
ef7ff7e7fd Ignore test cases that TF-PSA-Crypto tells us to ignore
If the `tf-psa-crypto` submodule has `tests/scripts/analyze_outcomes.py`,
require it to define a global variable `INTERNAL_TEST_CASES`. Those test
cases will be ignored in Mbed TLS's coverage analysis.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-04-10 14:43:46 +02:00
Gilles Peskine
f1d880203c Move _has_word_re to the framework
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-04-10 14:43:46 +02:00
Gilles Peskine
3233f2523c Rename IGNORED_TESTS to UNCOVERED_TESTS
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-04-10 14:43:46 +02:00
Gilles Peskine
2b4ceb533b Update framework with UNCOVERED_TESTS in outcome analysis
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-04-10 14:43:46 +02:00
Gilles Peskine
16541a9a42 Create a directory for maintainer-only Python scripts
This directory is currently excluded from `check-python-files.sh`, because
we run it on the CI in an old Python version that doesn't support some of
our new maintainer scripts.

There are no such scripts in mbedtls for now (only in TF-PSA-Crypto), but be
ready if we want to add some.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-04-09 19:39:20 +02:00
minosgalanakis
421f5d27fe
Merge pull request #1548 from minosgalanakis/public-mbedtls-4.1
Merge public changes into internal LTS 4.1 branch
2026-04-02 22:40:53 +01:00
David Horstmann
521d2eb1fe
Merge pull request #10669 from gilles-peskine-arm/security-md-mention-compiler-4.1
Backport 4.1: Mention compiler optimization in the threat model
2026-04-01 15:46:13 +00:00
Gilles Peskine
b43bdd7365 Be more specific about what compiler options we consider legitimate
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-04-01 11:08:23 +02:00
Gilles Peskine
77a32fab9b Mention the new advice about compiler options in the changelog
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-04-01 11:08:23 +02:00
Gilles Peskine
582d23e04c Add a section about compiler-introduced timing side channels
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-04-01 11:08:23 +02:00
19 changed files with 75 additions and 51 deletions

View File

@ -9,14 +9,13 @@ Please write a few sentences describing the overall goals of the pull request's
Please remove the segment/s on either side of the | symbol as appropriate, and add any relevant link/s to the end of the line.
If the provided content is part of the present PR remove the # symbol.
- [ ] **changelog** provided | not required because:
- [ ] **changelog** provided | not required because:
- [ ] **development PR** provided # | not required because:
- [ ] **TF-PSA-Crypto PR** provided # | not required because:
- [ ] **framework PR** provided Mbed-TLS/mbedtls-framework# | not required
- [ ] **TF-PSA-Crypto development PR** provided Mbed-TLS/TF-PSA-Crypto# | not required because:
- [ ] **TF-PSA-Crypto 1.1 PR** provided Mbed-TLS/TF-PSA-Crypto# | not required because:
- [ ] **mbedtls development PR** provided # | not required because:
- [ ] **mbedtls 4.1 PR** provided # | not required because:
- [ ] **mbedtls 3.6 PR** provided # | not required because:
- **tests** provided | not required because:
- [ ] **3.6 PR** provided # | not required because:
- **tests** provided | not required because:
## Notes for the submitter

View File

@ -37,7 +37,7 @@ cmake_policy(SET CMP0011 NEW)
# is deprecated and will be removed in future versions.
cmake_policy(SET CMP0012 NEW)
set(MBEDTLS_VERSION 4.2.0)
set(MBEDTLS_VERSION 4.1.1)
set(MBEDTLS_CRYPTO_SOVERSION 18)
set(MBEDTLS_X509_SOVERSION 9)
set(MBEDTLS_TLS_SOVERSION 23)

View File

@ -1,6 +1,6 @@
Mbed TLS ChangeLog (Sorted per branch, date)
= Mbed TLS 4.2.0 branch released 2026-07-07
= Mbed TLS 4.1.1 branch released 2026-07-07
Features
* Restore DESTDIR support for CMake installs of compatibility
@ -32,7 +32,7 @@ Security
man-in-the-middle attacker to cause loss of 0-RTT early data.
Reported by Ben Smyth.
* Fix a remote buffer overflow in (D)TLS with ECDHE-PSK cipher suites when
CBC is disabled. Reported by Karnakar Reddy. CVE-2026-50580
CBC is disabled. Reported by Karnakar Reddy. CVE-ID-50580
* Fix a potential information disclosure in TLS 1.2 servers using session
tickets. If the session ticket write callback failed without setting the
lifetime output parameter, Mbed TLS could send 4 bytes of uninitialized
@ -47,7 +47,9 @@ Security
signed_data.signers.next pointers cannot be walked by a later free
operation. CVE-2026-50579
* PKCS7 now rejects weak hash algorithms (RIPEMD160, MD5, SHA-1, SHA-224,
SHA3-224) on signature verification.
SHA3-224) on signature verification. The new configuration option
MBEDTLS_PKCS7_ALLOW_WEAK_SIGNATURES allows to keep using weak hash
algorithms in PKCS7 for backward compatibility purposes.
* Improved documentation of mbedtls_ssl_conf_sig_algs() to emphasize that
this function only sets signature algorithms that are enforced during
TLS key exchange and not on certificate verification. Reported by
@ -92,7 +94,7 @@ Bugfix
wrappers do not exactly contain the requested extensions.
Changes
* Upgraded TF-PSA-Crypto from 1.1.0 to 1.2.0. See tf-psa-crypto/ChangeLog.
* Upgraded TF-PSA-Crypto from 1.1.0 to 1.1.1. See tf-psa-crypto/ChangeLog.
* X.509 certificates with a basicConstraints extension starting with an
INTEGER field are no longer accepted. According to RFC 5280, such
certificates are syntactically valid and the first field is the

View File

@ -10,7 +10,7 @@
*/
/**
* @mainpage Mbed TLS v4.2.0 API Documentation
* @mainpage Mbed TLS v4.1.1 API Documentation
*
* This documentation describes the application programming interface (API)
* of Mbed TLS.

View File

@ -1,4 +1,4 @@
PROJECT_NAME = "Mbed TLS v4.2.0"
PROJECT_NAME = "Mbed TLS v4.1.1"
OUTPUT_DIRECTORY = ../apidoc/
FULL_PATH_NAMES = NO
OPTIMIZE_OUTPUT_FOR_C = YES

@ -1 +1 @@
Subproject commit a3079552234917a9831dd70693983af5e62c70de
Subproject commit dde0c4a0e448a0552f18817dcea633bb851fd288

View File

@ -27,17 +27,17 @@
* Major, Minor, Patchlevel
*/
#define MBEDTLS_VERSION_MAJOR 4
#define MBEDTLS_VERSION_MINOR 2
#define MBEDTLS_VERSION_PATCH 0
#define MBEDTLS_VERSION_MINOR 1
#define MBEDTLS_VERSION_PATCH 1
/**
* The single version number has the following structure:
* MMNNPP00
* Major version | Minor version | Patch version
*/
#define MBEDTLS_VERSION_NUMBER 0x04020000
#define MBEDTLS_VERSION_STRING "4.2.0"
#define MBEDTLS_VERSION_STRING_FULL "Mbed TLS 4.2.0"
#define MBEDTLS_VERSION_NUMBER 0x04010100
#define MBEDTLS_VERSION_STRING "4.1.1"
#define MBEDTLS_VERSION_STRING_FULL "Mbed TLS 4.1.1"
#if defined(MBEDTLS_CONFIG_FILES_READ)
#error "Something went wrong: MBEDTLS_CONFIG_FILES_READ defined before reading the config files!"

View File

@ -1036,6 +1036,15 @@
*/
#define MBEDTLS_PKCS7_C
/**
* \def MBEDTLS_PKCS7_ALLOW_WEAK_SIGNATURES
*
* Allow weak signature algorithms (RIPEMD160, MD5, SHA-1) in PKCS#7.
*
* Requires: MBEDTLS_PKCS7_C
*/
// #define MBEDTLS_PKCS7_ALLOW_WEAK_SIGNATURES
/**
* \def MBEDTLS_X509_CREATE_C
*

View File

@ -32,9 +32,11 @@
* - The RFC allows for the signed Data type to contain contentInfo. This
* implementation assumes the type is DATA and the content is empty.
* - The RFC doesn't put any constrain on the hash algorithm to be used, but
* this implementation rejects weak hash algorithms (i.e. RIPEMD160, MD5,
* SHA-1, SHA-224, SHA3-224). In general accepted hash and PK algorithms are
* the ones belonging to `mbedtls_x509_crt_profile_default`.
* this implementation by default rejects weak hash algorithms (i.e. RIPEMD160,
* MD5, SHA-1, SHA-224, SHA3-224). In general accepted hash algorithms
* are the ones belonging to ::mbedtls_x509_crt_profile_default.
* #MBEDTLS_PKCS7_ALLOW_WEAK_SIGNATURES can be enabled to accept all
* supported hash algorithms.
*/
#ifndef MBEDTLS_PKCS7_H

View File

@ -665,6 +665,7 @@ static int mbedtls_pkcs7_data_or_hash_verify(mbedtls_pkcs7 *pkcs7,
return ret;
}
#if !defined(MBEDTLS_PKCS7_ALLOW_WEAK_SIGNATURES)
/* Ensure the MD alg from the PKCS#7 context and signature algorithm from
* the certificate belong to the list of secure algorithms
* (i.e. mbedtls_x509_crt_profile_default). */
@ -676,6 +677,7 @@ static int mbedtls_pkcs7_data_or_hash_verify(mbedtls_pkcs7 *pkcs7,
if (ret != 0) {
return MBEDTLS_ERR_PKCS7_INVALID_ALG;
}
#endif /* MBEDTLS_PKCS7_ALLOW_WEAK_SIGNATURES */
md_info = mbedtls_md_info_from_type(md_alg);
if (md_info == NULL) {

View File

@ -341,12 +341,11 @@ static int ssl_tls13_parse_certificate_verify(mbedtls_ssl_context *ssl,
MBEDTLS_SSL_DEBUG_BUF(3, "verify hash", verify_hash, verify_hash_len);
ret = mbedtls_pk_verify_ext((mbedtls_pk_sigalg_t) sig_alg,
&ssl->session_negotiate->peer_cert->pk,
md_alg, verify_hash, verify_hash_len,
p, signature_len);
if (ret == 0) {
return ret;
if ((ret = mbedtls_pk_verify_ext((mbedtls_pk_sigalg_t) sig_alg,
&ssl->session_negotiate->peer_cert->pk,
md_alg, verify_hash, verify_hash_len,
p, signature_len)) == 0) {
return 0;
}
MBEDTLS_SSL_DEBUG_RET(1, "mbedtls_pk_verify_ext", ret);

View File

@ -9,6 +9,7 @@ MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED
MBEDTLS_KEY_EXCHANGE_PSK_ENABLED
MBEDTLS_NET_C
MBEDTLS_PKCS7_ALLOW_WEAK_SIGNATURES
MBEDTLS_PKCS7_C
MBEDTLS_PSK_MAX_LEN
MBEDTLS_SSL_ALL_ALERT_MESSAGES

View File

@ -188,7 +188,7 @@ foreach my $match (@matches)
$first = 0;
foreach my $dep (split(/,/, ${$old_define_name}))
{
${$code_check} .= " ||\n " if ($first++);
${$code_check} .= " || \n " if ($first++);
${$code_check} .= "${$old_define_prefix}${dep}${$old_define_suffix}";
}
${$code_check} .= " */\n\n";
@ -229,7 +229,7 @@ if ($ll_old_define[0] ne "")
my $first = 0;
foreach my $dep (split(/,/, $ll_old_define[0]))
{
$ll_code_check .= " ||\n " if ($first++);
$ll_code_check .= " || \n " if ($first++);
$ll_code_check .= "${ll_old_define[1]}${dep}${ll_old_define[2]}";
}
$ll_code_check .= " */\n";
@ -240,7 +240,7 @@ if ($hl_old_define[0] ne "")
my $first = 0;
foreach my $dep (split(/,/, $hl_old_define[0]))
{
$hl_code_check .= " ||\n " if ($first++);
$hl_code_check .= " || \n " if ($first++);
$hl_code_check .= "${hl_old_define[1]}${dep}${hl_old_define[2]}";
}
$hl_code_check .= " */\n";

View File

@ -14116,6 +14116,7 @@ run_test "TLS 1.2: Check rsa_pss_rsae compatibility issue, m->O" \
-c "Protocol is TLSv1.2" \
-c "HTTP/1.0 200 [Oo][Kk]"
requires_gnutls_tls1_3
requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_2
requires_config_enabled MBEDTLS_DEBUG_C

View File

@ -95,17 +95,29 @@ depends_on:PSA_WANT_ALG_SHA_256:PSA_HAVE_ALG_RSA_PKCS1V15_VERIFY
pkcs7_verify:"../framework/data_files/pkcs7_data_cert_signed_sha256.der":"../framework/data_files/pkcs7-rsa-sha256-1.der":"../framework/data_files/pkcs7_data.bin":MBEDTLS_MD_SHA256:0
PKCS7 Signed Data Verification Fail SHA1 #10
depends_on:PSA_WANT_ALG_SHA_1:PSA_WANT_ALG_SHA_256:PSA_HAVE_ALG_RSA_PKCS1V15_VERIFY
depends_on:PSA_WANT_ALG_SHA_1:PSA_WANT_ALG_SHA_256:PSA_HAVE_ALG_RSA_PKCS1V15_VERIFY:!MBEDTLS_PKCS7_ALLOW_WEAK_SIGNATURES
pkcs7_verify:"../framework/data_files/pkcs7_data_cert_signed_sha1.der":"../framework/data_files/pkcs7-rsa-sha256-1.der":"../framework/data_files/pkcs7_data.bin":0:MBEDTLS_ERR_PKCS7_INVALID_ALG
PKCS7 Signed Data Verification Pass SHA1 #10
depends_on:PSA_WANT_ALG_SHA_1:PSA_WANT_ALG_SHA_256:PSA_HAVE_ALG_RSA_PKCS1V15_VERIFY:MBEDTLS_PKCS7_ALLOW_WEAK_SIGNATURES
pkcs7_verify:"../framework/data_files/pkcs7_data_cert_signed_sha1.der":"../framework/data_files/pkcs7-rsa-sha256-1.der":"../framework/data_files/pkcs7_data.bin":0:0
PKCS7 Signed Data Verification Fail MD5 #10.1
depends_on:PSA_WANT_ALG_MD5:PSA_WANT_ALG_SHA_256:PSA_HAVE_ALG_RSA_PKCS1V15_VERIFY
depends_on:PSA_WANT_ALG_MD5:PSA_WANT_ALG_SHA_256:PSA_HAVE_ALG_RSA_PKCS1V15_VERIFY:!MBEDTLS_PKCS7_ALLOW_WEAK_SIGNATURES
pkcs7_verify:"../framework/data_files/pkcs7_data_cert_signed_md5.der":"../framework/data_files/pkcs7-rsa-sha256-1.der":"../framework/data_files/pkcs7_data.bin":0:MBEDTLS_ERR_PKCS7_INVALID_ALG
PKCS7 Signed Data Verification Pass MD5 #10.1
depends_on:PSA_WANT_ALG_MD5:PSA_WANT_ALG_SHA_256:PSA_HAVE_ALG_RSA_PKCS1V15_VERIFY:MBEDTLS_PKCS7_ALLOW_WEAK_SIGNATURES
pkcs7_verify:"../framework/data_files/pkcs7_data_cert_signed_md5.der":"../framework/data_files/pkcs7-rsa-sha256-1.der":"../framework/data_files/pkcs7_data.bin":0:0
PKCS7 Signed Data Verification Fail RIPEMD160 #10.2
depends_on:PSA_WANT_ALG_RIPEMD160:PSA_WANT_ALG_SHA_256:PSA_HAVE_ALG_RSA_PKCS1V15_VERIFY
depends_on:PSA_WANT_ALG_RIPEMD160:PSA_WANT_ALG_SHA_256:PSA_HAVE_ALG_RSA_PKCS1V15_VERIFY:!MBEDTLS_PKCS7_ALLOW_WEAK_SIGNATURES
pkcs7_verify:"../framework/data_files/pkcs7_data_cert_signed_ripemd160.der":"../framework/data_files/pkcs7-rsa-sha256-1.der":"../framework/data_files/pkcs7_data.bin":0:MBEDTLS_ERR_PKCS7_INVALID_ALG
PKCS7 Signed Data Verification Pass RIPEMD160 #10.2
depends_on:PSA_WANT_ALG_RIPEMD160:PSA_WANT_ALG_SHA_256:PSA_HAVE_ALG_RSA_PKCS1V15_VERIFY:MBEDTLS_PKCS7_ALLOW_WEAK_SIGNATURES
pkcs7_verify:"../framework/data_files/pkcs7_data_cert_signed_ripemd160.der":"../framework/data_files/pkcs7-rsa-sha256-1.der":"../framework/data_files/pkcs7_data.bin":0:0
PKCS7 Signed Data Verification Pass SHA512 #11
depends_on:PSA_WANT_ALG_SHA_512:PSA_WANT_ALG_SHA_256:PSA_HAVE_ALG_RSA_PKCS1V15_VERIFY
pkcs7_verify:"../framework/data_files/pkcs7_data_cert_signed_sha512.der":"../framework/data_files/pkcs7-rsa-sha256-1.der":"../framework/data_files/pkcs7_data.bin":0:0

View File

@ -1,8 +1,8 @@
Check compile time library version
check_compiletime_version:"4.2.0"
check_compiletime_version:"4.1.1"
Check runtime library version
check_runtime_version:"4.2.0"
check_runtime_version:"4.1.1"
Check for MBEDTLS_VERSION_C
check_feature:"MBEDTLS_VERSION_C":0

View File

@ -1769,15 +1769,15 @@ x509parse_crt:"307d3068a0030201008204deadbeef300d06092a864886f70d01010b0500300c3
X509 CRT ASN1 (TBS, inv SubPubKeyInfo, inv internal bitstring length)
depends_on:PSA_HAVE_ALG_SOME_RSA_VERIFY:PSA_WANT_ALG_SHA_256
x509parse_crt:"308180306ba0030201008204deadbeef300d06092a864886f70d01010b0500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743015300d06092A864886F70D0101010500030400300000300d06092a864886f70d01010b0500030200ff":"":MBEDTLS_ERR_PK_INVALID_ALG
x509parse_crt:"308180306ba0030201008204deadbeef300d06092a864886f70d01010b0500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743015300d06092A864886F70D0101010500030400300000300d06092a864886f70d01010b0500030200ff":"":MBEDTLS_ERR_PK_INVALID_PUBKEY
X509 CRT ASN1 (TBS, inv SubPubKeyInfo, inv internal bitstring tag)
depends_on:PSA_HAVE_ALG_SOME_RSA_VERIFY:PSA_WANT_ALG_SHA_256
x509parse_crt:"308180306ba0030201008204deadbeef300d06092a864886f70d01010b0500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743015300d06092A864886F70D0101010500030400310000300d06092a864886f70d01010b0500030200ff":"":MBEDTLS_ERR_PK_INVALID_ALG
x509parse_crt:"308180306ba0030201008204deadbeef300d06092a864886f70d01010b0500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a300806001304546573743015300d06092A864886F70D0101010500030400310000300d06092a864886f70d01010b0500030200ff":"":MBEDTLS_ERR_PK_INVALID_PUBKEY
X509 CRT ASN1 (TBS, inv SubPubKeyInfo, inv RSA modulus)
depends_on:PSA_HAVE_ALG_SOME_RSA_VERIFY:PSA_WANT_ALG_SHA_256
x509parse_crt:"3081873072a0030201008204deadbeef300d06092a864886f70d01010b0500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374301c300d06092A864886F70D0101010500030b0030080202ffff0302ffff300d06092a864886f70d01010b0500030200ff":"":MBEDTLS_ERR_PK_INVALID_ALG
x509parse_crt:"3081873072a0030201008204deadbeef300d06092a864886f70d01010b0500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374301c300d06092A864886F70D0101010500030b0030080202ffff0302ffff300d06092a864886f70d01010b0500030200ff":"":MBEDTLS_ERR_PK_INVALID_PUBKEY
X509 CRT ASN1 (TBS, inv SubPubKeyInfo, total length mismatch)
depends_on:PSA_HAVE_ALG_SOME_RSA_VERIFY:PSA_WANT_ALG_SHA_256
@ -1785,11 +1785,11 @@ x509parse_crt:"3081893074a0030201008204deadbeef300d06092a864886f70d01010b0500300
X509 CRT ASN1 (TBS, inv SubPubKeyInfo, check failed)
depends_on:PSA_HAVE_ALG_SOME_RSA_VERIFY:PSA_WANT_ALG_SHA_256
x509parse_crt:"3081873072a0030201008204deadbeef300d06092a864886f70d01010b0500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374301c300d06092A864886F70D0101010500030b0030080202ffff0202ffff300d06092a864886f70d01010b0500030200ff":"":MBEDTLS_ERR_PK_INVALID_ALG
x509parse_crt:"3081873072a0030201008204deadbeef300d06092a864886f70d01010b0500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374301c300d06092A864886F70D0101010500030b0030080202ffff0202ffff300d06092a864886f70d01010b0500030200ff":"":MBEDTLS_ERR_PK_INVALID_PUBKEY
X509 CRT ASN1 (TBS, inv SubPubKeyInfo, check failed, expanded length notation)
depends_on:PSA_HAVE_ALG_SOME_RSA_VERIFY:PSA_WANT_ALG_SHA_256
x509parse_crt:"308196308180a0030201008204deadbeef300d06092a864886f70d01010b0500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210fffffffffffffffffffffffffffffffe0202ffff300d06092a864886f70d01010b0500030200ff":"":MBEDTLS_ERR_PK_INVALID_ALG
x509parse_crt:"308196308180a0030201008204deadbeef300d06092a864886f70d01010b0500300c310a30080600130454657374301c170c303930313031303030303030170c303931323331323335393539300c310a30080600130454657374302a300d06092A864886F70D010101050003190030160210fffffffffffffffffffffffffffffffe0202ffff300d06092a864886f70d01010b0500030200ff":"":MBEDTLS_ERR_PK_INVALID_PUBKEY
# We expect an extension parsing error here because the IssuerID is optional.
# Hence, if we find an ASN.1 tag doesn't match the IssuerID, we assume the

View File

@ -1136,15 +1136,12 @@ void x509parse_crt(data_t *buf, char *result_str, int result)
#else
((void) result_str);
#endif
int res;
/* After psa#827 some failing tests that were returning MBEDTLS_ERR_PK_INVALID_PUBKEY
* will return MBEDTLS_ERR_PK_INVALID_ALG instead. We need a temporary
* backward compatibility fix until psa#827 is merged.
*/
/* Tests whose result is MBEDTLS_ERR_PK_INVALID_PUBKEY might return
* MBEDTLS_ERR_ASN1_UNEXPECTED_TAG until psa#308 is merged. This variable
* is therefore used for backward compatiblity and will be removed in
* mbedtls#10229. */
int result_back_comp = result;
if (result == MBEDTLS_ERR_PK_INVALID_ALG) {
result_back_comp = MBEDTLS_ERR_PK_INVALID_PUBKEY;
}
int res;
mbedtls_x509_crt_init(&crt);
USE_PSA_INIT();

@ -1 +1 @@
Subproject commit a92cb6a97d84762d2f4355eae99af7b9ff5c6ae1
Subproject commit a0632be94d883daa0295ac1eabf70359ad94f91b