31373 Commits

Author SHA1 Message Date
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
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
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
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
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
Manuel Pégourié-Gonnard
711d583583
Merge pull request #9655 from gilles-peskine-arm/dtls_server-allow_unexpected_message_on_second_handshake-3.6
Backport 3.6: dtls_server: allow unexpected message on second handshake
2024-10-02 10:36:12 +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
188325f152 Allow running pylint and mypy on a single file
Fix `mypy scripts/xxx.py`, `mypy tests/scripts/xxx.py`,
`pylint scripts/xxx.py`, `pylint tests/scripts/xxx.py`
failing to find `mbedtls_framework`.

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
Gilles Peskine
62163142a0 dtls_server: allow unexpected messages during handshake
If MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE happens during the handshake, don't
show it as an "error". It might be an error, but it might also be a fact of
life if it happens during the second or more handshake: it can be a
duplicated packet or a close_notify alert from the previous connection,
which is hard to avoid and harmless.

Fixes #9652.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-10-01 12:50:05 +02:00
Ronald Cron
cab2318c77
Merge pull request #9640 from eleuzi01/mbedtls-3.6
[Backport 3.6] Remove definitions of legacy symbols
2024-10-01 10:32:49 +00:00
Elena Uziunaite
9204c2b893 Update submodule
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-09-30 14:53:24 +01:00
David Horstmann
55b43e5cfb
Merge pull request #9541 from gilles-peskine-arm/ssl-opt-sample-programs-3.6
Backport 3.6: test sample programs in ssl-opt.sh
2024-09-26 14:33:13 +00:00
Elena Uziunaite
12cb9c2cda Update submodule to the head of framework PR
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-09-26 15:24:33 +01:00
Manuel Pégourié-Gonnard
d93161f366
Merge pull request #9637 from gilles-peskine-arm/config-full-booleans-only-3.6
Backport 3.6: config.py: don't rely on section names
2024-09-26 10:04:06 +00:00
Manuel Pégourié-Gonnard
9fc3b7d243 Expand on block cipher modes/derivatives
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-09-26 11:00:02 +02:00
Gilles Peskine
fa1d84e102 Update framework to the main branch
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-09-26 10:18:36 +02:00
Manuel Pégourié-Gonnard
83f62ffc09 Expand on key derivations
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-09-26 10:14:55 +02:00
Manuel Pégourié-Gonnard
60769762d2 Clarify the superset rule
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-09-26 09:57:22 +02:00
Manuel Pégourié-Gonnard
4ceb71f53d Update and refine notes on restartable ECC and 4.0
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-09-26 09:45:45 +02:00