Commit Graph

34309 Commits

Author SHA1 Message Date
Valerio Setti
e4d2126ad8 tests: ssl: replace dependency from RSA PSS to PKCS v1.5 in one handshake test
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-03-16 21:31:14 +01:00
Valerio Setti
2258cb7b5a tests: pkcs7: ease requirements for parse tests
replace PSA_HAVE_ALG_SOME_RSA_VERIFY with PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-03-16 13:52:01 +01:00
Valerio Setti
0dfc52e740 tests: ssl: replace remaining occurrences of legacy RSA algorithms
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-03-16 13:52:01 +01:00
Valerio Setti
ed0aebd2c5 tests: bulk replace MBEDTLS_RSA_C with PSA_HAVE_ALG_SOME_RSA_SIGN
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-03-16 13:52:01 +01:00
Valerio Setti
2fab51329b tests: bulk replace MBEDTLS_RSA_C with PSA_HAVE_ALG_SOME_RSA_VERIFY
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-03-16 13:52:01 +01:00
Valerio Setti
ff2630664a tests: bulk replace MBEDTLS_RSA_C with PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-03-16 13:52:01 +01:00
Valerio Setti
ae885590fb library: bulk replace MBEDTLS_RSA_C with PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_BASIC
Follow the same pattern that was used in the past to remove dependency
on MBEDTLS_RSA_C and use PSA_WANT instead.

Relying on MBEDTLS_RSA_C is fine only when builtin drivers are compiled
since all PSA_WANT are converted to legacy build symbols. However when
builtin drivers are not built (ex: in case of TF-M), then part of the code
in TLS/X509 won't be compiled because MBEDTLS_RSA_C is not set. OTOH
it's not possible to declare that symbol in a configuration file because
it's a legacy one and it will be rejected by buildtime checks.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-03-16 13:52:01 +01:00
Valerio Setti
488dbf8bcb Merge pull request #10638 from valeriosetti/x509-fix-ecp-guard
library: x509: fix guard in mbedtls_x509_crt_profile_next
2026-03-13 14:21:04 +00:00
Valerio Setti
95f0885507 library: x509: fix guard in mbedtls_x509_crt_profile_next
Replace MBEDTLS_ECP_C with PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY which is
already used in all other profiles in this file.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-03-13 12:01:18 +01:00
Ronald Cron
b5749b88f6 Merge pull request #10576 from ronald-cron-arm/dtls-client-hello-defragmentation
Add support for (D)TLS 1.2 client hello defragmentation
2026-03-10 14:46:07 +00:00
Ronald Cron
09210ea54f Restore seq number check of post-handshake ClientHello msg
The check was wrongly removed by the commit
"ssl_tls12_server.c: Move ClientHello message_seq adjustment".

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-10 10:12:55 +01:00
Ronald Cron
7f40da187c ssl_tls12_server.c: Move back the digest update
Move back the digest update just after
the call to mbedtls_ssl_read_record().
It fits well here as we explain in the
comment associated to the call to
mbedtls_ssl_read_record() that we
update it manually.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-10 08:25:21 +01:00
Ronald Cron
65a038198e Improve comments
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 23:28:50 +01:00
Gilles Peskine
11d1f51631 Merge pull request #10464 from bensze01/abicheck-port
Move abi_check.py to the framework
2026-03-09 13:57:04 +00:00
Valerio Setti
109ce5e687 Merge pull request #10617 from ronald-cron-arm/tf-psa-crypto-reorg-prep
Prepare for TF-PSA-Crypto repository reorganization
2026-03-09 11:49:28 +00:00
Ronald Cron
bef136e607 Update framework pointer to the merge of PR 280
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 08:30:07 +01:00
Ronald Cron
269b390bb4 components-platform.sh: Fix path of compiler directory
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 08:28:51 +01:00
Ronald Cron
aa024253d6 tests: make: Fix spaces instead of tab
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 08:28:51 +01:00
Ronald Cron
32479c6a72 cmake: Introduce TF_PSA_CRYPTO_PRIVATE_INCLUDE_DIRS
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 08:28:51 +01:00
Ronald Cron
a400a3bb8a Adapt list_internal_identifiers.py for upcoming directory changes
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 08:28:51 +01:00
Ronald Cron
f3a20d25d6 Prepare libtestdriver1 build for upcoming directory changes
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 08:28:51 +01:00
Ronald Cron
325170b962 legacy.make: Add globs and paths for tags and cscope
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 08:28:51 +01:00
Ronald Cron
24bf98156a components*.sh: Handle current and upcoming object paths
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 08:28:51 +01:00
Ronald Cron
03ee085e10 Remove duplicated recursion tests
The recursion tests for the crypto code
are run in a TF-PSA-Crypto component.
No need to run them in an Mbed TLS
component as well.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 08:28:51 +01:00
Ronald Cron
ae82217476 programs: metatest: Add tf-psa-crypto/platform as include dir
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 08:28:51 +01:00
Ronald Cron
1ef64a73e4 programs: metatest: Remove include path duplication
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-03-09 08:28:51 +01:00
Gilles Peskine
65da2a38bf Merge pull request #10606 from gilles-peskine-arm/unix-detection-202601-4.0
Simplify platform requirements before 4.1
2026-03-06 18:06:08 +00:00
Gilles Peskine
b38e28dbf0 Make sure we declare TF-PSA-Crypto platform requirements before including system headers
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-04 11:54:35 +01:00
Gilles Peskine
037f3c62ff Tell MSVC to allow non-s functions where needed
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-04 11:32:18 +01:00
Gilles Peskine
37fd7d5210 Start from a clean baseline for C11 ext1 and POSIX features
Define `_POSIX_C_SOURCE` and `_XOPEN_SOURCE` in a single place that
applies everywhere, to make things simple.

