31409 Commits

Author SHA1 Message Date
Valerio Setti
168d24a00d test: add new component to test MBEDTLS_PSA_STATIC_KEY_SLOTS
This commit also fixes related errors in test suites. In all
cases those failures are related to the use of raw keys whose
size cannot be determined a-priori.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 13:31:19 +02:00
Valerio Setti
8d4f15013f psa: allow to use static key buffers instead of dynamic ones
This helps reducing heap memory usage and, if heap memory is
not used anywhere else in an embedded device, it also reduces
code footprint since there is no need for heap management code
in this case.

A new build symbol is added for this purpose, named
MBEDTLS_PSA_STATIC_KEY_SLOTS. It's disabled by default so that
normal usage of Mbed TLS library is not affected.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 13:31:19 +02:00
Gilles Peskine
043f6dc0ff
Merge pull request #9680 from gilles-peskine-arm/test-cases-not-executed-enforce-3.6
Backport 3.6: Test cases not executed: switch to enforcement mode
2024-10-18 18:19:30 +00:00
Gilles Peskine
2d94866764 Merge remote-tracking branch 'mbedtls-3.6' into test-cases-not-executed-enforce-3.6
Conflicts:
* framework: update to the head of 'main'.
2024-10-17 21:20:56 +02:00
David Horstmann
e905442f7e
Merge pull request #9675 from eleuzi01/backport-9673
[Backport 3.6] Move TLS auxiliary test scripts to the framework
2024-10-17 17:18:57 +00:00
Gilles Peskine
6d268e3fe1 Update framework to main
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-16 19:33:59 +02:00
Elena Uziunaite
fcda6f1281 Update submodule after the merge
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-10-16 14:58:07 +01:00
Elena Uziunaite
5adc9c304b Add "common.h"
Needed after b81cd1af6418823a2b5ffbd3710ceac9b0e0afa4 (#9671)
since generate_ssl_debug_helpers.py was moved to the framework

Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-10-15 16:58:16 +01:00
Janos Follath
7ea648f58a
Merge pull request #9696 from Harry-Ramsey/code-style-framework-submodule-support-3.6
[Backport 3.6] Improve support for submodules in code_style.py
2024-10-15 14:18:12 +00:00
David Horstmann
78542bf85d
Merge pull request #9698 from gilles-peskine-arm/3.6.2-rc2-mergeback-3
Merge 3.6.2 into 3.6 (updated cmake gcc+Asan build flags)
2024-10-15 14:00:21 +00:00
Elena Uziunaite
5446fc1605 Update submodule
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-10-15 12:41:42 +01:00
Elena Uziunaite
a739542327 Adjust file path for translate_ciphers.py
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-10-15 12:41:42 +01:00
Elena Uziunaite
1d8a2257d8 Adjust file path for generate_tls13_compat_tests.py
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-10-15 12:41:42 +01:00
Elena Uziunaite
7f5ec13a12 Adjust file path for generate_ssl_debug_helpers.py
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-10-15 12:41:42 +01:00
Elena Uziunaite
6f4ec30bd1 Move some files to framework repository
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-10-15 12:41:12 +01:00
Gilles Peskine
6864fa9b3b Declare a generated file that was added after 3.6.1
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-15 12:06:18 +02:00
David Horstmann
bfb9f71fa3 Revert "Add generated files"
This reverts commit 0d1117692ee261d6d89e2819a742c64e06e5bd42.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-10-15 12:06:18 +02:00
Gilles Peskine
bac001f62e 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-15 12:06:18 +02:00
Gilles Peskine
765da156bd 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-15 12:06:00 +02:00
Harry Ramsey
5098d0474a Improve support for submodules in code_style.py
This commit improves support for submodules within code_style.py. A new
function get_submodule_hash retrieves the submodule hash at the time of
a commit allowing an appropriate diff to be seen.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-10-14 14:58:36 +01:00
Gilles Peskine
107ea89daa Fix completion mistake in changelog entry
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
v3.6.2 mbedtls-3.6.2
2024-10-14 11:34:18 +02:00
David Horstmann
93d421e751 Defer static keystore to 3.6.3
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-10-14 11:08:07 +02:00
David Horstmann
9e1201130f Update BRANCHES.md
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-10-14 11:08:01 +02:00
Gilles Peskine
a712d8dda5 Bump version to 3.6.2
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-14 11:04:31 +02:00
Gilles Peskine
453fd05333 Changelog entry for security fix
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-14 11:03:24 +02:00
Valerio Setti
3b9f4bec3f 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 10:37:01 +02:00
Valerio Setti
5f1c8a720f 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-14 10:37:00 +02:00
Gilles Peskine
1abc800adc Minor readability improvements
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-11 12:00:57 +02:00
Gilles Peskine
ccd1440c48 Remove ignore list entries that don't apply in 3.6
In 3.6, compared with the state of development that this work was based on,
we're doing more testing with TLS12_PRF and TLS12_PSK_TO_MS disabled, thanks
to some configurations with MBEDTLS_PSA_CRYPTO_CONFIG disabled.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-11 10:02:59 +02:00
Gilles Peskine
8f886456f9 framework: Fix overly lenient config tests for PSA_WANT_xxx
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-10 21:39:18 +02:00
Gilles Peskine
4e606db7c2 Switch outcome analysis to enforcing that all tests are executed
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-10 18:35:58 +02:00
Gilles Peskine
44fdd9293c Add ALT-adjacent config option to the test coverage ignore list
MBEDTLS_ECP_NO_FALLBACK is only relevant when an ALT implementation of ECP
is used. We don't test ALT implementations so we don't test
MBEDTLS_ECP_NO_FALLBACK either.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-10 18:19:23 +02:00
Gilles Peskine
3b427c72be Add missing algorithm in the test driver configuration
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-10 18:18:45 +02:00
Gilles Peskine
47243fd88f 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 18:02:47 +02:00
Gilles Peskine
1a17627a33 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 18:02:32 +02:00
Gilles Peskine
419a5841a4 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 18:02:12 +02:00
Gilles Peskine
f7784160e6 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 18:01:42 +02:00
Gilles Peskine
1fac371ebe 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:58:26 +02:00
Gilles Peskine
72396da267 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:58:21 +02:00
Gilles Peskine
d8da2fcc7a In PSA generated tests, ignore mechanisms that are not implemented
This clears more than half of the test cases that are not executed.
This also captures a few negative test cases that are executed.
Subsequent commits will refine the filtering.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-10 17:58:16 +02:00
Tom Cosgrove
d7408a69fc
Merge pull request #9679 from gergelykarm/mbedtls-3.6
Backport 3.6: Fix driver schema json default type requirements
2024-10-10 13:53:09 +00:00
Gilles Peskine
1171697235
Merge pull request #9669 from gilles-peskine-arm/analyze_outcome-split-3.6
Backport 3.6: Split check_test_cases.py and outcome_analysis.py
2024-10-10 12:23:50 +00:00
Gergely Korcsák
36b0521b5f Fix driver schema json default type requirements
Signed-off-by: Gergely Korcsák <gergely.korcsak@arm.com>
2024-10-10 13:15:01 +02:00
Gilles Peskine
0cf1bf4851 Update framework to the branch with collect_test_cases.py and outcome_analysis.py
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-10 10:01:00 +02:00
Gilles Peskine
5d633ff745 Default to allowing partial test coverage
Currently, many test cases are not executed. A follow-up pull request will
take care of that. In the meantime, continue allowing partial test coverage.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-09 14:19:31 +02:00
Gilles Peskine
e816f1ef49 Downgrade mypy to a version that works with our code base
mypy >=0.960 rejects macro_collector.py.
https://github.com/Mbed-TLS/mbedtls-framework/issues/50

We currently need mypy >=0.940, <0.960. Pick 0.942, which works, and is the
system version on Ubuntu 22.04.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-09 14:19:31 +02:00
Gilles Peskine
309051dc25 Upgrade mypy to the last version supporting Python 3.6
Upgrade mypy to 0.971, which is the last version that supports Python 3.6
(the oldest Python version that we currently run on the CI).

This fixes the error
```
framework/scripts/mbedtls_framework/outcome_analysis.py:119: error: Incompatible return value type (got "IO[Any]", expected "TextIO")
framework/scripts/mbedtls_framework/outcome_analysis.py:121: error: Incompatible return value type (got "IO[Any]", expected "TextIO")
```
As far as I can tell the fix is https://github.com/python/mypy/pull/9275
which was released in mypy 0.940.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-09 14:19:31 +02:00
Gilles Peskine
8981203aaa Move test case analysis modules to framework repository
Move `collect_test_cases.py` (split from `check_test_cases.py`),
`check_test_cases.py`, and `outcome_analysis.py` (split from
`analyze_outcomes.py`) to the framework repository.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-09 14:19:31 +02:00
Gilles Peskine
738a597953 Adjust paths for impending moves to the framework
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-09 14:19:31 +02:00
Manuel Pégourié-Gonnard
8536c3c792
Merge pull request #9161 from mpg/doc-guards
[3.6 only] Document transitional feature macros / guards
2024-10-09 10:30:50 +00:00