11325 Commits

Author SHA1 Message Date
Paul Elliott
9bfe69a815
Merge pull request #9274 from eleuzi01/backport-9250
[Backport 3.6] Fix compiler warnings in test_suite_pk.function
2024-06-24 10:40:49 +00:00
Gilles Peskine
112673f106 Add some missing handling for generated test_suite_config.*.data
Fixes the files not being generated in the build tree.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-21 00:01:20 +02:00
Gilles Peskine
d496caad6d Anchor relative paths
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-21 00:01:20 +02:00
Gilles Peskine
331d7d053d Driver vs referenee: ignore relevant configuration differences
The driver-vs-reference checks compare test results in different
configurations. Ignore the test results that report differences in
configurations that were the point of the comparison. Do compare other
configuration reports: this will let us know if the configurations diverge
in an unexpected way.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-21 00:01:20 +02:00
Gilles Peskine
06fb1803be Generate config test cases for single options
Generate option-on and option-off cases for test_suite_config, for all
boolean options (MBEDTLS_xxx and PSA_WANT_xxx, collected from the mbedtls
and PSA config files).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-21 00:01:20 +02:00
Gilles Peskine
1c52e57621 New test suite to report configuration options
Add a test suite intended to report configuration options in the outcome
file: we're only interested in SKIP vs PASS.

Add a few test cases for some interesting combinations of options. The
selection here is just for illustration purposes, more will be added later.

A subsequent commit will automatically generate test cases for single options.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-21 00:01:20 +02:00
Gilles Peskine
26d279e35f Clean up generated files enumeration
Avoid having to list multiple generation scripts on the same line.

No intended semantic change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-21 00:01:20 +02:00
Ronald Cron
7b66beb666 test_when_no_ciphersuites_have_mac: Fix logs
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-06-19 10:34:21 +02:00
Ronald Cron
2463ec8d70 tests: src: Fix PSA test wrappers for PAKE
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-06-19 10:34:21 +02:00
Ronald Cron
da22402d5f all.sh: Fix clean-up of Makefiles generated by CMake
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-06-18 09:12:11 +02:00
Elena Uziunaite
3b7cde48be Code style fix
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-06-17 15:56:01 +01:00
Elena Uziunaite
4c882db6fc Fix compiler warnings in test_suite_pk.function
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-06-17 15:55:51 +01:00
Gilles Peskine
dcc99bf81b
Merge pull request #9203 from gilles-peskine-arm/ssl-test-no-skip-all-3.6
Backport 3.6: ssl-opt.sh, compat.sh: Error out if not executing any tests
2024-06-11 13:59:13 +00:00
David Horstmann
dfba499c16 Extend python checks to framework scripts
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-06-07 11:10:43 +01:00
Bence Szépkúti
2cfa6c9b45
Merge pull request #9208 from davidhorstmann-arm/move-test-generation-files-3.6
[Backport 3.6] Move test generation files to framework
2024-06-04 09:23:23 +00:00
David Horstmann
ea09152be9 Update file paths for moved files
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-05-31 15:51:41 +01:00
David Horstmann
a5eadf45ab Move some test generation files to framework
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-05-31 15:51:41 +01:00
Gilles Peskine
cddcd7ac0b
Merge pull request #9177 from ttytm/fix-typo-bp-3.6
Backport 3.6: fix typo
2024-05-30 17:24:57 +00:00
Gilles Peskine
c75048c162 ssl-opt.sh, compat.sh: Error out if not executing any tests
Alert if all tests are filtered out or skipped: that probably indicates a
test script that set up an unintended configuration or an overly strict
filter. You can pass `--min 0` to bypass this check. You can pass `--min`
with a larger value to require that many test cases to run.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-29 20:01:51 +02:00
Ronald Cron
22a092be63 Do not use --recurse-submodules
On the CI, the git version when running on
Ubuntu 16.04 is 2.7 and it does not support
the "--recurse-submodules" option of
"git ls-files" thus do not use it.

