Commit Graph

32475 Commits

Author SHA1 Message Date
Gilles Peskine
bfaa6a5c81 Allow dependencies on platform features in PSA tests
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-04 17:54:56 +01:00
Gilles Peskine
2a92659034 Define derived config macros for entropy sources
Define `MBEDTLS_ENTROPY_TRUE_SOURCES` and `MBEDTLS_ENTROPY_HAVE_SOURCES`
similarly to TF-PSA-Crypto 1.0. Also define
`MBEDTLS_ENTROPY_HAVE_TRUE_SOURCES` for test function dependencies.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-04 17:54:56 +01:00
Gilles Peskine
178cda8cc6 Move entropy-related tests to test_suite_psa_crypto_entropy
They were in test_suite_psa_crypto_init, but their only connection to init
is that RNG setup is part of init. When testing how the RNG is set up, the
fact that it happens during init is incidental, what matters is the
difficulties around collecting entropy.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-04 17:54:56 +01:00
Gilles Peskine
a1d7a81d39 Merge pull request #1496 from gilles-peskine-arm/merge-3.6-restricted-20260304
Merge public 3.6 into restricted
2026-03-04 16:00:20 +01:00
Gilles Peskine
685a1ce6f4 Merge remote-tracking branch 'mbedtls-3.6' into merge-3.6-restricted-20260304 2026-03-04 14:39:06 +01:00
Gilles Peskine
95be019fb2 Merge pull request #10599 from valeriosetti/backport-fix-ans1write
[backport] include: fix guard in asn1write.h
2026-03-03 09:59:24 +00:00
Bence Szépkúti
1937efdd94 Merge pull request #10615 from gilles-peskine-arm/generate-psa_test_wrappers-3.6
Backport 3.6: generate psa test wrappers
2026-02-26 13:44:15 +00:00
Bence Szépkúti
34fcd9ae4f Merge pull request #10603 from ronald-cron-arm/dtls-client-hello-defragmentation-prep-3.6
Backport 3.6: Some preparatory work for DTLS client hello defragmentation
2026-02-22 23:30:44 +00:00
Gilles Peskine
d841a6a782 Generate psa_test_wrappers.{h,c} automatically
This is not only convenient, but now necessary, because if the content of
the generated files changes due to changes in Python files in the framework,
`all.sh check_generated_files` will fail in the framework CI.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-22 20:33:27 +01:00
Ronald Cron
d8b97c6a28 ssl-opt.sh: Revert leftover debug level increase
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:41:57 +01:00
Ronald Cron
3b6bd65334 ssl_msg.c: Improve handshake message fragmenting message
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:41:57 +01:00
Ronald Cron
8e68a06bdf ssl-opt.sh: Improve DTLS proxy 3d tests
Improve DTLS proxy 3d tests with OpenSSL and
GnuTLS servers. Have a better control of which
message is fragmented and verify it is the
case.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:41:57 +01:00
Ronald Cron
98b3ef2e43 ssl-opt.sh: Improve DTLS reassembly tests
Improve DTLS reassembly tests with OpenSSL
and GnuTLS server. Check that some messages
have been reassembled.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:41:56 +01:00
Ronald Cron
87871ddf30 ssl-opt.sh: Remove DTLS reassembly redundant test
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:41:56 +01:00
Ronald Cron
0b4cb31fb6 ssl-opt.sh: Remove CH reassembly unsupported test
We are about to have full support for TLS 1.2
CH reassembly on server side. The equivalent
positive test would be a duplicate of one of
the tests generated by generate_tls_handshake_tests.py.
Thus just removing the negative test.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:41:56 +01:00
Ronald Cron
a02505a7be ssl_msg.c: Improve HS message reassembly completed message
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:41:56 +01:00
Ronald Cron
c065fdd4d4 ssl_tls.c: Rename and expand ssl_tls13_get_hs_msg_name
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-18 14:41:56 +01:00
Manuel Pégourié-Gonnard
fbfd13e22b Merge pull request #10597 from valeriosetti/fix-tls12-sha-guards-backport
[backport] library: check_config: fix required hash algorithms for TLS 1.2
2026-02-18 08:23:38 +00:00
David Horstmann
94594b96bd Merge pull request #10602 from davidhorstmann-arm/fix-missing-type-conversion-tls-exporter-3.6
[Backport 3.6] Fix missing type conversion in the TLS-Exporter
2026-02-17 18:31:05 +00:00
Ronald Cron
9d96a23fa2 ssl_server2.c: Flush stdout to improve logs timeliness
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-17 10:10:34 +01:00
Ronald Cron
373e08939f Add branch specific generate_tls_handshake_tests.py file
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-17 10:10:34 +01:00
Ronald Cron
381b296956 Update framework pointer
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2026-02-17 10:07:42 +01:00
David Horstmann
85426311e3 Fix missing type conversion in the TLS-Exporter
In the TLS-Exporter for TLS 1.3 we mistakenly call PSA_HASH_LENGTH() on
an mbedtls_md_type_t when it should be called on a psa_algorithm_t.

Fortunately, these two types have almost the same values, since we have
previously aligned them to make conversion more efficient. As a result,
PSA_HASH_LENGTH() produces exactly the same value when called on an
mbedtls_md_type_t as with the equivalent psa_algorithm_t.

