1
0
mirror of https://github.com/ARMmbed/mbedtls.git synced 2025-05-11 01:11:42 +08:00

1318 Commits

Author SHA1 Message Date
Minos Galanakis
74ce7498d7 ssl-opt: Added negative tests for handshake fragmentation.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-02-24 09:16:06 +00:00
Minos Galanakis
1c106afd22 ssl-opt: Added handshake fragmentation tests for 4 byte fragments.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-02-24 09:16:06 +00:00
Minos Galanakis
41782a9cd0 ssl-opt: Added negative-assertion testing, (HS Fragmentation disabled)
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-02-24 09:16:06 +00:00
Minos Galanakis
85fe73d55d ssl-opt: Added tls 1.2 tests for HS defragmentation.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-02-24 09:16:06 +00:00
Minos Galanakis
a4dde77cbe ssl-opt: Dependency resolving set to use to requires_protocol_version HS deframentation tests.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-02-24 09:16:06 +00:00
Minos Galanakis
a8a298c9d6 ssl-opt: Adjusted the wording on handshake fragmentation tests.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-02-24 09:16:06 +00:00
Minos Galanakis
a1b9117f17 ssl-opt: Added requires_openssl_3_x to defragmentation tests.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-02-24 09:16:06 +00:00
Minos Galanakis
270dd7462e ssl-opt: Updated the keywords to look up during handshake fragmentation tests.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2025-02-24 09:16:06 +00:00
Waleed Elmelegy
4028cfd9ca Add missing client certificate check in handshake defragmentation tests
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2025-02-24 09:16:06 +00:00
Waleed Elmelegy
5f21537c2a Test Handshake defragmentation only for TLS 1.3 only for small values
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2025-02-24 09:16:06 +00:00
Waleed Elmelegy
a75c7e09c8 Add guard to handshake defragmentation tests for client certificate
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2025-02-24 09:16:06 +00:00
Waleed Elmelegy
f162249e87 Add a comment to elaborate using split_send_frag in handshake defragmentation tests
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2025-02-24 09:16:06 +00:00
Waleed Elmelegy
61b8e2d225 Enforce client authentication in handshake fragmentation tests
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2025-02-24 09:16:06 +00:00
Waleed Elmelegy
39d83dd38d Remove unneeded mtu option from handshake fragmentation tests
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2025-02-24 09:16:06 +00:00
Waleed Elmelegy
48874b3aba Add client authentication to handshake defragmentation tests
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2025-02-24 09:16:06 +00:00
Waleed Elmelegy
f9120311e3 Require openssl to support TLS 1.3 in handshake defragmentation tests
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2025-02-24 09:16:06 +00:00
Waleed Elmelegy
fccd014c2d Remove unnecessary string check in handshake defragmentation tests
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2025-02-24 09:16:06 +00:00
Waleed Elmelegy
c0118d87b9 Fix typo in TLS Handshake defrafmentation tests
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2025-02-24 09:16:06 +00:00
Waleed Elmelegy
0e0d5d4dc8 Improve TLS handshake defragmentation tests
* Add tests for the server side.
* Remove restriction for TLS 1.2 so that we can test TLS 1.2 & 1.3.
* Use latest version of openSSL to make sure -max_send_frag &
  -split_send_frag flags are supported.

Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2025-02-24 09:16:06 +00:00
Waleed Elmelegy
79a8ded315 Add TLS Hanshake defragmentation tests
Tests uses openssl s_server with a mix of max_send_frag
and split_send_frag options.

Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2025-02-24 09:16:06 +00:00
Gilles Peskine
e5054e495a mbedtls_ssl_set_hostname tests: baseline
Test the current behavior.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-20 19:24:16 +01:00
Gilles Peskine
58b399e81e Automate MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK dependency
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-02-20 18:51:14 +01:00
Valerio Setti
98f348a2c5 ssl-opt.sh|compat.sh: remove references to DHE-RSA
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-02-06 10:05:58 +01:00
Ronald Cron
ed445089c2
Merge pull request #9916 from valeriosetti/issue9688
Migrate DHE test cases to ECDHE
2025-01-29 09:59:22 +00:00
Valerio Setti
0ebd6de77b ssl-opt.sh: remove tests forcing DHE-RSA for which have alternatives
Remove tests which are forcing DHE-RSA, but for which an ECDHE-RSA
alternative already exists.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-01-27 12:46:26 +01:00
Valerio Setti
3b412e283f ssl-opt.sh: remove tests which are specific for DHE-RSA
For these ones there is no ECDHE alternative as they are testing
specific features of DHE.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-01-27 12:46:26 +01:00
Valerio Setti
309a7ec70e ssl-opt.sh: adapt tests from DHE-RSA to ECDHE-RSA
Adapted tests do not already have an ECDHE-RSA test available.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-01-27 12:46:26 +01:00
Valerio Setti
5c730c1d54 ssl-opt.sh: remove DHE-PSK only test cases
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-01-24 11:49:59 +01:00
Gilles Peskine
bc7c523420 Remove uses of secp244k1
Remove all code guarded by `PSA_WANT_ECC_SECP_K1_224`, which is not and will
not be implemented. (It would be K1_225 anyway, but we don't intend to
implement it anyway.)

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-01-08 16:51:23 +01:00
Manuel Pégourié-Gonnard
4a8e8f84d9
Merge pull request #9666 from Harry-Ramsey/remove-obsolete-ci-scripts-development
Remove obsolete CI Scripts
2024-12-09 10:49:45 +00:00
Minos Galanakis
4ce27cb49b ssl-opt: CONFIGS_ENABLED list should always end with a space char.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-12-04 15:08:39 +00:00
Harry Ramsey
c6d2e4ecfc Remove obsolete tcp_client.pl
This commit removes tcp_client.pl and removes it from ssl-opt.sh as it
has been replaced by test_suite_ssl.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-12-02 16:23:06 +00:00
Gilles Peskine
ac767e5c69 Remove MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED
Remove the configuration option MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED and all
code guarded by it. This remove support for the RSA-PSK key exchange in TLS
1.2.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-11-05 15:49:01 +01:00
Gilles Peskine
7dfe7c9e4a Remove RSA-PSK test cases
The test cases removed by this commit are specific to RSA-PSK, not
incidentally using RSA-PSK when testing other features, so there is no loss
of test coverage.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-11-05 15:48:11 +01:00
Janos Follath
e7c28d6847
Merge pull request #9727 from gilles-peskine-arm/use_psa_crypto-always_forced
Force MBEDTLS_USE_PSA_CRYPTO enabled
2024-11-04 11:32:45 +00:00
Gilles Peskine
05030d4141 Skip slowest FFDH tests against GnuTLS with MSan or Valgrind
Skip 6144-bit and 8192-bit FFDH tests in MSan or Valgrind test
configurations. These test cases are slow and sometimes trigger GnuTLS's
built-in timeout (which cannot be configured until more recent versions).

