Commit Graph

31767 Commits

Author SHA1 Message Date
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
a602a41168 Prepare to test SSL sample programs
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 18:05:17 +02:00
Gilles Peskine
6959f53896 ssl_client1: Exit with an error status if the TLS connection failed
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 18:05:17 +02:00
Ronald Cron
2efb3da482
Merge pull request #9628 from gilles-peskine-arm/tls13-middlebox-compat-disabled-development
Fix interoperability when MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE is disabled
2024-09-25 11:50:36 +00:00
Gilles Peskine
870ed2a914 Have make ssl-opt generate tls13-compat.sh (make edition)
This is necessary if you haven't run `make generated_files` first.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-25 10:28:48 +02:00
Gilles Peskine
63068d69cb Have make ssl-opt generate tls13-compat.sh
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 19:09:57 +02:00
Gilles Peskine
1150526c8e Fix copypasta
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 19:02:13 +02:00
Gilles Peskine
fd6d279452 CMake: generate tls13-compat.sh in the default build target
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 19:02:13 +02:00
Gilles Peskine
40c090f61b Move generation of tls13-compat.sh to tests/CMakeLists.txt
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 19:02:11 +02:00
Gilles Peskine
907e49557b Print a "Gen" line when generating a file
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 18:59:31 +02:00
Gilles Peskine
1e01b4a1c7 Remove obsolete requirement for GnuTLS %DISABLE_TLS13_COMPAT_MODE
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 18:59:31 +02:00
Gilles Peskine
9ca9b924cc Reduce level of non-error debug message
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 18:59:31 +02:00
Gilles Peskine
dfbc1a9769 Remove transitional always-on internal option
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 18:59:31 +02:00
Gilles Peskine
6f03eb8ae1 Changelog entry: fix #9551
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 18:59:31 +02:00
Gilles Peskine
5dd839add3 Fix sensitivity of tls13-compat.sh to the exact generation method
Fix `tls13-compat.sh` changing based on exactly how
`generate_tls13_compat_tests.py` was run (e.g. from which directory). This
made `check-generated-files.sh` behave differently from `make`. The script
has no official variations of the content of its output file, so we don't
need to record the full command line.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 18:59:31 +02:00
Gilles Peskine
3943a1a3bf Automatically generate tests/opt-testcases/tls13-compat.sh
`tests/opt-testcases/tls13-compat.sh` is supposed to be automatically
generated by `tests/scripts/generate_tls13_compat_tests.py`. So far, the
output has been updated by running the script manually and committing the
output. Switch to using our framework for generated files.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 18:59:31 +02:00
Gilles Peskine
c07bedae56 generate_tls13_compat_tests: change default mode to all
With no options, update the output file (former behavior with -a).
Pass -1 to generate a single test case.

Also have the intended output file location as the default.

This way, you can just run the script after updating it, without having to
know the details of the directory structure.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 18:59:31 +02:00
Gilles Peskine
ae5a35fc30 Remove obsolete requirements on middlebox compatibility mode: generated
MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE is no longer required, except in test
cases that are specifically about it. This commit removes the requirement in
tls13-compat.sh (which does not have test cases that actually depend on the
feature).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 18:59:31 +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
Gilles Peskine
0f2d839521 Remove mid-stanza blank lines
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 18:58:49 +02:00
Gilles Peskine
671a439ddd Adapt middlebox compatibility tests for always-on acceptance
Adapt the test cases for TLS 1.3 middlebox compatibility mode, now that we
always interoperate with peers that support it, regardless of whether
MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE is enabled.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 18:58:49 +02:00
Gilles Peskine
73a406ee60 Separate accepting TLS 1.3 middlebox compatibility from sending it
The compile-time option MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE gates both
support for interoperability with a peer that uses middlebox compatibility
mode, and support for activating that mode ourselves. Change code that is
only needed for interoperability to be guarded by
MBEDTLS_SSL_TLS1_3_ACCEPT_COMPATIBILITY_MODE.

As of this commit, MBEDTLS_SSL_TLS1_3_ACCEPT_COMPATIBILITY_MODE is always
enabled: there is no way to disable it, and there are no tests with it
disabled.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 18:58:49 +02:00
Gilles Peskine
7b02c1f3b6 Avoid multiline requires_all_configs_xxx
For better searchability and readability, call requires_config_enabled or
requires_config_disabled for each option, instead of calling
requires_all_configs_enabled or requires_all_configs_disabled with a long
list of options.

