Commit Graph

1900 Commits

Author SHA1 Message Date
Gilles Peskine 8296a73ce0 Merge pull request #104 from gilles-peskine-arm/psa-storage-test-cases-never-supported-negative-framework
Switch generate_psa_test.py to automatic dependencies for negative test cases
2025-01-20 15:53:01 +01:00
Harry Ramsey 049270ef92 Enable collect_test_cases.py to work for TF-PSA-Crypto
This commit adapts collect_test_cases.py to work for Mbed TLS and
TF-PSA-Crypto.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2025-01-17 13:31:05 +00:00
Gilles Peskine 89cc06d8ce Merge remote-tracking branch 'main' into psa-storage-test-cases-never-supported-negative-framework 2025-01-16 19:54:39 +01:00
Ronald Cron 40f125f6df Merge pull request #124 from ronald-cron-arm/framework-ci-3.6-fix
Fix framework CI against mbedtls-3.6
2025-01-15 14:39:16 +01:00
Harry Ramsey 024ec9ee85 Update license exemption list
As TF-PSA-Crypto is now a seperate repository, the license does not need
to be checked alongside Mbed TLS and instead has a seperate check.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2025-01-15 09:16:08 +00:00
Harry Ramsey f828f9c15e Enable check_files.py for TF-PSA-Crypto
This commit enables check_files.py to run for Mbed TLS and
TF-PSA-Crypto.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2025-01-15 09:16:08 +00:00
Ronald Cron d67433304b Remove now unnecessary os imports
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2025-01-15 09:00:17 +01:00
Ronald Cron ee33e9f3ad Improve condition for seedfile in tf-psa-crypto
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2025-01-14 20:24:00 +01:00
Ronald Cron 7e215c8903 Improve branch checks based on tf-psa-crypto directory
Use build_tree module instead.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2025-01-14 16:23:08 +01:00
Ronald Cron 57ee691a3e Merge pull request #116 from valeriosetti/issue101-framework
Move pkgconfig.sh to the framework
2025-01-14 09:42:55 +01:00
Ronald Cron 71171b77f5 Merge pull request #105 from valeriosetti/issue86-framework
Move most of min_requirements.py to the framework
2025-01-13 10:02:13 +01:00
Valerio Setti a84269f2f8 scripts: min_requirements.py: small changes to work as module
- prevent the file from being called directly from the command line;
- allow to pass in the default requirement file so that each repo
  can specify its own version.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2025-01-13 05:36:30 +01:00
Gilles Peskine 8141968693 Fix edge case with half-supported ECDSA: automatic test cases
ECDSA has two variants: deterministic (PSA_ALG_DETERMINISTIC_ECDSA) and
randomized (PSA_ALG_ECDSA). The two variants are different for signature but
identical for verification. Mbed TLS accepts either variant as the algorithm
parameter for verification even when only the other variant is supported,
so we need to handle this as a special case when generating not-supported
test cases.

In this commit, suppress generated test cases for operation failures due to
unsupported ECDSA when exactly one of the two ECDSA variants is supported.
This edge case will only be tested manually (done in mbedtls or
TF-PSA-Crypto in the commit
"Fix edge case with half-supported ECDSA (manual test cases)").

