11759 Commits

Author SHA1 Message Date
Gilles Peskine
3f5022e66d Move analysis functions into their respective classes
No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 22:11:50 +02:00
Gilles Peskine
0f31f76f83 Remove dead code that was handling stringly typed data
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 22:11:50 +02:00
Gilles Peskine
9df375b018 Replace stringly typed data by class: driver vs reference (data)
Work on the stringly typed KNOWN_TASKS by classes for each category
of tasks, with a structure that matches the behavior.

This commit migrates the data for driver-vs-reference analysis and gets rid
of the transitional code that was using the old form of the data.

No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 22:11:48 +02:00
Gilles Peskine
82b16721bd Replace stringly typed data by class: driver vs reference (code)
Work on the stringly typed KNOWN_TASKS by classes for each category
of tasks, with a structure that matches the behavior.

This commit migrates the code for driver-vs-reference analysis. To
facilitate review, this commit preserves the layout of the data that
parametrizes each task. The next commit will migrate the data.

No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 22:10:20 +02:00
Gilles Peskine
f646dbf71d Replace stringly typed data by class: coverage
Work on replacing the stringly typed KNOWN_TASKS by classes for each category
of tasks, with a structure that matches the behavior.

This commit migrates test coverage analysis.

No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 22:07:11 +02:00
Gilles Peskine
19ef1ae72e Replace stringly typed data by class: prepare
Start replacing the stringly typed KNOWN_TASKS by classes for each category
of tasks, with a structure that matches the behavior.

This commit introduces some transition code.

No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-24 22:07:11 +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
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
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
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
Gilles Peskine
effa6a0769 Move config-tfm.h testing to separate all.sh component
Rename the existing component_test_tfm_config which tests a modified version
of config-tfm.h for the sake of driver-vs-reference comparison.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-14 18:20:57 +02:00
Gilles Peskine
af5a899a12 Move config-symmetric-only.h testing to separate all.sh components
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-14 18:20:57 +02:00
Gilles Peskine
86ceb133d4 Move config-thread.h testing to separate all.sh components
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-14 18:20:57 +02:00
Gilles Peskine
b6d4913df9 Move config-suite-b.h testing to separate all.sh components
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-14 18:20:57 +02:00
Gilles Peskine
68f511ec92 Move config-ccm-psk-dtls1_2.h testing to separate all.sh components
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-14 18:20:57 +02:00
Gilles Peskine
063fb8cf13 Move config-ccm-psk-tls1_2.h testing to separate all.sh components
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-14 13:06:15 +02:00
Gilles Peskine
e3eab32600 requires_certificate_authentication: prioritize TLS 1.3
When checking whether the build supports certificate authentication, check
the key exchange modes enabled in the default protocol version. This is TLS
1.3 when it's enabled.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-13 09:48:34 +02:00
Gilles Peskine
6e85e35fcc Documentation improvements
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-13 09:48:34 +02:00
Gilles Peskine
2dd4395da0 Fix detection of TLS 1.2 PSK-ephemeral key exchange modes
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-13 09:48:34 +02:00
Gilles Peskine
7f453bfad4 Improve some comments
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-13 09:48:34 +02:00
Gilles Peskine
78df617362 Remove unused auth_mode parameter on a PSK test case
It was causing the test case to be incorrectly skipped as needing
certificate authentication.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-13 09:48:34 +02:00
Gilles Peskine
cd4fe70fe2 Fix weirdly quoted invocations of requires_any_configs_enabled
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-13 09:48:34 +02:00
Gilles Peskine
db26406934 Also activate PSK-only mode when PSK-ephemeral key exchanges are available
The point of PSK-only mode is to transform certificate-based command lines
into PSK-based command lines, when the certificates are not relevant to what
is being tested. So it makes sense to do that in with PSK-ephemeral key
exchanges too.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-13 09:48:34 +02:00
Gilles Peskine
9d3b2079a5 Unify the two requires-key-exchange-with-certificate function
requires_certificate_authentication was called in more places, but did not
do fine-grained analysis of key exchanges and so gave the wrong results in
some builds.

requires_key_exchange_with_cert_in_tls12_or_tls13_enabled gave the correct
result but was only used in some test cases, not in the automatic detection
code.

Remove all uses of requires_key_exchange_with_cert_in_tls12_or_tls13_enabled
because they are in fact covered by automated detection that calls
requires_certificate_authentication.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-13 09:48:34 +02:00
Gilles Peskine
24b4303ddd Detect PSK-only mode in TLS 1.3 as well
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-13 09:48:34 +02:00
Gilles Peskine
4f0986487d Fix PSK-only mode doing less than it should
Don't add a certificate requirement when PSK is enabled.

Do command line requirement detection after the injection of PSK into the
command line in PSK-only mode. Otherwise certificate requirements would be
added even in PSK-only mode.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-13 09:48:34 +02:00
Gilles Peskine
ae3dc17e50 Detect more cases where certificates are required
When requiring a cryptographic mechanism for the sake of certificate
authentication, also require that certificate authentication is enabled.

