11541 Commits

Author SHA1 Message Date
Manuel Pégourié-Gonnard
3eac5080fe all.sh: adjust for when tf-psa-crypto is absent
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-16 10:47:07 +02:00
Manuel Pégourié-Gonnard
96bfc17be1 all.sh: re-instate 3.6-specific code
Reverts "all.sh: temporary alignment with development"

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-16 10:38:55 +02:00
Manuel Pégourié-Gonnard
41ba526f99 all.sh: update documentation
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-16 10:24:43 +02:00
Manuel Pégourié-Gonnard
5d221de68c all.sh: move top-level code to a function
Now the output of
    grep '^[^ {}#]' tests/scripts/all-*.sh | grep -v '()'
is clean, with the only results being:
- shopt -s extglob which is needing for parsing the rest
- usage message

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-16 10:24:42 +02:00
Manuel Pégourié-Gonnard
327edec3c2 all.sh: document new file structure
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-16 10:24:42 +02:00
Manuel Pégourié-Gonnard
535e8aa1d3 all.sh: move definitions to all-core.sh
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-16 10:24:42 +02:00
Manuel Pégourié-Gonnard
2969280bc5 all.sh: wrap main code into main() function
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-16 10:24:41 +02:00
Manuel Pégourié-Gonnard
23fa1b5edf all.sh: move clang_version() to helpers file
This function is only used in (a few) components, it's not part of the core.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-16 10:24:41 +02:00
Manuel Pégourié-Gonnard
36ae06b842 all.sh: move component helpers to separate file
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-16 10:24:40 +02:00
Manuel Pégourié-Gonnard
03ad80ce97 all.sh: Move some functions to the right section
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-16 10:24:40 +02:00
Manuel Pégourié-Gonnard
452db6050b all.sh: rename a helper function
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-16 10:24:40 +02:00
Manuel Pégourié-Gonnard
6fb63b0ad6 all.sh: extract repeated code to a function
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-16 10:24:39 +02:00
Manuel Pégourié-Gonnard
9a132e2a9f all.sh: group psasim helpers
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-16 10:24:39 +02:00
Manuel Pégourié-Gonnard
cd1148d43a all.sh: rm obsolete functions
The only occurrences found by git grep were the definitions and the
comment saying these are kept for backwards compatibility.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-16 10:24:39 +02:00
Manuel Pégourié-Gonnard
2c3a6241ed all.sh: first define functions, then call them.
Don't interleave defining functions with running some code.

The only exception is calling shopt, which needs to come first as it
affects how the following function definitions are parsed.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-16 10:24:38 +02:00
Manuel Pégourié-Gonnard
86c483876c all.sh: temporary alignment with development
This change is not correct for 3.6 and will be reverted. It is only
applied as a temporary measure to avoid conflicts while cherry-pick
changes from development.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-16 10:23:41 +02:00
Manuel Pégourié-Gonnard
8535f4c158 all.sh: align-dev: PSAsim functions
Again, useless but harmless for 3.6.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-16 10:19:39 +02:00
Manuel Pégourié-Gonnard
6c0c0f20d0 all.sh: align-dev: tf-psa-crypto stuff
For 3.6 this is useless but should be harmless.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-16 10:19:38 +02:00
Manuel Pégourié-Gonnard
7955091b17 all.sh: align-dev: move functions to the right place
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-16 10:09:08 +02:00
Manuel Pégourié-Gonnard
c97413463a all.sh: align with development: whitespace
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-10-16 10:08:15 +02: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
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
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