This may break some platforms that require special handling for POSIX
functions and types. Subsequent commits will add platform-specific hacks
as needed.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-04 11:32:18 +01:00
Gilles Peskine
e8dec9c031 Unify the detection of Unix-like platforms
We were using slightly different guards to decide whether to include
`<unistd.h>` in different places. Unify those.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-04 11:32:18 +01:00
Gilles Peskine
5d479d8050 Update tf-psa-crypto with unified Unix detection
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-04 11:32:15 +01:00
Bence Szépkúti
1d088bb84e Merge pull request #10625 from gilles-peskine-arm/unix-detection-202601-mingw-prep
Simplify platform requirements before 4.1: MingW
2026-03-02 15:04:34 +00:00
Gilles Peskine
29192f0a00 Use the mbedtls_common.h in generated library .c files as well
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-02 12:25:03 +00:00
Gilles Peskine
436f1e30ad Include the config in mbedtls_commmon.h as promised
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-02 12:25:02 +00:00
Gilles Peskine
a3d55d9ec7 Document the purpose of mbedtls_common.h
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-02 12:25:01 +00:00
Gilles Peskine
eb1328285b Update framework with support for standard printf on MinGW
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-28 11:54:57 +00:00
Gilles Peskine
4ec9536339 Temporarily force standard *printf functions on MingW
On MingW, temporarily force the use of the standard versions of `snprintf()`
and `vsnprintf()` (since we set `__USE_MINGW_ANSI_STDIO` in
`mbedtls_platform_requirements.h`). Do not honor `platform.h` configuration,
because with the current TF-PSA-Crypto, `MBEDTLS_PLATFORM_VSNPRINTF_ALT and
`MBEDTLS_PLATFORM_SNPRINTF_ALT` are always enabled on MinGW, so what matters
is the setting of `__USE_MINGW_ANSI_STDIO` when `platform.c` is built, and
until https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/694, the legacy printf
functions are used there.

Revert this commit once the `tf-psa-crypto` module is updated with the merge
of https://github.com/Mbed-TLS/TF-PSA-Crypto/pull/694.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-26 21:34:32 +01:00
Gilles Peskine
64ff7fc1dc Stop using MBEDTLS_PRINTF_SIZET
Since Mbed TLS 3.6.0, all officially supported versions of Visual Studio
a printf function family that is sufficiently compliant to C99 for our
purposes, in particular supporting `%zu` for `size_t`. The only platform
without `%zu` that we semi-officially support is older versions of MinGW,
still used in our CI. MinGW provides either a Windows legacy printf or a
standards-compliant printf depending on the value of
`__USE_MINGW_ANSI_STDIO` when compiling each C file. Force the use of the
compliant version. Don't rely on `MBEDTLS_PRINTF_SIZET`, which is defined in
`<mbedtls/debug.h>` and no longer considers the Windows legacy version in
Mbed TLS >= 4.1.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-26 19:56:23 +00:00
Gilles Peskine
cdf3b0a535 MingW: insist on standard-compliant printf() and friends
Always activate `__USE_MINGW_ANSI_STDIO` unless overridden on the command
line. This is necessary with older versions of MingW and/or Windows,
where snprintf does not always zero-terminate the buffer, and does
not support formats such as `"%zu"` for size_t and `"%lld"` for long long.

Simplify debug.h accordingly. The macros `MBEDTLS_PRINTF_SIZET`,
`MBEDTLS_PRINTF_SIZET_HAX` and `MBEDTLS_PRINTF_LONGLONG` are no longer
needed, but they are still used in our code base and must stay in debug.h
for backward compatibility.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-26 20:56:03 +01:00
Gilles Peskine
3c67824964 test_suite_debug: test the printf used by debug.c
In `test_suite_debug`, test `mbedtls_debug_snprintf()`, which uses
`mbedtls_vsnprintf()` like `mbedtls_debug_print_msg()`. Do this instead of
testing `mbedtls_snprintf()`, which might be subtly different (older
Windows runtimes had slightly different behavior for vsnprintf() vs
snprintf(); TF-PSA-Crypto might pick up a different function if the
platform configuration is different in TF-PSA-Crypto and Mbed TLS).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-26 20:56:03 +01:00
Gilles Peskine
7af09b4f21 Add a few more test cases for printf formats
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-26 19:54:59 +00:00
Gilles Peskine
3a98885950 Create a header to declare platform requirements
On some platforms, the system headers expose different interfaces depending
on what macros are defined, for example to provide different standards
compliance level. Create a common place where we can declare such macros,
so that our code can behave in the same way when it's in different files.
Individual .c files can still override these requirements by defining
macros before including the common header, if it's really necessary.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-26 19:54:23 +00:00
Gilles Peskine
29d00fa861 Create a mbedtls_common.h for the project
We already have `x509_internal.h` which is common to all parts of the X.509
library, and `ssl_misc.h` which is common to all parts of the TLS library.
Also create `mbedtls_common.h` which is for the Mbed TLS project as a whole.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-26 19:54:15 +00:00
Bence Szépkúti
c2cb8565a5 Merge pull request #10607 from gilles-peskine-arm/timing-use-mstime
Simplify MBEDTLS_TIMING_C to use mbedtls_ms_time()
2026-02-26 14:38:50 +00:00
Ronald Cron
53dd7d0dce ssl_tls12_server.c: Update hs status after some validations of the ClientHello
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-24 15:28:12 +01:00
Janos Follath
9394d25048 Merge pull request #10584 from davidhorstmann-arm/add-link-to-crypto-security-md
Add link to TF-PSA-Crypto `SECURITY.md`
2026-02-24 08:36:39 +00:00
Ronald Cron
a5f45bb935 Add change log
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-23 12:12:36 +01:00
Ronald Cron
3771c17a0b Update mbedtls_ssl_handshake() documentation
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-23 12:12:36 +01:00
Ronald Cron
814f5da61a ssl-opt.sh: Use more diverse MTUs
Do not use only power of 2 MTUs.
Use diverse MTUs in DTLS reassembly/
fragmenting/proxy tests.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-23 12:12:36 +01:00