Commit graph

28218 commits

Author SHA1 Message Date
Dave Rodgman
3e5cc175e0 Reduce code size in mbedtls_cipher_validate_values
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-10-31 18:00:01 +00:00
Dave Rodgman
6d2c1b3748 Restructure mbedtls_cipher_validate_values
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-10-31 18:00:01 +00:00
Dave Rodgman
fb24a8425a Introduce MBEDTLS_ASSUME
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-10-31 17:59:56 +00:00
Tom Cosgrove
6dcb63bc6d Fix broken link to psa-driver-example-and-guide in psa-driver-wrappers-codegen-migration-guide.md
Fixes #8453

Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-10-31 15:39:25 +00:00
Valerio Setti
ac7a809ac3 all.sh: remove leftover loc_curve_list usage
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-10-31 12:23:44 +01:00
Pengyu Lv
2151ba55f6 test_suite_x509write: use plaintext key file
Some test cases are using encrypted key file, thus have
dependency on low-level block cipher modules (e.g. AES).
This commit adds unencrypted key file so that we could
get rid of those dependencies.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-10-31 18:12:04 +08:00
Yanray Wang
5779096753 Merge remote-tracking branch 'origin/development' into adjust_tfm_configs 2023-10-31 13:39:07 +08:00
Pengyu Lv
78657d0c1d Change base config to full minus SSL
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-10-31 10:29:41 +08:00
Pengyu Lv
f2814ff97b Move common config to common function
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-10-31 10:29:41 +08:00
Pengyu Lv
dbd1e0d986 tls13: add helpers to check if psk[_ephemeral] allowed by ticket
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-10-31 10:17:17 +08:00
Pengyu Lv
29daf4a36b tls13: server: fully check ticket_flags with available kex mode.
We need to fully check if the provided session ticket could be
used in the handshake, so that we wouldn't cause handshake
failure in some cases. Here we bring f8e50a9 back.

Example scenario:
A client proposes to a server, that supports only the psk_ephemeral
key exchange mode, two tickets, the first one is allowed only for
pure PSK key exchange mode and the second one is psk_ephemeral only.
We need to select the second tickets instead of the first one whose
ticket_flags forbid psk_ephemeral and thus cause a handshake
failure.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-10-31 09:34:14 +08:00
Paul Elliott
afc6a992c5
Merge pull request #8381 from gilles-peskine-arm/20231017-misc-cleanup
Cleanups in test code
2023-10-30 18:08:01 +00:00
Paul Elliott
835edd627d
Merge pull request #8404 from paul-elliott-arm/fix_coverity_issues
Fix two coverity issues
2023-10-30 18:00:14 +00:00
Dave Rodgman
b06d701f56
Merge pull request #8406 from beni-sandu/aesni
AES-NI: use target attributes for x86 32-bit intrinsics
2023-10-30 17:01:06 +00:00
Tom Cosgrove
3857bad9a2
Merge pull request #8427 from tom-cosgrove-arm/fix-linux-builds-in-conda-forge
Fix builds in conda-forge, which doesn't have CLOCK_BOOTTIME
2023-10-30 15:29:26 +00:00
Manuel Pégourié-Gonnard
1c6100240d
Merge pull request #8398 from mpg/analyze-outcome-ignore-re
In analyze_outcomes.py, add pattern-ignore
2023-10-30 12:46:35 +00:00
Valerio Setti
3d59ebef2c ssl_helpers: remove CIPHER_C guards in mbedtls_test_ssl_build_transforms()
Use !USE_PSA_CRYPTO instead.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-10-30 11:59:37 +01:00
Valerio Setti
467271dede ssl_misc: ignore ALG_CBC_PKCS7 for MBEDTLS_SSL_HAVE_xxx_CBC
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-10-30 11:40:32 +01:00
Valerio Setti
847213120c test_suite_psa_crypto_metadata: remove unnecessary CIPHER_C dependencies
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-10-30 11:37:09 +01:00
Valerio Setti
74d5f23c3f test_suite_ssl: use new internal symbols in tests using CBC
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-10-30 11:36:32 +01:00
Valerio Setti
1ebb6cd68d ssl_misc: add internal MBEDTLS_SSL_HAVE_[AES/ARIA/CAMELLIA]_CBC symbols
These are used in tests to determine whether there is support for
one of those keys for CBC mode.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-10-30 11:36:32 +01:00
Valerio Setti
dc55470341 ssl_context_info: add guards for CIPHER_C
mbedtls_cipher_info_from_type() is only available when CIPHER_C is
defined. So when it is not we just print the cipher type decimal
value on the output instead of the cipher's name.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-10-30 11:36:32 +01:00
Valerio Setti
bdf04e840a ssl_server2: support ticket_aead only when CIPHER_C is defined
Cipher parsing requires mbedtls_cipher_info_from_string() which
depends on CIPHER_C.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-10-30 11:36:32 +01:00
Valerio Setti
31ad3a14cc ssl_helpers: allow mbedtls_test_ssl_build_transforms to work without CIPHER_C
A new internal function is added to get cipher's info (mode, key bits and
iv len) without relying on CIPHER_C. This function is basically a lookup
table used only for test purposes.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-10-30 11:36:32 +01:00
Valerio Setti
d531dab4f6 check_config: let SSL_TLS depend on either CIPHER_C or USE_PSA_CRYPTO
TLS code already implements proper dispatching to either
builtin or PSA implementations based on USE_PSA guards, so we can
improve the check_config guards to reflect this.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-10-30 11:36:32 +01:00
Valerio Setti
852d26c70d all.sh: enable SSL_TLS and SSL_TICKET in full_no_cipher with PSA_CRYPTO
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-10-30 11:36:32 +01:00
Valerio Setti
3fe105b042 all.sh: fix test components using accelerated curves
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-10-30 11:08:12 +01:00
Valerio Setti
05c25cbaf9 test_driver_extension: manage curves' acceleration the same as other PSA_WANT symbols
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-10-30 11:07:18 +01:00
Manuel Pégourié-Gonnard
c51c411cc1 analyze_outcome: only warn on ignored tests that pass
The previous check also warned when on tests that were already skipped
in the reference config, which are not really a problem. The purpose of
this "uselessly ignored" check is to make sure that the ignore list
(together with the config common to driver and reference in all.sh)
always correct reflects what works or doesn't in driver-only builds. For
this it's enough to warn when a test is ignored but passing.

