31968 Commits

Author SHA1 Message Date
Gilles Peskine
6707584614
Merge pull request #9593 from gilles-peskine-arm/test-cases-not-executed-enforce-development
Test cases not executed: switch to enforcement mode
2024-10-18 18:19:34 +00:00
Gilles Peskine
f5025e2680 Merge remote-tracking branch 'development' into test-cases-not-executed-enforce-development
Conflicts:
* framework: update to the head of 'main'.
2024-10-17 21:20:01 +02:00
David Horstmann
13d2939563
Merge pull request #9673 from eleuzi01/issue-54-fw
Move TLS auxiliary test scripts to the framework
2024-10-17 17:15:46 +00:00
Gilles Peskine
86421f3e87 Update framework to main
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-16 19:34:30 +02:00
Gilles Peskine
e1f37c58a2
Merge pull request #9566 from gilles-peskine-arm/error-codes-4.0-enforce-add-macro
Error codes: enforce add macro
2024-10-16 17:28:04 +00:00
Elena Uziunaite
8b6ee19890 Update submodule after the merge
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-10-16 14:59:32 +01:00
Gilles Peskine
4e4647a4e7
Merge pull request #9690 from valeriosetti/fix-pk-write-buffer-overrun
pkwrite: fix buffer overrun
2024-10-16 12:00:52 +00:00
Ronald Cron
51287b3be5
Merge pull request #9700 from ronald-cron-arm/test-psa-crypto-drivers
Enable PSA_CRYPTO_CONFIG in test_psa_crypto_drivers
2024-10-16 11:29:20 +00:00
Gilles Peskine
5255a9e805 Include "error.h" for MBEDTLS_ERROR_ADD
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-16 11:52:47 +02:00
Gilles Peskine
8085f51108 Use MBEDTLS_ERROR_ADD instead of explicit addition: enforcement
Reject direct additions of error constants (regex-based approximation).

Fix the lone straggler.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-16 11:52:27 +02:00
Gilles Peskine
ed6feae513 Use MBEDTLS_ERROR_ADD instead of explicit addition: simple cases
Replace obvious additions of an `MBEDTLS_ERR_xxx` constant by a call to
`MBEDTLS_ERROR_ADD`.

Skip `case` statements since `MBEDTLS_ERROR_ADD(pp_constant)` is not a
preprocessor constant.

This commit does not replace additions split over lines. Those will be
handled in a subsequent commit.

```
git ls-files '*.h' '*.c' '*.function' '*.data' |
xargs perl -i -pe '
    next if /\bcase\b/;
    s/\b(MBEDTLS_ERR_\w+)\s*\+\s*(\w+)\b/MBEDTLS_ERROR_ADD($1, $2)/g;
    s/\b(\w+)\s*\+\s*(MBEDTLS_ERR_\w+)\b/MBEDTLS_ERROR_ADD($1, $2)/g'
```

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-16 11:52:24 +02:00
Gilles Peskine
50d7579dd1 Temporarily comment out tests that are clogging the CI
The pk_write_pubkey_check sometimes take ~3 hours to run with
GCC+Asan on the CI in the full config. Comment out the slowest
ones while we investigate and release 3.6.2.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-16 10:48:56 +02:00
Ronald Cron
ede04b34d1 Remove unnecessary -O2 compilation flag
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-16 10:47:15 +02:00
Ronald Cron
6197cdf869 Fix comment
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-16 10:45:38 +02:00
Gilles Peskine
c76f82db27 Work around GCC 5 performance problem with Asan+UBSan and -O3
Old GCC versions hit a performance problem with test_suite_pkwrite
"Private keey write check EC" tests when building with Asan+UBSan
and -O3: those tests take more than 100x time than normal, with
test_suite_pkwrite taking >3h on the CI. Observed with GCC 5.4 on
Ubuntu 16.04 x86_64 and GCC 6.5 on Ubuntu 18.04 x86_64.
GCC 7.5 and above on Ubuntu 18.04 appear fine.

To avoid the performance problem, use -O2 instead of -O3 in then "Asan"
build type with GCC. It doesn't slow down much even with modern compiler
versions.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-16 10:31:29 +02:00
Gilles Peskine
604e4d99dd Fix completion mistake in changelog entry
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-16 10:31:28 +02:00
David Horstmann
a4415d992a Defer static keystore to 3.6.3
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-10-16 10:30:33 +02:00
Gilles Peskine
e298eeb739 Changelog entry for security fix
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-16 10:30:30 +02:00
Ronald Cron
360928af9d Pacify check_names.py
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-15 17:09:36 +02:00
Ronald Cron
a0afbfb2a4 Fix/Add documentation
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-15 17:09:36 +02:00
Ronald Cron
67cc6a73aa Use config_adjust_test_accelerators.h
Use config_adjust_test_accelerators.h
to adjust the configuration needed for
test_psa_crypto_drivers all.sh component
with PSA_CRYPTO_CONFIG enabled.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-15 17:09:36 +02:00
Ronald Cron
1520875247 config_adjust_test_accelerators.h: Error out if wrong usage
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-15 17:09:36 +02:00
Ronald Cron
e8a9258ff0 config_adjust_test_accelerators.h: Do not define PSA_CRYPTO_DRIVER_TEST
PSA_CRYPTO_DRIVER_TEST needs to be defined
upper in build_info.h sequence of definitions/
inclusions.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-15 17:09:36 +02:00
Ronald Cron
2b36f5f5ab config_adjust_test_accelerators.h: Do not error if PSA_CRYPTO_CONFIG is ON
That's the purpose of the changes, to have
PSA_CRYPTO_CONFIG enabled.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-15 17:09:36 +02:00
Ronald Cron
db11561352 Introduce config_adjust_test_accelerators.h
As we move to PSA_CRYPTO_CONFIG always on,
the way to configure the build with both
the builtin drivers and the transparent test
drivers (that are wrappers around the
builtin drivers) cannot be done through the
MBEDTLS_USER_CONFIG_FILE mechanism anymore.