Setting auth_mode explicitly means that we're testing something related to
how certificate-based authentication is handled, so require a key exchange
with certificate-based authentication.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-13 09:48:34 +02:00
Gilles Peskine
6f9952abfc ssl-opt: Fix GnuTLS PSK injection
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-13 09:48:33 +02:00
Gilles Peskine
9404169146 Use CONFIGS_ENABLED instead of repeatedly calling query_compile_time_config
It's faster and more readable.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-13 09:48:01 +02:00
Gilles Peskine
56ee69de5b Fix "Renegotiation: openssl server, client-initiated" with OpenSSL 3
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-13 09:48:01 +02:00
Elena Uziunaite
ffce45c19f Add missing ALG_SHA_1
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-09-12 14:58:52 +01:00
Ronald Cron
a45ba05e35
Merge pull request #9549 from ronald-cron-arm/adapt-components
Adapt some all.sh components to MBEDTLS_PSA_CRYPTO_CONFIG always on
2024-09-12 12:00:39 +00:00
Paul Elliott
2f620f3127
Merge pull request #9561 from gilles-peskine-arm/cmake-underscore_D
Fix typo that caused cpp_dummy_build not to be built with CMake
2024-09-12 11:40:46 +00:00
Paul Elliott
8ea8b30941
Merge pull request #8988 from billatarm/add-pc-files
tests: add a test for pkg-config files
2024-09-11 21:14:46 +00:00
Bill Roberts
10ff4174f4
tests: add a test for pkg-config files
Add a test that does some basic validation of the pkg-config files.

Example run:
./tests/scripts/all.sh test_cmake_as_package
<snip>
******************************************************************
* test_cmake_as_package: build: cmake 'as-package' build
* Wed Sep 11 16:17:41 UTC 2024
******************************************************************
cmake .
make
Built against Mbed TLS 3.6.0
testing package config file: mbedtls ... passed
testing package config file: mbedx509 ... passed
testing package config file: mbedcrypto ... passed
make clean

Signed-off-by: Bill Roberts <bill.roberts@arm.com>
2024-09-11 09:19:42 -07:00
Gilles Peskine
236e05d758 Fix typo that caused cpp_dummy_build not to be built with CMake
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-11 17:51:45 +02:00
Ronald Cron
4153ebb55d Fix comments
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-09-11 15:32:48 +02:00
Elena Uziunaite
b430eeea85 Bring back some dependencies
To make CI happier

Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-09-09 11:18:10 +01:00
Elena Uziunaite
91d8386a42 Enable USE_PSA_CRYPTO
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-09-09 11:18:10 +01:00
Elena Uziunaite
96867b6bf4 Address review comments: remove dependencies
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-09-09 11:18:10 +01:00
Elena Uziunaite
8d8620bf18 Address review comments: add PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-09-09 11:18:10 +01:00
Elena Uziunaite
bed21b55a6 Replace MBEDTLS_PK_CAN_ECDSA_VERIFY with PSA_HAVE_ALG_ECDSA_VERIFY
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-09-09 11:18:10 +01:00
Elena Uziunaite
39c7d5dc4b Replace MBEDTLS_PK_CAN_ECDSA_SIGN with PSA_HAVE_ALG_ECDSA_SIGN
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-09-09 11:18:08 +01:00
Elena Uziunaite
a6950b8ce7 Replace MBEDTLS_PK_CAN_ECDSA_SOME with PSA_HAVE_ALG_SOME_ECDSA
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-09-09 11:17:36 +01:00
Ronald Cron
e7f289e5e9 Use PSA crypto config in test_sha3_variations
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-09-09 07:47:08 +02:00
Ronald Cron
6604047204 all.sh: Keep only "test_block_cipher_no_decrypt_aesni" with PSA config
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-09-09 07:47:08 +02:00
Ronald Cron
54d1eecd58 all.sh: Enable MBEDTLS_PSA_CRYPTO_CONFIG in build_aes_variations
In preparation of MBEDTLS_PSA_CRYPTO_CONFIG
being always on, enable MBEDTLS_PSA_CRYPTO_CONFIG
in build_aes_variations.

While enabling MBEDTLS_PSA_CRYPTO_CONFIG, disable
some PSA_WANT_ so that the configuration
remain the same for the modified component.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-09-09 07:47:08 +02:00
Ronald Cron
a9511bc57f all.sh: Enable MBEDTLS_PSA_CRYPTO_CONFIG in tls13 components
In preparation of MBEDTLS_PSA_CRYPTO_CONFIG
being always on, enable MBEDTLS_PSA_CRYPTO_CONFIG
in some TLS 1.3 all.sh test components.

While enabling MBEDTLS_PSA_CRYPTO_CONFIG, disable
some PSA_WANT_ so that the configurations
remain the same for the modified components.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-09-09 07:47:08 +02:00