mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
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>
This commit is contained in:
@ -111,7 +111,12 @@ class Information:
|
||||
|
||||
|
||||
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 @@ class TestCase(test_case.TestCase):
|
||||
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.
|
||||
|
Reference in New Issue
Block a user