11591 Commits

Author SHA1 Message Date
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
a712d8dda5 Bump version to 3.6.2
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-14 11:04:31 +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
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
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
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
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
Gilles Peskine
45a32b1549 Separate code and data of outcome analysis
Place the code of outcome analysis (auxiliary functions, tasks, command line
entry point) into a separate module, which will be moved to the
version-independent framework repository so that it can be shared between
maintained branches. Keep the branch-specific list of driver components and
ignore lists in the per-repository script.

We keep the executable script at `tests/scripts/analyze_outcomes.py`. It's
simpler that way, because that path is hard-coded in CI scripts.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-03 19:13:18 +02:00
Gilles Peskine
39f5d796ae Pass KNOWN_TASKS as an argument to main
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-03 19:13:18 +02:00
Gilles Peskine
4d557d8b76 Typecheck main
Always have tasks_list be a list, not potentially some fancier iterable.

Bypass mypy's somewhat legitimate complaint about REFERENCE and DRIVER in
task_class: they could potentially be instance attributes, but we rely on
them being class attributes. Python does normally guarantee their existence
as class attributes (unless a derived class explicitly deletes them), but
they could be overridden by an instance attribute; that's just something
we don't do, so the class attribute's value is legitimate. We can't
expect mypy to know that, so work around its complaint.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-03 19:13:18 +02:00
Gilles Peskine
c2df8d4e9b Don't reuse a variable name inside a function
Use different names for task name, a task class and a task instance. The
interpreter doesn't care, but it's less confusing for both humans and type
checkers.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-03 19:13:18 +02:00
Gilles Peskine
40a98a4b64 Missing NotImplementedError in abstract method
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-03 19:13:18 +02:00
Gilles Peskine
38de3e5de1 Remove sample ignore list elements for coverage
The ignore list for coverage only has two test cases out of ~10000 that are
currently reported as not executed. This is a drop in the sea and not
useful. Remove them so that the class can be used generically. A follow-up
will construct a comprehensive ignore list.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-03 19:13:18 +02:00
Gilles Peskine
efe084b2ee Create a module to split branch-independent code out of analyze_outcomes.py
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-03 19:13:18 +02:00
Gilles Peskine
eba00974d6 Split test case collection from checks
Move the test case collection code out of check_test_cases.py and into its
own module. This allows outcome analysis to depend only on the new module
and not on check_test_cases.py.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-03 19:13:18 +02:00
Gilles Peskine
31e31523ad Create a module to split test case collection from checks
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-03 19:13:18 +02:00
Gilles Peskine
13985566e7 check_test_cases.py: make 3.6 identical with development
To prepare for the move of check_test_cases.py to the version-independent
framework repository, make the file in mbedtls-3.6 identical to the file
in development.

In development, check_test_cases.py now looks for tests under tf-psa-crypto.
This is useless but harmless in mbedtls-3.6.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-03 19:11:27 +02:00
Gilles Peskine
c3ef0c78e8
Merge pull request #9659 from gilles-peskine-arm/analyze_outcomes-classes-3.6
Backport 3.6: analyze_outcomes.py refactoring: change stringly typed data to classes
2024-10-03 10:38:06 +00:00
Gilles Peskine
e9603cb00f Don't use the "allow list" terminology any longer
What was formerly called an allow list is now an ignore table.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
7960b7661a Switch coverage analysis to IGNORE_TESTS for its allowlist
No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
5ef96c6809 Simplify sub-test-suite handling in is_test_case_ignored
No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
9b7cdd91dc Move test case ignore list to the master Task class
No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
0a7d96d266 Remove now-useless level of method call indirection
No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
95b2b0c160 Move analysis functions into their respective classes
No intended behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
0e5e57b34c Remove dead code that was handling stringly typed data
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 19:32:55 +02:00
Gilles Peskine
92cc8dba27 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-10-01 19:32:55 +02:00
Gilles Peskine
17e071b0ab 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-10-01 19:32:55 +02:00
Gilles Peskine
0316f1006c 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-10-01 19:32:55 +02:00
Gilles Peskine
00ed057738 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-10-01 19:32:55 +02:00
Gilles Peskine
6f8ff55884 Remove "error" allowance in dtls_server
Now that dtls_server doesn't print "error" when it receives stray messages
while it's waiting for a second handshake, have the tests fail if "error" is
printed for some other reason.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 12:50:13 +02:00