18773 Commits

Author SHA1 Message Date
Gilles Peskine
f16263e286 Assert that key ID ranges don't overlap
Ensure that a key ID can't be in range for more than one of volatile keys,
persistent (i.e. user-chosen) keys or built-in keys.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-07 11:17:32 +02:00
Gilles Peskine
91773db331 Add a test for the built-in key range
Restricting the built-in key range would be an API break since applications
can hard-code a built-in key value and expect that it won't clash with
anything else. Make it harder to accidentally break the API.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-07 11:17:32 +02:00
Gilles Peskine
37a4fcc5b4 Prevent mbedtls_psa_register_se_key with volatile keys
mbedtls_psa_register_se_key() is not usable with volatile keys, since there
is no way to return the implementation-chosen key identifier which would be
needed to use the key. Document this limitation. Reject an attempt to create
such an unusable key. Fixes #9253.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-07 11:17:32 +02:00
Gilles Peskine
f555a4e26f MBEDTLS_STATIC_ASSERT: make it work outside of a function
At the top level, the macro would have had to be used without a following
semicolon (except with permissive compilers that accept spurious semicolons
outside of a function), which is confusing to humans and indenters. Fix
that.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-07 11:17:32 +02: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
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
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
Manuel Pégourié-Gonnard
9fb48dab2d Remove leftover debugging printf
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-11 10:32:02 +02:00
Manuel Pégourié-Gonnard
de05197829 compat.sh: properly skip single-DES and DTLS 1.2
Skipping DTLS 1.2 with old versions was already done, but now properly
test support only once and use the results.

Skipping single-DES with new versions is new, but helps finding the right
incantation.

Note that historically, this script's policy was that it's the user's
job to find the right value of -e (EXCLUDE) for their version for
OpenSSL & config. Now it's a weird mix of that and the script doing some
detection and skipping.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-10 22:19:01 +02:00
Manuel Pégourié-Gonnard
7e5d81d431 compat.sh: no TLS-RSA-WITH-NULL-SHA256 with ssl3
This is officially a 1.2-only ciphersuite, but we also support it with
1.0 and 1.1. However we don't support it with SSLv3 (see definition in
ssl_ciphersuites.c: mininum minor version is 1, that is TLS 1.0).

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-10 22:19:01 +02:00
Manuel Pégourié-Gonnard
e86e2bc451 compat.sh: properly report skipped tests
Don't just silently continue.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-10 12:31:01 +02:00
Manuel Pégourié-Gonnard
2e1d2fe875 analyze_outcomes.py: ignore OpenSSL+dtls12+DES
No sure if it'd possible to build a version of OpenSSL that supports
both by tuning the config, but pretty sure improving testing for
single-DES ciphersuites is not the best use of our time in 2024.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-10 12:31:01 +02:00
Manuel Pégourié-Gonnard
2cd43a7a78 Run compat.sh with non-default ciphers with ssl3 too
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-10 12:31:01 +02:00
Manuel Pégourié-Gonnard
62910cf47d compat.sh: include ssl3 in --list-test-cases
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-10 12:31:01 +02:00
Manuel Pégourié-Gonnard
c1685d1c11 compat.sh: use correct names in --list-test-cases
The main fix here is that m->O and m->G should use `M_CIPHERS`. In order
to apply that though, we need to change the structure with a new for
loop and case statement. The new structure matches what's done when
actually running tests.

Note: this issue only exists in 2.28. In 3.x we now use the standard
name for display everywhere, but in 2.28 we use the name as seen by the
client for display.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-10 12:31:01 +02:00
Manuel Pégourié-Gonnard
826f8da954 compat.sh: fix --list-test-cases for RC4 with DTLS
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-10 12:31:01 +02:00
Manuel Pégourié-Gonnard
4be89414ab compat.sh: always filter ciphersuites
We always want to call 'filter' regardless of the values of FILTER
and EXCLUDE because it also performs standard-defined filtering like
removing RC4 ciphersuites with DTLS.

(AFAICS, not calling 'filter' when we thought it was not needed was
just a performance optimisation.)

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-10 12:29:58 +02:00
Gilles Peskine
c3f5c96a8d
Merge pull request #8996 from mpg/fix-wrong-dep-test-case-2.28
[Backport 2.28] Fix wrong dependencies in test cases
2024-04-09 11:34:05 +00:00
Manuel Pégourié-Gonnard
1186a1aff3 Fix inconsistency in variable declaration/use
The guards for the declaration and use were not consistent. This could
be resolved either way; I chose the way that matches development.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-03 10:03:21 +02:00
Manuel Pégourié-Gonnard
70d8fea2dc Finish backporting hits_export_public_key;
A previous commit backported the declaration of this field as part of
conflict resolution in the hope of preventing further conflicts in the
future. But if we backport it we should do it properly. This commit
finishes the job.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-04-03 09:54:49 +02:00
Mingjie Shen
52c2af3ba4 ssl_mail_client: Fix code style issue
Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2024-04-02 17:26:49 -04:00