With this mechanism and PSA_CRYPTO_CONFIG
enabled, the PSA_ACCEL_ macros are defined
before including config_adjust_legacy_from_psa.h
and the builtin implementations are removed.

Thus, we will rather define the PSA_ACCEL_
just after the inclusion of
config_adjust_legacy_from_psa.h through the
dedicated config_adjust_test_accelerators.h
header introduced by this commit.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-10-15 17:09:36 +02:00
Janos Follath
c1cb3dcc0f
Merge pull request #9597 from Harry-Ramsey/code-style-framework-submodule-support
Improve support for submodules in code_style.py
2024-10-15 14:18:16 +00:00
Elena Uziunaite
7f7036e470 Update submodule
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-10-15 12:31:00 +01:00
Elena Uziunaite
9669eeabcf Adjust file path for translate_ciphers.py
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-10-15 11:45:15 +01:00
Elena Uziunaite
b74c3eaf87 Adjust file path for generate_tls13_compat_tests.py
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-10-15 11:45:05 +01:00
Elena Uziunaite
09fee364a3 Adjust file path for generate_ssl_debug_helpers.py
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-10-15 11:43:51 +01:00
Elena Uziunaite
2df289290f Move some files to framework repository
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-10-15 11:41:39 +01:00
Ronald Cron
cb81d8086f
Merge pull request #9671 from Harry-Ramsey/duplicate-common-header-file-development
Refactor duplicate common header file
2024-10-15 06:05:07 +00:00
Valerio Setti
63348bed30 test_suite_pkwrite: extend coverage of wrong output buffer sizes in pk_write_check_common()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-14 09:44:06 +02:00
Harry Ramsey
fb6cea508f Remove duplicate mbedtls/build_info.h include
This commit removes duplicate includes for mbedtls/build_info.h where
the file already includes common.h.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-14 08:41:31 +01:00
Harry Ramsey
b81cd1af64 Update includes for generated files
This commit replaces the include of "common.h" with "ssl_misc.h" for
generated files.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-14 08:41:23 +01:00
Valerio Setti
91577020a2 pkwrite: fix buffer overrun
This commit fixes potential buffer overrun in:
- pk_write_rsa_der
- pk_write_ec_pubkey

In both functions, when dealing with opaque keys, there was no
check that the provided buffer was large enough to contain the
key being exported. This commit fixes this problem and it also
adds some testing in test_suite_pkwrite to trigger these checks.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-11 14:55:24 +02:00
Harry Ramsey
e8e23fb519 Include ssl_misc.h for additional SSL helper files
This commit replaces #include "common.h" in favour of #include
"ssl_misc.h".

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-11 12:21:30 +01:00
Harry Ramsey
4d432d6ea5 Remove mbedtls/build_info from pkcs7.c
This commit removes #include "mbedtls/buildinfo.h" from pkcs7.c as it is
not needed unlike other C modules.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-11 12:20:13 +01:00
Gilles Peskine
5e3ed3f8a0 Minor readability improvements
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-11 12:00:44 +02:00
Gilles Peskine
ec2278bdd4 Update framework like 3.6 backport
The framework change is not needed in development, but should be harmless.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-10 21:39:58 +02:00
Gilles Peskine
095561cca1 Switch outcome analysis to enforcing that all tests are executed
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-10 17:26:11 +02:00
Gilles Peskine
d9c40f538d We never test without the PSA client code.
Should we? To be decided later.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-10 17:26:11 +02:00
Gilles Peskine
24b03d8b72 Add ignore list for restartable ECDH in TLS
TLS only supports actual restartable ECDH with the legacy code that's going
away, not with the MBEDTLS_USE_PSA_CRYPTO code that's becoming the only
variant. This leaves a few test cases that validate restartable ECDH in TLS
as desirable, but not currently able to pass.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-10 17:26:11 +02:00
Gilles Peskine
2fd25bb2a5 Add ignore list entries for configurations that are not tested
For each ignore list entry, link to a GitHub issue for its resolution,
except for a few configurations which there is a good reason to leave
uncovered.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-10 17:26:11 +02:00
Gilles Peskine
b0ec85dcc6 Add ignore list entries for crypto tests that are not executed
For each ignore list entry, link to a GitHub issue for its resolution.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-10 17:26:11 +02:00
Gilles Peskine
de2316b8ea Add ignore list entries for TLS tests that are not executed
For each ignore list entry, link to a GitHub issue for its resolution,
except for ssl-opt Valgrind tests which we never intend to run on the CI.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-10 17:26:11 +02:00
Gilles Peskine
b061ecd4e8 Remove test case involving SECP224K1 in PSA
Our PSA crypto implementation does not and will not support SECP224K1.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-10 17:26:11 +02:00
Gilles Peskine
e3c64c3f26 Fix typo in dependency
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-10 17:26:11 +02:00
Gilles Peskine
ab5cc9bd30 In PSA generated tests, ignore patterns for which an issue has been raised
Ignore certain test cases which either should not be generated or should be
executed. For each ignore list entry, link to a GitHub issue whose
definition of done includes removing the entry.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-10 17:26:11 +02:00
Gilles Peskine
5872c0d4c0 In PSA generated tests, don't ignore not-implemented in some negative tests
Some negative tests involving unsupported mechanisms are executed, because
they're testing what happens if the mechanism is unsupported. Refine the
ignore list for `test_suite_psa_crypto_generate_key.generated` and
`test_suite_psa_crypto_op_fail.generated` accordingly.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-10 17:26:11 +02:00