```
perl -0777 -i -pe '
    # With -0777, we act on the whole file.
    # s[REGEXP][CODE]egm replaces every occurrence of REGEXP by the result
    # of running CODE.
    # The regexp matches "requires_all_configs_enabled" or
    # "requires_all_configs_disabled" followed by a list of words ending
    # with a line break. The words can be separated by a sequence of
    # spaces and optionally a backslash-newline.
    s[^requires_all_configs_(enabled|disabled) *((?:(?: \w+) *(?:\\\n)? *)+)\n][
      $state = $1;
      # Extract all the words from the list of words (/(\w+)/g). For each word,
      # For each word, construct a line "requires_config_XXXabled WORD".
      # The replacement text is the concatenation of these lines.
      join("", map {"requires_config_$state $_\n"} $2 =~ /(\w+)/g)
     ]egm' tests/ssl-opt.sh tests/opt-testcases/*.sh
```

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 18:58:47 +02:00
Gilles Peskine
1d6a9505ee opt-testcases/*.sh are not executable
The *.sh files in opt-testcases cannot be executed directly: they can only
be sourced by ssl-opt.sh. So don't make them executable and don't give them
a shebang line.

Also make sure that the first paragraph of each file is a short description.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 18:56:24 +02:00
Gilles Peskine
26650f5711
Merge pull request #9565 from gilles-peskine-arm/test-ref-configs-go-away
Switch from test-ref-configs.pl to separate components
2024-09-24 13:00:50 +00:00
Paul Elliott
edc27bc080
Merge pull request #9128 from gilles-peskine-arm/make_generated_files-document_CC
make_generated_files.bat: document C compiler requirement
2024-09-24 12:36:14 +00:00
Tom Cosgrove
475ed86c7a
Merge pull request #9600 from gilles-peskine-arm/use_psa_crypto-key_id_encodes_owner-compatible-config-dev
Fix obsolete comment about MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
2024-09-24 10:44:56 +00:00
Ronald Cron
8904570b31
Merge pull request #9470 from gabor-mezei-arm/9325_move_config.py_to_framework
Move `config.py` functionalities to the framework
2024-09-20 16:07:09 +00:00
Gilles Peskine
ea5de2b40d Simplify psa-crypto components that come from test-ref-configs
In the components migrated from test-ref-configs.pl, we don't need to
activate PSA: it's always on. Also, since there is no "_legacy" component to
contrast with, drop "_psa" from the component names.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-19 18:41:55 +02:00
Gilles Peskine
e7422a14e9 Remove legacy-crypto components that come from test-ref-configs
Remove the components migrated from test-ref-configs.pl that use legacy
crypto (no enabling of MBEDTLS_USE_PSA_CRYPTO). In the 4.0 preparation
branch, we are no longer interested in such configurations.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-19 18:36:25 +02:00
David Horstmann
bae154d76c
Merge pull request #9385 from eleuzi01/replace-ecdsa-some
Replace MBEDTLS_PK_HAVE_ECDSA* with PSA_WANT counterparts
2024-09-19 13:53:18 +00:00
Gilles Peskine
a22b95a91c Fix obsolete comment about MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER has been compatible with
MBEDTLS_USE_PSA_CRYPTO since https://github.com/Mbed-TLS/mbedtls/pull/5380.
We still don't want to enable it in the full config because it's a behavior
change, even an interface change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-19 13:43:57 +02:00
Gabor Mezei
a941e14b4c
Update framework
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:15 +02:00
Gabor Mezei
cd326bfc49
Apply the parameter change
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:15 +02:00
Gabor Mezei
317a2a3fed
Fix documentation
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:14 +02:00
Gabor Mezei
568808a41a
Update member variable names
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:14 +02:00
Gabor Mezei
f5f130879c
Fix documentation
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:14 +02:00
Gabor Mezei
0e9e4cbbd8
Move commonly used part to config_common
Move the Setting, Config, ConfigFile and ConfigTool classes to config_common.
Also update the referencies to the moved classes.

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:14 +02:00
Gabor Mezei
a12ed6bcb7
Unify spacing
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:14 +02:00
Gabor Mezei
24d7cc71af
Create a class for command line config manipulation
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:14 +02:00
Gabor Mezei
776ee9068d
Fix header file detection
Make the include directory check relative to the source file in case not called
from the project root.

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:14 +02:00
Gabor Mezei
d53080da2a
Make the Config a proper base class
Due to the forward declaration issues, move the common descendant functions
and configfile handling to the `Config` base class.

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:14 +02:00
Gabor Mezei
daf807f02d
Fix pylint issues
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:13 +02:00
Gabor Mezei
c659c1b164
Move config file modification flag handling to the Config class
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:13 +02:00
Gabor Mezei
9f2b817fa7
Update documentation
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-09-19 10:47:08 +02:00
Tom Cosgrove
b80516816d
Merge pull request #9536 from mpg/rsapub-perf-dev
[dev] Rsapub performance fix
2024-09-18 14:20:50 +00:00
Gilles Peskine
fbb59bd73b Document the C compiler requirement
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-18 13:10:58 +02:00
Gilles Peskine
73c4096442 Make the file a bit more readable
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-18 13:10:56 +02:00
Gilles Peskine
2e449f06ad Remove test-ref-configs.pl, which no longer does anything
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-14 18:20:57 +02:00