Changes to the generated output: in
`test_suite_psa_crypto_op_fail.generated.data`, wherever one of
`!PSA_WANT_ALG_DETERMINISTIC_ECDSA` or `!PSA_WANT_ALG_ECDSA` appears as a
dependency, add the other one.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-01-09 18:24:59 +01:00
Gilles Peskine 78e4c8a73b PSA test case generation: operation fail: simplify NOT_SUPPORTED
In `generate_psa_tests.py, `OpFail.make_test_case()` is only ever used with
a single mechanism being not supported. Take advantage of that to simplify
parts of the function. Call `psa_test_case.TestCase.assumes_not_supported()`
instead of partly reinventing that wheel.

No change to the generated output.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-01-09 18:24:59 +01:00
Gilles Peskine bc6f8ac304 PSA test case generation: operation fail: skip never-implemented mechanisms
In `OpFail` test cases, remove the temporary hack whereby test cases were
not skipped when they should be due to a mechanism being never implemented.

This changes many test cases in
`test_suite_psa_crypto_op_fail.generated.data` to be commented out with a
"skipped because" reason instead of having a dependency on an algorithm or
an ECC/DH group that is not implemented.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-01-09 18:24:59 +01:00
Gilles Peskine fd0130576c Do run not-supported test cases on not-implemented mechanisms
In automatically generated PSA test cases with automatically inferred
dependencies, we were systematically skipping test cases when a dependency
mentions a mechanism that is not supported, even when that dependency is
negated. Fix this.

This causes more not-supported test cases to run.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-01-09 18:24:59 +01:00
Gilles Peskine 58cf9e90b8 PSA test case generation: operation fail: dependency inference class
Use the automatic dependency generation mechanism from
`psa_test_case.TestCase` for operation failure test cases. But tweak them
explicitly to preserve the same set of (not-quite-right) dependencies, to
facilitate understanding and reviewing how the current series of commits
gradually changes the generated dependencies.

No changes to the generated output.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-01-09 18:24:59 +01:00
Gilles Peskine 96da26ec65 PSA test case generation: operation fail: fix family dependencies
In operation failure test cases, fix dependencies on DH or ECC groups, which
were not spelled correctly and were missing the size suffix.

This changes the dependencies of many test cases in
`test_suite_psa_crypto_op_fail.generated.data` to no longer have a
never-implemented symbol as a dependency. Thus more test cases will run.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-01-09 18:24:59 +01:00
Gilles Peskine 91a3626ab7 PSA test case generation: dependency inference class: key not supported
In `psa_test_case.TestCase`, add a method `assumes_not_supported` which
allows using the automatic dependency calculation framework when the test
case intends to run in configurations where one mechanism is not supported.

Use `psa_test_case.TestCase` for not-supported test cases for key import and
generation.

No change to the generated output.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-01-09 18:24:59 +01:00
Gilles Peskine 5dcf16ad7b Be more precise about key pair usage dependencies
Don't always require all of BASIC, IMPORT and EXPORT.

BASIC is always implied by any of the creation methods.

* `KeyTypeNotSupported`: only does an IMPORT (or GENERATE) attempt. EXPORT is
  not needed. This reduces dependencies in
  `test_suite_psa_crypto_not_supported.generated.data`.
* `OpFail`: only does an IMPORT, followed by a BASIC attempt. EXPORT is not
  needed. This reduces dependencies in
  `test_suite_psa_crypto_op_fail.generated.data`.
* `StorageFormat`: only does an IMPORT for save (forward compatibility)
  tests, and only does an EXPORT for read (backward compatibility) tests.
  This reduces dependencies in
  `test_suite_psa_crypto_storage_format.current.data` and
  `test_suite_psa_crypto_storage_format.v0.data` respectively.

Positive test cases that create and exercise a key are still potentially
missing BASIC (which is implied) and EXPORT (which isn't) for exercising the
key, but this is out of scope of this commit.

The generated output has fewer test case dependencies as described above,
with BASIC+IMPORT+EXPORT replaced by only one of IMPORT or EXPORT. Since we
never test partial support for a key type with import or export disabled,
this doesn't change which test cases are executed in each tested
configuration.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-01-09 18:24:59 +01:00
Gilles Peskine 8c23ac8520 Be more explicit about key pair usage dependencies
Make the code that generates the test case be explicit about which usage(s)
will be needed for key pairs (`PSA_WANT_KEY_TYPE_xxx_KEY_PAIR_uuu`). Allow
more than one usage specifier.

Do not systematically generalize BASIC to also include IMPORT and EXPORT:
not all tests actually need this, and our test configurations don't try to
have BASIC without IMPORT and EXPORT at the moment because we don't track
those dependencies accurately in manually written tests anyway.

Fix a bug whereby any usage other than BASIC or GENERATE led to the
dependency being silently dropped.

No change to the generated output.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2025-01-09 18:24:59 +01:00
Ronald Cron fe852d3b9a Merge pull request #103 from valeriosetti/issue73-framework
Move tests/scripts/check_names.py to the framework
2025-01-09 16:27:38 +01:00
Valerio Setti 9753be6373 Merge branch 'tmp-branch-move-files-to-framework' into issue101-framework 2025-01-09 14:21:31 +01:00
Valerio Setti 98fe7eebd2 Move files into the framework
The following files are added (imported) from the main Mbed TLS repo:

scripts/pkgconfig.sh

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-01-09 14:21:26 +01:00
Valerio Setti ee3cbf56a1 doxygen.sh: use relative script's path to call apidoc_full.sh
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2025-01-08 09:58:04 +01:00
Valerio Setti 1b2dd2d069 scripts: fix paths in files moved from Mbed TLS
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2025-01-08 09:58:04 +01:00
Valerio Setti 8bf041ff30 Merge branch 'tmp-branch-move-files-to-framework' into issue69-framework 2025-01-08 09:51:06 +01:00
Valerio Setti cb333f24f0 Move files out of Mbed TLS
The following files are moved to the framework repo (deleted here):

scripts/assemble_changelog.py
tests/scripts/check-doxy-blocks.pl
tests/scripts/check-python-files.sh
tests/scripts/doxygen.sh
scripts/apidoc_full.sh
tests/scripts/recursion.pl

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-01-08 09:51:04 +01:00
Valerio Setti 965b829b54 Move files into the framework
The following files are added (imported) from the main Mbed TLS repo:

scripts/assemble_changelog.py
scripts/check-doxy-blocks.pl
scripts/check-python-files.sh
scripts/doxygen.sh
scripts/apidoc_full.sh
scripts/recursion.pl

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2025-01-08 09:51:01 +01:00
Ronald Cron 81dfe001e1 Merge pull request #77 from Harry-Ramsey/tf-psa-crypto-out-of-source-development
Add out of source build functions for TF-PSA-Crypto
2025-01-06 15:13:55 +01:00
David Horstmann 3dd86cd845 Merge pull request #9777 from hughsie/hughsie/sbom
Add a SBOM file in CycloneDX format
2025-01-06 11:51:34 +00:00
David Horstmann 9e0557f290 Merge pull request #88 from hughsie/hughsie/sbom
Add a SBOM template in CycloneDX format
2025-01-06 11:51:29 +00:00
Harry Ramsey f3044f8d98 Remove duplicate Mbed TLS Framework variable
This commit removes a duplicate variable MBEDTLS_FRAMEWORK_ROOT_DIR as
it is now previously defined as FRAMEWORK.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-12-24 14:25:04 +00:00
Harry Ramsey 008445c193 Use absolute out of source build path
This commit replaces the relative Mbed TLS out of source build path with
a more generic named absolute out of source build path for both Mbed TLS
and TF-PSA-Crypto.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-12-24 14:25:03 +00:00
Harry Ramsey e11462c606 Remove directory change as commands run in subshells
This commit removes unnecessary directory changes as the commands for
components run in subshells which do not affect the main scripts
directory.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-12-24 14:25:03 +00:00
Harry Ramsey 4c73fc89e9 Revert changing directory to out of source dir
This commit reverts changing the directory to the out of source
directory, enabling tests which require source code to run. Tests that
require building TF-PSA-Crypto will have to change directory to
OUT_OF_SOURCE_DIR.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-12-24 14:25:03 +00:00
Harry Ramsey 9794a45d2b Add variable for Mbed TLS-Framework directory
This commit adds a variable for locating Mbed TLS framework which is
used to run multiple test scripts between Mbed TLS and TF-PSA-Crypto.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-12-24 14:25:03 +00:00
Harry Ramsey 4c9361bb31 Fix out of source directory checks
This commit fixes out of source directory builds, where
in_tf_psa_crypto_repo would fail due to project_name.txt not existing.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-12-24 14:25:03 +00:00
Harry Ramsey b435d12995 Add MBEDTLS_ROOT_DIR variable
This commit adds MBEDTLS_ROOT_DIR as a variable to the bash script. This
will be used in later commits when migrating to an independent
TF-PSA-Crypto testing suite.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-12-24 14:25:03 +00:00
Harry Ramsey 974b4137cf Add out of source build functions for TF-PSA-Crypto
This commit adds helper functions to build TF-PSA-Crypto out of source
using CMake.

Signed-off-by: Harry Ramsey <harry.ramsey@arm.com>
2024-12-24 14:25:03 +00:00
minosgalanakis 2db68049e1 Merge pull request #96 from Mbed-TLS/issue-39-follow-up
Undo temporary changes in all-helpers.sh
2024-12-20 11:04:56 +00:00
Janos Follath 4e3d7d86ac Merge pull request #83 from Mbed-TLS/dev/gilles-peskine-arm/psa-storage-test-cases-never-supported-positive-framework
Switch generate_psa_test.py to automatic dependencies for positive test cases
2024-12-20 08:05:31 +00:00
Elena Uziunaite 5d6cb59236 Add a clarifying comment
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-12-19 20:34:57 +02:00
Elena Uziunaite 4b3172f1d1 Undo temporary changes in all-helpers.sh
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-12-19 20:34:57 +02:00
Valerio Setti 37f923f9b7 Merge branch 'tmp-branch-move-files-to-framework' into issue86-framework 2024-12-19 12:17:05 +01:00
Valerio Setti 8e88f34e38 Move files into the framework
The following files are added (imported) from the main Mbed TLS repo:

scripts/mbedtls_framework/min_requirements.py

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-12-19 12:17:00 +01:00
Elena Uziunaite 8717da59ea Make the script work in both branches
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-12-19 10:39:45 +02:00
Elena Uziunaite fd62e1ec00 Merge branch 'tmp-branch-move-files-to-framework' into issue-72 2024-12-19 10:39:32 +02:00
Elena Uziunaite 2b4c90e8c9 Move files into the framework
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-12-19 10:39:24 +02:00
Ronald Cron 3016d84408 Merge pull request #9836 from eleuzi01/issue-70-fw
Move scripts/code_style.py to the framework
2024-12-18 17:21:34 +00:00