31730 Commits

Author SHA1 Message Date
Bence Szépkúti
1e62c95148 Disable fatal assertions in Windows printf tests
The Windows CRT treats any invalid format specifiers passed to the CRT
as fatal assertion failures. Disable thie behaviour temporarily while
testing if the format specifiers we use are supported.

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2025-03-07 17:45:27 +01:00
Bence Szépkúti
9cde9d4b2c Add testcase for MBEDTLS_PRINTF_MS_TIME
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2025-03-07 17:45:26 +01:00
Bence Szépkúti
85d92ec1ce Test handling of format macros defined in debug.h
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2025-03-07 17:45:26 +01:00
Bence Szépkúti
d5102c9d7c Run test_suite_debug without MBEDTLS_SSL_TLS_C
Move the suite's global dependency on MBEDTLS_SSL_TLS_C to the
individual test cases.

Add an preprocesor guard around string_debug to prevent warning about unused
functions.

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2025-03-07 17:45:26 +01:00
Manuel Pégourié-Gonnard
1d25c71ab6
Merge pull request #9562 from valeriosetti/md-psa-dispatch-3.6
Backport 3.6: md: allow dispatch to PSA whenever CRYPTO_CLIENT is enabled
2025-03-04 08:34:11 +00:00
Valerio Setti
bc55af83d3 framework: update reference
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-28 12:18:03 +01:00
Valerio Setti
cc1b26bd9a changelog: add note for MD changes
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-21 15:01:04 +01:00
Valerio Setti
79a98bd7b6 crypto_extra: improve description of psa_can_do_hash()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-21 15:01:04 +01:00
Valerio Setti
05b3835bd6 psa: move definition of psa_can_do_hash() to crypto_extra.h
This allows any implementer of the PSA client interface to easily
include this header and therefore function's prototype.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-21 15:01:04 +01:00
Valerio Setti
1a2d07d83a docs: update md-cipher-dispatch
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-21 14:15:36 +01:00
Valerio Setti
460d2ee363 adjust_legacy_crypto: improve enablement of MBEDTLS_MD_xxx_VIA_PSA
The previous change that replaced CRYPTO_C with CRYPTO_CLIENT
caused an increase of the mbedtls_md struct in scenarios where
the hash related PSA_WANTs were enabled, but not accelerated.
This caused an ABI-API break which is not allowed for an LTS
branch.
Since the main goal here is to allow PSA dispatch in a "pure
crypto client" scenario, we partially revert the previous change
to config_adjust_legacy_crypto.h and add an extra condition
for "CRYPTO_CLIENT && !CRYPTO_C".

This commit also reverts changes done in analyze_outcomes.py
because they are no more necessary.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-21 13:13:24 +01:00
Valerio Setti
c516307ad9 md: allow dispatch to PSA whenever CRYPTO_CLIENT is enabled
Instead of allowing PSA dispatching only when CRYPTO_C is set and
some MBEDTLS_PSA_ACCEL_ALG_xxx is set, we enable dispatching
when CRYPTO_CLIENT and PSA_WANT_ALG_xxx are set. This makes
the feature more useful in cases where the PSA support is
provided externally, like for example TF-M in Zephyr.