Another argument to not use it is that
when TF-PSA-Crypto will be a submodule of
mbedtls we will not want check_files.py to
check the TF-PSA-Crypto files as well.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-05-29 09:51:26 +02:00
Ronald Cron
c521badcea Extend basic checks of files to framework files
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-05-29 09:51:26 +02:00
Bence Szépkúti
29c4017007
Merge pull request #9131 from davidhorstmann-arm/move-mbedtls-dev-to-framework-3.6
[Backport 3.6] Move `mbedtls_dev` to framework submodule
2024-05-28 15:50:56 +00:00
Turiiya
20f4488cd0 fix typo
Signed-off-by: Turiiya <34311583+ttytm@users.noreply.github.com>
2024-05-23 21:43:55 +02:00
Gilles Peskine
2c3aa942aa
Merge pull request #9166 from gilles-peskine-arm/analyze_outcomes-generate_files-3.6
Backport 3.6: Generate test data before coverage analysis
2024-05-23 12:08:12 +00:00
Ronald Cron
baf6775a73
Merge pull request #9160 from ronald-cron-arm/crypto-config-test_ref_configs-3.6
[Backport 3.6] Partial backport of #9057
2024-05-23 09:30:04 +00:00
Gilles Peskine
7fbbb43a57 Pacify pylint
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-22 18:09:39 +02:00
Gilles Peskine
8941033a40 Generate test data before coverage analysis
Fixes #8300.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-22 18:09:39 +02:00
Ronald Cron
8526751ec4 Improve test-ref-configs.pl
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-05-22 09:12:19 +02:00
Ronald Cron
f313902890 Fix "maybe-uninitialized" warning with GCC 11.3
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-05-22 09:12:19 +02:00
Ronald Cron
7d949ae1a3 Resolve PBKDF2_AES_CMAC_PRF_128 dependencies
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-05-22 09:12:19 +02:00
Ronald Cron
e3283ed019 test-ref-configs.pl: Detect automatically test with USE_PSA enabled
Change the way we decide if for a given
configuration we need to run tests with
and without MBEDTLS_USE_PSA_CRYPTO enabled.
That makes the script suitable for 3.6 and
development branch.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-05-22 09:12:19 +02:00
Ronald Cron
f47f5459b1 Fix compat.sh filters
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-05-22 09:12:19 +02:00
Gilles Peskine
281aa2ea6f
Merge pull request #9136 from gilles-peskine-arm/ssl-opt-server2-detection-3.6
Backport 3.6: Fix skipped tests in configurations without RSA
2024-05-15 12:06:35 +00:00
Gilles Peskine
f287691e0c Add missing dependency that isn't autodetected
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-14 12:06:21 +02:00
Gilles Peskine
d2d9bbf9a6 Remove redundant RSA dependency
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-14 12:06:21 +02:00
Gilles Peskine
5194ff8e00 Explicitly use TLS 1.2 on <=1.2-specific keyUsage/extKeyusage tests
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-14 12:06:21 +02:00
Gilles Peskine
abb1c22588 Fix PSK invocation: GnuTLS PSK length (more)
Replace more sample PSK by longer (GnuTLS-compatible) strings, taking care
of keeping distinct PSK distinct for wrong-PSK tests.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-14 12:06:21 +02:00
Gilles Peskine
89ef2fabb5 Driver-only FFDH is not good enough for DHE support in TLS 1.2
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-14 12:06:20 +02:00
Gilles Peskine
21ad57677c Add seme missing dependencies on renegotiation support
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-14 12:06:20 +02:00
Gilles Peskine
f9c798cb97 Default NEXT versions to be the base executables
This allows many tests to pass with the system openssl and gnutls-*. As
before, not all test cases will pass due to differences between versions and
build options.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-14 12:06:20 +02:00
Gilles Peskine
e373c9417a Force some test cases to use TLS 1.2
Some OpenSSL or GnuTLS interoperability test cases fail if the other
implementation is recent enough to support TLS 1.3. Force those test cases
to use TLS 1.2 so that the script works with more recent $OPENSSL or
$GNUTLS_CLI or $GNUTLS_SERV than our official CI versions.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-14 12:06:20 +02:00
Gilles Peskine
80e54a20ac Add some missing dependencies on crypto features
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-14 12:06:20 +02:00
Gilles Peskine
02cd7168e6 Fix PSK invocation: GnuTLS PSK length
ssl-opt.sh uses a 3-byte PSK in many test cases. Unfortunately GnuTLS >=3.4.0
rejects a PSK that is less than 4 bytes long:

> Error setting the PSK credentials: The request is invalid.

Use a longer PSK throughout ssl-opt. Only the test cases involving GnuTLS
need to change, but it's easier to do a global search-and-replace, and it's
easier to not have to worry about mismatches in constructed test cases
later, so replace everything.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-14 12:06:20 +02:00
Gilles Peskine
f12359ded4 Fix PSK invocation: GnuTLS prompting
When given a PSK key but no username, gnutls-cli prompts for a password.
Prevent that by passing --pskusername with the same identity that
ssl_server2 uses by default.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-14 12:06:20 +02:00
Gilles Peskine
7fa055b57b Fix PSK invocation: OpenSSL client
Only s_server has a -nocert option, s_client doesn't. Fixes OpenSSL client
test cases in PSK-only builds.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-14 12:06:20 +02:00
Gilles Peskine
121a7bfc37 Require RSA when using server1* key or certificate
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-14 12:06:20 +02:00
Gilles Peskine
1bc28fe34b Fix skipped tests in configurations without RSA
Tighten the matching when detecting which certificates are in use to
determine algorithm requirements. This fixes a bug whereby all tests were
skipped in configurations without RSA except for an Mbed TLS client against
a GnuTLS or OpenSSL server, due to *server2* matching ssl_server2.
Fixes #8366.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-14 12:06:20 +02:00
Andre Goddard Rosa
3711734a0a Add invalid padding_len check in get_pkcs_padding
When trying to decrypt data with an invalid key, we found that `mbedtls`
returned `0x6200` (`-25088`), which means "_CIPHER - Input data contains
invalid padding and is rejected_" from `mbedtls_cipher_finish`, but it also
set the output len as `18446744073709551516`.

In case we detect an error with padding, we leave the output len zero'ed
and return `MBEDTLS_ERR_CIPHER_INVALID_PADDING`.

Here's a reference for the way `openssl` checks the padding length:
  - 1848c561ec/crypto/evp/evp_enc.c (L1023)
  - b554eef43b

So add a check ensuring output is set to the least-harmful value in the
error cases.

With the robustness fix:
`PASSED (125 suites, 26644 tests run)`

Without the robustness fix:
`FAILED (125 suites, 26644 tests run)`

Signed-off-by: Andre Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: Andre Goddard Rosa <agoddardrosa@roku.com>
2024-05-13 09:27:57 -05:00
David Horstmann
b1827cb42d Add mbedtls_framework to mypy checks
Since this python module resides in the framework submodule we must
add an extra explicit path to it for mypy.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-05-13 14:44:37 +01:00
David Horstmann
9638ca389b Update references to mbedtls_dev
Change these to point to the new mbedtls_framework module in the
framework submodule.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-05-13 14:44:37 +01:00