The previous, stricter check, was causing issues like:

Error: uselessly ignored: test_suite_pkcs12;PBE Encrypt, pad = 8 (PKCS7 padding disabled)
Error: uselessly ignored: test_suite_pkcs12;PBE Decrypt, (Invalid padding & PKCS7 padding disabled)
Error: uselessly ignored: test_suite_pkcs5;PBES2 Decrypt (Invalid padding & PKCS7 padding disabled)

These are skipped in the reference config because is has PKCS7 padding
enabled, and that's OK.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-10-30 10:21:22 +01:00
Manuel Pégourié-Gonnard
cd84a290a9 analyze_outcomes: use regexes for cipher/aead
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-10-30 10:21:15 +01:00
Jerry Yu
9dd0cc06e5 disable stdout in require_*_configs_* functions
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-10-30 17:05:42 +08:00
Manuel Pégourié-Gonnard
f1c09a389e
Merge pull request #8119 from valeriosetti/issue8048
PSA crypto should not depend on the cipher module
2023-10-30 08:10:06 +00:00
Pengyu Lv
cfb23b8090 tls13: server: parse pre_shared_key only when some psk is selectable
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-10-30 15:26:26 +08:00
Beniamin Sandu
3bca7817e5 tests/scripts/all.sh: add test for 32-bit AES-NI intrinsics with clang
Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
2023-10-27 17:02:22 +01:00
Beniamin Sandu
800f2b7c02 AES-NI: use target attributes for x86 32-bit intrinsics
This way we build with 32-bit gcc/clang out of the box.
We also fallback to assembly for 64-bit clang-cl if needed cpu
flags are not provided, instead of throwing an error.

Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
2023-10-27 17:02:22 +01:00
Tomás González
7f2cddb1ae check_test_cases: Minor documentation change
* Make an iteration comment generic to every file it may affect
   instead of making it specific a particular file.

Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-10-27 11:46:23 +01:00
Tomás González
4fc582461b compat.sh: Rename list_test_case to list_test_cases
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-10-27 11:43:15 +01:00
Tomás González
cfe68a0cb6 ssl-opt.sh: Make record_outcome record the ssl-opt.sh file only
Ignore the test suite name as file from opt-testcases cannot
actually be called separately.

Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-10-27 11:43:15 +01:00
Tomás González
51cb704342 Avoid using print_name when --list-test-cases is used
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-10-27 11:43:15 +01:00
Tomás González
378e364c3c ssl-opt.sh: Correct print format for test cases' names
Avoid printing an extra space when using the --list-test-cases
option.

Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-10-27 11:43:15 +01:00
Tomás González
12787c9ba5 Remove invalid -l option from test scripts
The -l option mentioned in previous commits for both ssl-opt.sh and
compat.sh scripts should only be a --list-test-cases option.

Remove -l option from the help list.

Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-10-27 11:43:15 +01:00
Tomás González
38ecf9fa1e check_test_cases: Avoid removing duplicated test cases
One of the jobs of check_test_cases is to check for duplicate test
descriptions and to have them ordered:

 * Stop using a set to collect the different test cases from the
   test scripts.

Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-10-27 11:43:15 +01:00
Tomás González
4a86da2460 check_test_cases: Unify walk_compat_sh and walk_opt_sh into one
walk_compat_sh and walk_opt_sh are basically the same now, so:

 * Merge them into one function.
 * Use the --list-test-cases option for both of them.
 * Rename this merged function as collect_from_script which seems
   more appropriate as since it isn't iterating the script but
   calling it.

Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-10-27 11:43:15 +01:00
Tomás González
37a8739e4d ssl-opt.sh: Don't affect the order at which functions are printed
When adding the LIST_TESTS option, print_name can be called
before checking if the test case should be excluded or not.
Change this back to its previous state while still taking into
account the LIST_TESTS option.

Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-10-27 11:43:15 +01:00
Tomás González
be2c66e548 ssl-opt.sh: Simplify the implementation of the -l option
Instead of verifying if the LIST_TESTS variable has been set in
every function to avoid using the P_QUERY variable and avoid
calling a program that has not necessarily been compiled yet:

 * Define P_QUERY=":" when LIST_TESTS has been set.

Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-10-27 11:43:15 +01:00
Tomás González
06956a12aa Skip unnecessary logic when -l option is used
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-10-27 11:43:14 +01:00
Tomás González
f162b4f497 Only use CONFIGS_ENABLED when not listing tests
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-10-27 11:29:28 +01:00
Tomás González
0e8a08a1f7 Get options at beginning of program
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-10-27 11:29:28 +01:00
Tomás González
787428a08c Avoid skipping test when printing
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-10-27 11:29:28 +01:00
Tomás González
3a65d6368a Remove formatted string to make pylint happy
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-10-27 11:29:28 +01:00