This commit also add proper guards for tests trying to use MD+PSA
dispatch.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-21 13:13:24 +01:00
Valerio Setti
2c1de04e9d adjust_legacy_crypto: move auto-enabling of CRYPTO_CLIENT when CRYPTO_C
Move the auto-enabling of CRYPTO_CLIENT when CRYPTO_C at the
beginning of the file so that all that becomes later is aware
of this.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-21 13:13:24 +01:00
Ronald Cron
1ba478d9cf
Merge pull request #9988 from Harry-Ramsey/move-program-files-to-mbedtls-framework-3-6
[Backport 3.6] Move program files to mbedtls framework
2025-02-21 07:13:01 +00:00
Harry Ramsey
1da22a8946 Update framework pointer
Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2025-02-20 14:51:26 +00:00
Harry Ramsey
4c1383a9f1 Update documentation regarding metatest
This commit updates the paths in the documentation for metatest.c as it
has been moved to MbedTLS Framework.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2025-02-20 14:51:26 +00:00
Harry Ramsey
65e9bef19f Update documentation regarding test_zeroize
This commit updates the paths in documentation for test_zeroize since it
has been moved to MbedTLS Framework.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2025-02-20 14:51:26 +00:00
Harry Ramsey
4e1a12e13a Update path to demo_common.sh
This commit updates the path to demo_common.sh as it has been moved into
MbedTLS Framework.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2025-02-20 14:51:26 +00:00
Harry Ramsey
d621d344c3 Update path for moved test_zeroize.gdb script
This commit updates the path for the moved test_zeroize.gdb script which
has been moved to MbedTLS-Framework.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2025-02-20 14:51:26 +00:00
Harry Ramsey
03f49578d2 Update paths for moved programs in generate_visualc_files.pl
This commit updates the paths for moved programs in
generate_visualc_files.pl.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2025-02-20 14:51:26 +00:00
Harry Ramsey
151e0892a1 Update paths for moved dlopen_demo.sh
This commit updates the paths for dlopen_demo.sh in
components-build-system.sh as the file has been moved to the framework.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2025-02-20 14:51:26 +00:00
Harry Ramsey
061e0f5466 Update paths for moved program files in CMakeLists
This commit fixes the paths of program files which were moved to the
MbedTLS Framework.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2025-02-20 14:51:26 +00:00
Harry Ramsey
dab817a4c6 Update include paths in C files
Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2025-02-20 14:51:26 +00:00
Harry Ramsey
a67f1338b6 Update paths for moved program files in makefiles
This commit updates the file paths necessary for dlopen_demo.sh,
metatest.c query_compile_time_config.c, query_config.h,
query_included_headers.c and zeroize.c.

This commit also adds a CFLAG to find header files now contained in the
framework.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2025-02-20 14:51:18 +00:00
Janos Follath
6eb335dfda
Merge pull request #9919 from davidhorstmann-arm/clarify-x509-security-md-3.6
[Backport 3.6] Add X.509 formatting validation to SECURITY.md
2025-02-20 14:41:42 +00:00
Harry Ramsey
d358d6e6cd Add MBEDTLS_FRAMEWORK_DIR variable to CMake
This commit adds a MBEDTLS_FRAMEWORK_DIR variable to CMake to create an
absolute path.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2025-02-17 17:23:52 +00:00
Harry Ramsey
0c6eb5d6e9 Move programs out of Mbed TLS
This commit moves demo_common.sh, dlopen_demo.sh, metatest.c
query_compile_time_config.c, query_config.h, query_included_headers.c,
zeroize.c and test_zeroize.gdb from MbedTLS into the MbedTLS framework.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2025-02-17 11:43:55 +00:00
Ronald Cron
c811fb79ad
Merge pull request #9941 from valeriosetti/issue94-3.6
[Backport 3.6] Move test_psa_*.py scripts to the framework
2025-02-05 13:55:44 +00:00
Valerio Setti
411f7dc167 framework: update reference
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-05 12:09:13 +01:00
Valerio Setti
aa7bd59dbe components-compliance.sh: update references to test_psa_compliance.py
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-05 12:07:25 +01:00
Valerio Setti
d673acf89e components-configuration.sh: update references to test_psa_constant_names.py
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-05 12:07:25 +01:00
Valerio Setti
7297e8d440 Move files out of Mbed TLS
The following files are moved to the framework repo (deleted here):

