18798 Commits

Author SHA1 Message Date
Gilles Peskine
f75c70bb81 Explain why we require TLS client and server simultaneously
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-26 20:03:27 +02:00
Gilles Peskine
c08d5bfda7 Fix missing negation
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-26 20:03:23 +02:00
Gilles Peskine
556249e134 Pacify mypy
I had accidentally reused a variable name inside the same function. Python
copes but mypy doesn't.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-26 20:03:18 +02:00
Gilles Peskine
c79ecea42b Detect sub-options
When option A is only meaningful if option B is enabled, when enumerating
single-option test cases, emit A:B and !A:B rather than A and !A. This way
the "!A" case is actually meaningful.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-26 20:03:11 +02:00
Gilles Peskine
693611e532 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-26 20:02:49 +02:00
Gilles Peskine
ae27ca9e0a Anchor relative paths
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-26 19:52:12 +02:00
Gilles Peskine
14f91c9d89 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-26 19:49:59 +02:00
Gilles Peskine
41ad6601eb Recognize that a double-inclusion guard is not a config setting
Fix PSA_CRYPTO_CONFIG_H being treated as a configuration setting in
include/psa/crypto_config.h.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-06-26 19:49:46 +02:00
Ronald Cron
9250acc8ef
Merge pull request #9277 from ronald-cron-arm/tree-cleanliness-2.28
[Backport 2.28] Partial backport of #9247
2024-06-18 18:47:57 +00:00
Ronald Cron
eee0736d52 Add and update some .gitignore files
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-06-18 09:48:41 +02:00
Ronald Cron
e3bdbd53ec all.sh: Fix clean-up of Makefiles generated by CMake
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-06-18 09:39:51 +02:00
Gilles Peskine
f514f25f88
Merge pull request #9025 from gilles-peskine-arm/psa-storage-test-cases-never-supported-2.28
Backport 2.28: Fix the detection of not-supported mechanisms in systematically generated PSA tests
2024-06-14 18:23:38 +00:00
Tom Cosgrove
152983bd76
Merge pull request #9246 from lhuang04/mbedtls_2_28_psk_null_back_port
Set psk to NULL in ssl_psk_remove-backport to 2.28
2024-06-12 12:00:23 +00:00
lhuang04
0a2dd6d4eb Set psk to NULL in ssl_psk_remove-backport to 2.28
Summary:
Back port [PR 9241](https://github.com/Mbed-TLS/mbedtls/pull/9241) to
2.28 branch

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Signed-off-by: lhuang04 <lhuang04@fb.com>
2024-06-11 13:00:28 -07:00
Gilles Peskine
cd84e806ab
Merge pull request #9204 from gilles-peskine-arm/ssl-test-no-skip-all-2.28
Backport 2.28: ssl-opt.sh, compat.sh: Error out if not executing any tests
2024-06-11 13:59:17 +00:00
Tom Cosgrove
3b5e1d8f78
Merge pull request #9222 from valeriosetti/backport-2.28-fix-psa-doc
[Backport 2.28] fix documentation of psa_hash_compare()
2024-06-03 15:34:26 +00:00
Valerio Setti
e5995e292a crypto.h: fix documentation for some functions
Some functions has input parameters which are erroneously
reported as "param[out]" in the documentation. This commit
fixes them.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-06-03 11:46:49 +02:00
Gilles Peskine
5a63e2f25f Select more RSA cipher suites
Filtering on cipher suites that have RSA in their name excludes a few old
RSA-based cipher suites whose name doesn't contain RSA.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-31 13:36:55 +02:00
Gilles Peskine
8f5722a971 Fix compat.sh not running any tests on config-mini-tls1_1.h
We were only requesting 3DES cipher suites (which is weirdly restrictive
since the configuration also includes AES), but DES is in the default
exclusion list for compat.sh, so we ended up having no acceptable cipher
suites. Fix this.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-30 15:17:28 +02:00
Gilles Peskine
2ca5a68ad3 Enable 3DES with GnuTLS
With GnuTLS servers, 3DES-CBC cipher suites are enabled by default under our
GNUTLS_LEGACY (3.3.8), but disabled by default under more recent versions
including the one we use by default on the CI (3.4.6). Even modern
versions (I checked 3.7.2) support 3DES if explicitly enabled. So
unconditionally enable 3DES-CBC for GnuTLS.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-30 15:14:40 +02:00
Gilles Peskine
d2c418932a 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:03:12 +02:00
Gilles Peskine
9ebf9aa448
Merge pull request #9153 from gilles-peskine-arm/oid-limits-2.28
2.28 only: Fix the build without check_config.h (inclusion of limits.h)
2024-05-29 16:14:24 +00:00
Gilles Peskine
a8cd2e6421 Fix the build without check_config.h (inclusion of limits.h)
Including `mbedtls/check_config.h` from `mbedtls/config.h` is optional. If
done, `limits.h` gets included. If not done, we were missing the inclusion
of `limits.h` in several source files. Fix this and add a test build that
doesn't include `mbedtls/check_config.h`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-17 19:00:46 +02:00
Gilles Peskine
b86ce2ee36
Merge pull request #9137 from gilles-peskine-arm/ssl-opt-server2-detection-2.28
Backport 2.28: Fix skipped tests in configurations without RSA
2024-05-15 12:06:42 +00:00
Gilles Peskine
0d16d81264 Add missing dependency that isn't autodetected
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-14 12:25:53 +02:00
Gilles Peskine
2b08ba0674 Remove redundant RSA dependency
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-14 12:25:43 +02:00
Gilles Peskine
dd53964468 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:25:14 +02:00
Gilles Peskine
b3bba1a954 Add seme missing dependencies on renegotiation support
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-14 12:24:37 +02:00
Gilles Peskine
757eb9cd79 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:23:45 +02:00
Gilles Peskine
e4d2ab87cd Add some missing dependencies on crypto features
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-14 12:23:25 +02:00
Gilles Peskine
d84733de03 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:19:40 +02:00
Gilles Peskine
6cafbb3ae8 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:17:21 +02:00
Gilles Peskine
8ed4374102 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:17:06 +02:00
Jerry Yu
bf90047fe0 Remove Terminated message on 22.04
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2024-05-14 12:17:06 +02:00
Gilles Peskine
e32671f0d7
Merge pull request #9086 from nileshkale123/fix/redefinition_warning_for_gnu_source_backport_2.28
Backport 2.28: Fixed issue of redefinition warning messages for _GNU_SOURCE
2024-05-06 12:40:41 +00:00
Janos Follath
d090f49c82 Fix Changelog formatting
Add EOL and remove trailing whitespaces.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2024-05-03 10:51:16 +05:30
Gilles Peskine
a5586e1e1d
Merge pull request #8907 from IVOES/backport2.28-cpp/unbounded-write
Backport 2.28: ssl_mail_client: Fix unbounded write of sprintf()
2024-05-02 16:06:19 +00:00
Gilles Peskine
791331158c
Merge pull request #8544 from Ryan-Everett-arm/8537-2.28
Backport 2.28: Fix error handling for secure element keys in `psa_start_key_creation`
2024-05-02 16:06:11 +00:00
Gilles Peskine
fd9e50606c Missing word
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-02 13:44:54 +02:00
nilesh.kale
52b6fefcc4 Fixed issue of redefinition warning messages for _GNU_SOURCE
Signed-off-by: nilesh.kale <nilesh.kale@espressif.com>
2024-05-02 14:47:54 +05:30
Manuel Pégourié-Gonnard
ddfb62661c
Merge pull request #9019 from mpg/compat-not-executed-2.28
[2.28] Fix compat.sh tests (reported as) not executed
2024-04-24 07:11:45 +00:00
Manuel Pégourié-Gonnard
f47bea82e2
Merge pull request #8929 from gilles-peskine-arm/test-dependencies-20240314-2.28
Backport 2.28: fix some test case dependencies
2024-04-22 10:37:54 +00:00
Gilles Peskine
9ffffab4d6 Fix edge case with half-supported ECDSA
ECDSA has two variants: deterministic (PSA_ALG_DETERMINISTIC_ECDSA) and
randomized (PSA_ALG_ECDSA). The two variants are different for signature but
identical for verification. Mbed TLS accepts either variant as the algorithm
parameter for verification even when only the other variant is supported,
so we need to handle this as a special case when generating not-supported
test cases.

In this commit:

* Automatically generated not-supported test cases for ECDSA now require
  both variants to be disabled.
* Add manually written not-supported test cases for the signature
  operation when exactly one variant is supported.
* Add manually written positive test cases for the verification
  operation when exactly one variant is supported.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-19 19:33:29 +02:00
Gilles Peskine
47398e06ef Add some missing test case dependencies
Following "PSA sign/verify: more uniform error on an unsupported hash", some
error cases are detected earlier, so there is some sloppiness in test case
dependencies that is not longer acceptable.

* In test_suite_psa_crypto, one test case for a hash+sign algorithm now
  returns NOT_SUPPORTED rather than INVALID_ARGUMENT when the hash is not
  supported and the key is invalid.
* In test_suite_psa_crypto_se_driver_hal_mocks, some test cases now error
  out before reaching the mocks rather than after when they attempt to
  use an unsupported hash.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-19 17:41:41 +02:00
Manuel Pégourié-Gonnard
de887bad7c Fix silly typo
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-18 10:06:19 +02:00
Manuel Pégourié-Gonnard
b76606cc14 Run full compat.sh in ASan component only
It makes little sense to run full compat.sh in the non-ASan component
but only partial compat.sh in the ASan component.

Actually, the non-ASan component doesn't need compat.sh at all, it's
more than covered with ssl-opt.sh and test_suite_ssl already.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-17 12:15:51 +02:00
Manuel Pégourié-Gonnard
aefbb66bfb Simplify full invocation of compat.sh
Now run everything we can with the default version in one go, then
everything that needs legacy, then next.

Don't rely on the default value of -e (EXCLUDE), use explicit values
everywhere - this makes it obvious that we are running everything.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-17 12:09:45 +02:00
Gilles Peskine
0311b211e4 Explain why DH and DSA are still explicitly excluded
If we don't exclude them from test case enumeration, then
detect_not_implemented_dependencies would cause the generated test cases to
be commented out, but the test case generation would fail before that
because asymmetric_key_data.py doesn't include DH and DSA keys.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-11 22:00:55 +02:00
Gilles Peskine
b8ddf6acd4 PSA test case generation: comment out always-skipped test cases
When we generate a test case for a mechanism that is not implemented,
comment out the test case rather than giving it a never-fulfilled
dependency. That way we don't create test cases that cannot be executed.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-11 22:00:55 +02:00
Gilles Peskine
696b7eef7b TestCase: add mechanism to skip a test case
Allow "skipping" a test case, meaning that the test case is generated
commented out. This is useful when systematically generating test cases
according to certain rules, where some generated tests cannot be executed
but we still want them to be visible when auditing the generation output.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-11 22:00:55 +02:00