Add test case generation for usage extensions when loading keys

Add test cases validating that if a stored key only had the hash policy,
then after loading it psa_get_key_attributes reports that it also has the
message policy, and the key can be used with message functions.

Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
This commit is contained in:
gabor-mezei-arm 2021-06-24 10:16:44 +02:00
parent 7748b6f24b
commit 672e376ba5
3 changed files with 148 additions and 5 deletions

View file

@ -107,6 +107,14 @@ class Key:
} #type: Dict[Expr, Expr]
"""The extendable usage flags with the corresponding extension flags."""
EXTENDABLE_USAGE_FLAGS_KEY_RESTRICTION = {
'PSA_KEY_USAGE_SIGN_HASH': '.*KEY_PAIR',
'PSA_KEY_USAGE_VERIFY_HASH': '.*KEY.*'
} #type: Dict[str, str]
"""The key type filter for the extendable usage flags.
The filter is a regexp.
"""
def __init__(self, *,
version: Optional[int] = None,
id: Optional[int] = None, #pylint: disable=redefined-builtin