Commit Graph

32483 Commits

Author SHA1 Message Date
Manuel Pégourié-Gonnard
5cce3c8a75 Add comment in raw key agreement test function
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-03-05 12:56:35 +01:00
Manuel Pégourié-Gonnard
7a4e2c67b4 FFDH: reorder checks to satisfy picky test
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-03-05 12:56:22 +01:00
Manuel Pégourié-Gonnard
fb70b7f849 FFDH: test with key derivation and bad peer key
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-03-05 12:53:19 +01:00
Manuel Pégourié-Gonnard
118dc8c347 DH: clean up test function key_agreement_setup()
See the comment that was there. I chose not to split the test function
in two, but just have two arguments for each expected status.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-03-05 12:53:03 +01:00
Manuel Pégourié-Gonnard
10c5db67be FFDH: clean up size check
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-03-05 12:52:19 +01:00
Manuel Pégourié-Gonnard
470ee785ca FFDH: rm useless variable
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-03-05 12:51:47 +01:00
Manuel Pégourié-Gonnard
7d9f1b55fc FFDH: validate peer's key as per RFC 7919
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-03-05 12:44:20 +01:00
Manuel Pégourié-Gonnard
7644b0d9e5 FFDH: Add tests for invalid peer key
Failing right now, will fix the library in the next commit.

For 8192-bit, we don't have any positive test, because we have a stupid
line length limitation [1] and we can't fit both our key, the peer's
key, and the output. But for negative tests we don't need the output and
the rest fits, so let's have those.

[1] https://github.com/Mbed-TLS/mbedtls/issues/1866

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-03-05 12:32:18 +01:00
Manuel Pégourié-Gonnard
0c5accb716 DH: Update title in test data
The function is testing both psa_raw_key_agreement() and
psa_key_agreement().

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-03-05 12:32:06 +01:00
Manuel Pégourié-Gonnard
0b91bdea2e DH: update name of test function
Aligning on the name in development, which is also acceptable for 3.6,
and should reduce conflicts when backporting.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-03-05 12:31:09 +01:00
Manuel Pégourié-Gonnard
51bae4b813 DH: add expected_status to key_agreement test func
Also, while at it, add a test for input buffer too small. This had been
added previously in development but not backported.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2026-03-05 12:16:04 +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