Resolves #9742.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-31 18:52:40 +01:00
Gilles Peskine
005370f0be Skip "no USE_PSA" test cases in ssl-opt.sh
These test cases are desirable, but they will fail until we resolve
https://github.com/Mbed-TLS/mbedtls/issues/7294 .

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-30 14:23:16 +01:00
Gilles Peskine
fb31ebd6d5 Remove code for MBEDTLS_USE_PSA_CRYPTO disabled in ssl-opt.sh
Now that MBEDTLS_USE_PSA_CRYPTO is always on, remove code that handles the
case when it's disabled.
Also this is a step towards no longer expecting it to be reported by
query_compile_time_config.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-30 14:23:16 +01:00
Gilles Peskine
5e443f983b Remove direct requirements on MBEDTLS_USE_PSA_CRYPTO in ssl-opt.sh
Now that MBEDTLS_USE_PSA_CRYPTO is always on, we don't need to check for it.
Also this is a step towards no longer expecting it to be reported by
query_compile_time_config.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-30 14:23:16 +01:00
Gilles Peskine
f9ad8303f1 Skip ssl_server in config-suite-b
When building with `configs/config-suite-b.h`, the SSL I/O buffer size is
1024 bytes. Experimentally, this isn't quite enough for the test certificate
that we use: the server aborts the handshake with
`MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL` raised from
`mbedtls_ssl_write_certificate()`. State an ad hoc minimum output buffer
size to skip testing `ssl_server` in `config-suite-b`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 18:05:18 +02:00
Gilles Peskine
cc7d6ae95f Note known issue about test cases skipped in TLS 1.3-only builds
https://github.com/Mbed-TLS/mbedtls/issues/9560

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 18:05:17 +02:00
Gilles Peskine
6ef5239974 Compatibiliy with older OpenSSL and GnuTLS
GnuTLS 3.4.x doesn't allow repeated `-p PORT` arguments.

