1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-04-26 15:08:51 +03:00

9 Commits

Author SHA1 Message Date
Gilles Peskine
764c2d3013 PSA test case generation: dependency inference class: operation fail
Use psa_information.TestCase for operation failure test cases.

This changes the generated output in two ways:

* Not-implemented mechanisms now have a `DEPENDENCY_NOT_IMPLEMENTED_YET_xxx`
  dependency in addition to the never-fulfilled `PSA_WANT_xxx` dependency.
  This does not affect when test cases run.
* ECC test cases now have correct dependency symbols, e.g.
  `PSA_WANT_ECC_SECP_R1_192` instead of `PSA_WANT_ECC_FAMILY_SECP_R1`. This
  is a bug fix: ECC test cases were formerly never executed because of
  incorrect dependency symbols.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-11 22:00:54 +02:00
Gilles Peskine
1ae57ec203 PSA test case generation: dependency inference class: key not supported
Use psa_information.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>
2024-04-11 22:00:54 +02:00
Gilles Peskine
d3286af1b7 hack_dependencies_not_implemented: apply to positive test cases
In automatically generated PSA test cases, annotate the test cases that are
expected to be never executed due to a dependency that is not implemented.
This was already done for not-supported test cases and for key generation,
but not for positive test cases of key usage.

You can audit which mechanisms are detected as not-implemented with
```
grep -hEo 'DEPENDENCY_NOT_IMPLEMENTED_YET_\w+' tests/suites/*.data | sort -u
```

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-11 22:00:54 +02:00
Gilles Peskine
c113b42fc1 hack_dependencies_not_implemented: Also read inferred PSA_WANT symbols
To determine PSA mechanisms that are not implemented, also read PSA_WANT
symbols that cannot (or are not intended to) be configured independently,
and thus are not listed in psa/crypto_config.h. Find those symbols in
the config adjustment header mbedtls/config_psa.h.

No impact on generated files yet, because hack_dependencies_not_implemented
is currently only used on key types that have explicit dependencies. This
will allow using hack_dependencies_not_implemented in other places, for
example to handle algorithm variants like PSA_WANT_ALG_ECDSA_ANY which is
inferred from PSA_WANT_ALG_ECDSA.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-11 22:00:54 +02:00
Gilles Peskine
c7b58d53fc PSA test case generation: dependency inference class: base case
Create a class for test cases with automatically inferred dependencies,
suitable for PSA crypto API test cases. As of this commit, only basic cases
that use a key are supported. Subsequent commits will address negative tests
and key generation tests that require fancier handling of dependencies.

No change to the generated output.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-11 22:00:54 +02:00
Gilles Peskine
c3b261a4fc Sort dependencies in automatically generated PSA test cases
The output is less nice, since it no longer mostly matches the order in
which symbols are used in the test case arguments. But this makes the output
more canonical, so it will be easier to notice if semantic changes occur in
subsequent commits.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-11 22:00:54 +02:00
Gilles Peskine
c6fe12a155 hack_dependencies_not_implemented: more verbose indication
Indicate which dependencies are not implemented. This makes it feasible to
audit the not-implemented detection.

The generated test cases that are detected as never-executed now have one or
more `DEPENDENCY_NOT_IMPLEMENTED_YET_PSA_WANT_xxx` instead of a single
`DEPENDENCY_NOT_IMPLEMENTED`. This does not affect when the test cases run.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-11 22:00:54 +02:00
Tomás González
5fae560b4a Update new license headers
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-11-13 11:45:12 +00:00
Tomás González
734d22c03e Move PSA information and dependency automation into their own module
This will let us use these features from other modules (yet to be created).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-10-31 09:31:20 +00:00