Thanks to this happy coincidence, fix a largely cosmetic issue (rather
than a major functional bug).

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2026-02-16 17:07:30 +00:00
David Horstmann
b847040a1a Merge pull request #10594 from gilles-peskine-arm/bump-version-202602-3.6
Backport 3.6: Minor improvements to bump_version.sh
2026-02-16 16:50:12 +00:00
Valerio Setti
32649e1e33 include: fix guard in asn1write.h
Fix the location of the ending braket of "extern C" block in order to
have it balanced between C guards.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-02-16 14:03:48 +01:00
David Horstmann
7c2f728178 Merge pull request #1429 from yanesca/1427_buffer_underflow-backport-3.6
Fix buffer underflow in `x509_inet_pton_ipv6()` [3.6 backport]
2026-02-16 11:58:38 +00:00
Valerio Setti
a372f1a5cb library: check_crypto_config: remove redundant check on hash algorithms for TLS 1.2
TLS-PRF uses either SHA-256 and SHA-384, so the removed paragraph was not
correct. The correct version is already available in "check_config.h".

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-02-12 22:09:06 +01:00
David Horstmann
48c3b179c5 Merge pull request #10589 from daverodgman/backport_gcc_bswap
[Backport 3.6] fix error in GCC bswap
2026-02-11 14:04:47 +00:00
David Horstmann
610f4997c2 Merge pull request #10565 from minosgalanakis/bugfix/fix-intrisic-aesce-clang-36
[3.6 Backport] Fixed clang arm intrinsics for older compiler versions
2026-02-11 11:58:55 +00:00
Valerio Setti
5334c1dd14 Merge pull request #10592 from mpg/pkwrite-large-stack-buffer
[3.6] PK write: avoid large stack buffer
2026-02-11 05:02:04 +00:00
Gilles Peskine
f41929496e Don't treat --help as an error
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-10 14:52:50 +01:00
Gilles Peskine
b47774c9a9 Remove unused variable
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-02-10 14:52:46 +01:00
Manuel Pégourié-Gonnard
6617ab467f pkwrite: tests: make helper more robust
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-02-10 11:34:00 +01:00
Manuel Pégourié-Gonnard
20118b65bd pkwrite: RSA: avoid large stack buffer
In the default build, it was 2363 bytes which is a lot to put on the
stack for constrained devices. Fortunately we already have a large
enough buffer at hand: the user-provided output buffer. Use it.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-02-10 11:34:00 +01:00
Manuel Pégourié-Gonnard
56503ba340 pkwrite: tests: test that DER writes at the end
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-02-10 11:24:05 +01:00
Manuel Pégourié-Gonnard
533a806405 pkwrite: test: factor common part into helper func
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-02-10 11:18:24 +01:00
Dave Rodgman
4f6c8ef2ac fix error in GCC bswap
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2026-02-06 10:10:42 +00:00
Valerio Setti
25b5fcdcd3 Merge pull request #10581 from valeriosetti/issue665-backport
[backport] Software GCM table calculation buggy with gcc -O3
2026-01-29 15:17:00 +00:00
David Horstmann
337218d667 Merge pull request #10165 from davidhorstmann-arm/fix-mingw-ansi-stdio-3.6
[3.6] Fix format specifiers for MinGW ANSI stdio
2026-01-28 16:42:07 +00:00
Valerio Setti
2b2f430fcd tests: scripts: adapt test_tf_psa_crypto_optimized_alignment to 3.6
Move from CMake to Make

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-01-28 00:18:09 +01:00
Valerio Setti
f79c548ad0 changelog: add changelog about fixing issue #665 in tf-psa-crypto
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-01-28 00:07:44 +01:00
Valerio Setti
32ef705024 library: alignment: add "may_alias" attribute to mbedtls_uintXX_unaligned_t structs
Tell the GCC compiler that pointers to types "mbedtls_uintXX_unaligned_t"
(where XX is 16, 32 or 64) might alias with other types. This helps at
high optimizations level (i.e. "-O3") so that the compiler does not mess
up with instruction reordering and memory accesses.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-01-28 00:07:44 +01:00
Valerio Setti
be0c788105 library: alignment.h: add internal symbol to disable optimizations on x86
MBEDTLS_ALIGNMENT_DISABLE_EFFICENT_UNALIGNED_ACCESS is used to forcedly
prevent MBEDTLS_EFFICIENT_UNALIGNED_ACCESS from being set. This prevents
optimizations from being used on x86 which is useful for testing
purposes.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-01-28 00:07:44 +01:00
Valerio Setti
10193b37e3 tests: scripts: add new component to test alignment with GCC O3 optizations
This is meant to test a bug found on:
- Little endian platforms other than x86 or ARM (these have specific
  optimizations available);
- GCC versions from 10 to 14.2 (below and above are fine);
- Optimization level "-O3" (lower levels are fine).

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2026-01-28 00:07:44 +01:00
Gilles Peskine
ccf280d158 Add a few more test cases for printf formats
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-01-26 17:49:05 +01:00
Minos Galanakis
2f384c82a5 built-in drivers(aesce): Fixed clang arm intrinsics for verions < 7
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-01-26 11:06:58 +00:00
Gilles Peskine
0bc29f6441 Merge pull request #10542 from minosgalanakis/bugfix/fix-intrisic-header-armf-3.6
[Backport 3.6] Bugfix/fix intrisic header armf 3.6
2026-01-22 14:51:13 +00:00
Janos Follath
72e18e0032 inet_pton: simplify IPv4 walkback loop
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-01-21 17:29:07 +00:00
Minos Galanakis
a35f5326f5 drivers sha256|512: Adjusted tf_psa_crypto_common.h inclusion
This patch adjusts the include order so that some ACLE
intrinsics macros are configured before
the inclusion of `neon.h`. This fixes issues with older
clang compilers but has no effect in modern versions.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2026-01-21 14:16:18 +00:00
Janos Follath
51fc6428eb Add ChangeLog entry
Signed-off-by: Janos Follath <janos.follath@arm.com>
2026-01-21 10:43:41 +00:00