OpenSSL 1.0.2 has different logs. For TLS 1.2 test cases, use a line that
is present in logs from OpenSSL 1.0.2g, 3.3.0 and presumably all versions
in between.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 18:05:17 +02:00
Gilles Peskine
6b4d6931e7 Test dtls_server
Test against both OpenSSL and GnuTLS.

Don't use a proxy. It's not particularly useful here, and would complicate
figuring out port numbers.

Clean up compile-time requirements dtls_server.c: any certificate-based key
exchange is ok, so don't insist on built-in RSA.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 18:05:17 +02:00
Gilles Peskine
c83e56cc45 Test ssl_fork_server
Test ssl_fork_server with both TLS 1.2 and TLS 1.3.
Test against both OpenSSL and GnuTLS.

In the server, flush more often. Otherwise, when stdout is redirected to a
file, the server gets killed before it writes important information, such as
the logs that we expect in the test cases.

In the server, only write output for 10 seconds, not 100. That's enough time
to start concurrent clients if desired. 100 seconds causes ssl-opt to take a
very long time when the client actually listens to the whole input (which
`gnutls-cli` does, but not `openssl s_client`).

Clean up compile-time requirements in ssl_fork_server.c: any certificate-based
key exchange is ok, so don't insist on built-in RSA.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 18:05:17 +02:00
Gilles Peskine
3abca9510a Test ssl_pthread_server
Test ssl_pthread_server with both TLS 1.2 and TLS 1.3.
Test against both OpenSSL and GnuTLS.

In the server, flush more often. Otherwise, when stdout is redirected to a
file, the server gets killed before it writes important information, such as
the logs that we expect in the test cases.

Clean up compile-time requirements in ssl_pthread_server.c: any certificate-based
key exchange is ok, so don't insist on built-in RSA.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 18:05:17 +02:00
Gilles Peskine
a21e893398 Test ssl_server
Test ssl_server with both TLS 1.2 and TLS 1.3.
Test against both OpenSSL and GnuTLS.

Clean up compile-time requirements in ssl_server.c: any certificate-based
key exchange is ok, so don't insist on built-in RSA.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 18:05:17 +02:00
Gilles Peskine
ae710c8b01 Test dtls_client
Test against both OpenSSL and GnuTLS.

Don't use a proxy. It's not particularly useful here, and would complicate
figuring out port numbers.

Clean up compile-time requirements in dtls_client.c: any certificate-based
key exchange is ok, so don't insist on built-in RSA.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 18:05:17 +02:00
Gilles Peskine
7985d454c4 Test ssl_client1
Test ssl_client1 with both TLS 1.2 and TLS 1.3.
Test against both OpenSSL and GnuTLS.

Clean up compile-time requirements in ssl_client1.c: any certificate-based
key exchange is ok, so don't insist on built-in RSA.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 18:05:17 +02:00
Gilles Peskine
2bc5c80c60 Allow test cases to use a specific port
This is necessary for the SSL sample programs: they hard-code port 4433.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 18:05:17 +02:00
Gilles Peskine
edc8f35ed3 Remove obsolete requirements on middlebox compatibility mode: manual
MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE is no longer required, except in test
cases that are specifically about it. This commit removes the requirement on
all test cases except those whose description contains "middlebox".

Exclude tls13-compat.sh which is automatically generated and will be handled
in a separate commit.

```
perl -0777 -i -pe '
    # With -0777, we act on the whole file.
    # s[REGEXP][EXPR]gm replaces every occurrence of REGEXP by EXPR.
    # The regexp matches "requires_config_enabled MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE",
    # followed by zero or more non-empty lines, followed by a line starting
    # with "run_test" and not containing "middlebox".
    # The replacement is everything matched except the first line.
    s[^requires_config_enabled MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE\n((?:.+\n)*run_test (?!.*middlebox))]
     [$1]gm' tests/ssl-opt.sh tests/opt-testcases/tls13-kex-modes.sh tests/opt-testcases/tls13-misc.sh
```

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 18:59:30 +02:00