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>
diff --git a/scripts/mbedtls_dev/psa_information.py b/scripts/mbedtls_dev/psa_information.py
index 1474657..7f38465 100644
--- a/scripts/mbedtls_dev/psa_information.py
+++ b/scripts/mbedtls_dev/psa_information.py
@@ -111,7 +111,12 @@
class TestCase(test_case.TestCase):
- """A PSA test case with automatically inferred dependencies."""
+ """A PSA test case with automatically inferred dependencies.
+
+ For mechanisms like ECC curves where the support status includes
+ the key bit-size, this class assumes that only one bit-size is
+ involved in a given test case.
+ """
def __init__(self) -> None:
super().__init__()
@@ -124,12 +129,13 @@
Call this function before set_arguments() for a test case that should
run if the given mechanism is not supported.
- A mechanism is a PSA_XXX symbol, e.g. PSA_KEY_TYPE_AES, PSA_ALG_HMAC,
- etc. For mechanisms like ECC curves where the support status includes
- the key bit-size, this class assumes that only one bit-size is
- involved in a given test case.
+ A mechanism is either a PSA_XXX symbol (e.g. PSA_KEY_TYPE_AES,
+ PSA_ALG_HMAC, etc.) or a PSA_WANT_XXX symbol.
"""
- self.negated_dependencies.add(psa_want_symbol(name))
+ symbol = name
+ if not symbol.startswith('PSA_WANT_'):
+ symbol = psa_want_symbol(name)
+ self.negated_dependencies.add(symbol)
def set_key_bits(self, key_bits: Optional[int]) -> None:
"""Use the given key size for automatic dependency generation.