tests/scripts/test_psa_compliance.py
tests/scripts/test_psa_constant_names.py

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-05 12:07:25 +01:00
Ronald Cron
204588678e
Merge pull request #9937 from valeriosetti/issue9688-backport
[Backport 3.6] Migrate DHE test cases to ECDHE
2025-01-29 09:59:11 +00:00
Valerio Setti
1a0ee063e2 test_suite_ssl: update description for conf_curve and conf_gruop tests
These tests are about EC curves/groups, not DH ones, so the description
should be updated accordingly.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-01-28 11:42:15 +01:00
Valerio Setti
e94ab3cbdf test_suite_ssl: add ECDHE-RSA case for handshake_fragmentation()
This is the backport of commit b8ef2a4455 from the "development" branch
which adapts handshake_fragmentation() to use ECDHE-RSA instead of
DHE-RSA. However, since DHE-RSA is not removed in the mbedtls-3.6 branch,
here tests are added instead of replaced.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-01-28 11:42:14 +01:00
Valerio Setti
4f2a74d275 test_suite_ssl: add new ECDHE-RSA tests
PR #9916 adapt some DHE-RSA tests to use ECDHE-RSA instead. However,
since DHE-RSA is not deprecated in mbedtls-3.6 branch, this commit adds
these new tests alongside DHE-RSA ones intead of replacing them in order
to increase test coverage.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-01-27 17:40:15 +01:00
Manuel Pégourié-Gonnard
b6fff90ed1
Merge pull request #9907 from mpg/conf-curves-3.6
[3.6 backport]: mbedtls_conf_curves()
2025-01-27 08:21:30 +00:00
Janos Follath
79d5ea234c
Merge pull request #9495 from minosgalanakis/doc/add_mbedtls_ecp_check_privkey_comment_bp36
[Backport 3.6] Refactored a minor check in ecp check privkey
2025-01-24 09:44:39 +00:00
minosgalanakis
484776547c Update tf-psa-crypto/drivers/builtin/src/ecp.c
Co-authored-by: Gilles Peskine <gilles.peskine@arm.com>
Signed-off-by: minosgalanakis <30719586+minosgalanakis@users.noreply.github.com>
2025-01-23 15:31:35 +00:00
David Horstmann
910273c563 Fix missing-word typo
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2025-01-23 10:28:42 +00:00
David Horstmann
fe2d3e0129 Add paragraph on undefined behaviour
Add a note that we do aim to protect against undefined behaviour and
undefined behaviour in certificate parsing is in scope.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2025-01-22 14:50:20 +00:00
David Horstmann
8bf5dc683c Add X.509 formatting validation to SECURITY.md
Clarify that strict formatting of X.509 certificates is not checked by
Mbed TLS and that it therefore should not be used to construct a CA.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2025-01-22 14:30:27 +00:00
Manuel Pégourié-Gonnard
ea18c7e1e5 Fix incorrect test function
We should not manually set the TLS version, the tests are supposed to
pass in 1.3-only builds as well. Instead do the normal thing of setting
defaults. This doesn't interfere with the rest of the testing, so I'm
not sure why we were not doing it.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-01-22 10:31:43 +01:00
Manuel Pégourié-Gonnard
632667e394 Remove useless dependency from test function
This dependency was never right in the first place.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2025-01-22 10:31:19 +01:00
Gilles Peskine
18e4b3f08b
Merge pull request #9857 from gilles-peskine-arm/psa-storage-test-cases-never-supported-negative-3.6
Backport 3.6: Switch generate_psa_test.py to automatic dependencies for negative test cases
2025-01-20 18:44:52 +00:00
Gilles Peskine
a6c1f56a36 Add ignore list entries for ECDH/FFDH algorithm without key type
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-01-20 15:55:56 +01:00
Gilles Peskine
a2a0c394dd Remove test coverage exceptions that are no longer needed
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-01-20 15:55:56 +01:00
Gilles Peskine
8e07e27d9b Update framework
Catch up with https://github.com/Mbed-TLS/mbedtls-framework/pull/104 =
"Switch generate_psa_test.py to automatic dependencies for negative test cases"

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-01-20 15:55:54 +01:00
Ronald Cron
c1b1aa3148
Merge pull request #9903 from Harry-Ramsey/independent-check-files-3.6
[Backport 3.6] Independent check files
2025-01-15 16:43:34 +00:00
Harry Ramsey
61a1281503 Update framework pointer
This commit updates the framework pointer to include updated
check_files.py.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2025-01-15 14:23:12 +00:00