Add better name for variables
Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
diff --git a/scripts/mbedtls_dev/psa_storage.py b/scripts/mbedtls_dev/psa_storage.py
index ff2fdd4..cde6c80 100644
--- a/scripts/mbedtls_dev/psa_storage.py
+++ b/scripts/mbedtls_dev/psa_storage.py
@@ -101,18 +101,18 @@
LATEST_VERSION = 0
"""The latest version of the storage format."""
- EXTENDABLE_USAGE_FLAGS = {
+ IMPLICIT_USAGE_FLAGS = {
Expr('PSA_KEY_USAGE_SIGN_HASH'): Expr('PSA_KEY_USAGE_SIGN_MESSAGE'),
Expr('PSA_KEY_USAGE_VERIFY_HASH'): Expr('PSA_KEY_USAGE_VERIFY_MESSAGE')
} #type: Dict[Expr, Expr]
- """The extendable usage flags with the corresponding extension flags."""
+ """Mapping of usage flags to the flags that they imply."""
- EXTENDABLE_USAGE_FLAGS_KEY_RESTRICTION = {
+ IMPLICIT_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.
+ """Use a regexp to determine key types for which signature is possible
+ when using the actual usage flag.
"""
def __init__(self, *,
@@ -137,7 +137,7 @@
self.material = material #type: bytes
if usage_extension:
- for flag, extension in self.EXTENDABLE_USAGE_FLAGS.items():
+ for flag, extension in self.IMPLICIT_USAGE_FLAGS.items():
if self.original_usage.value() & flag.value() and \
self.original_usage.value() & extension.value() == 0:
self.updated_usage = Expr(self.updated_usage.string +
diff --git a/tests/scripts/generate_psa_tests.py b/tests/scripts/generate_psa_tests.py
index 9354447..b515003 100755
--- a/tests/scripts/generate_psa_tests.py
+++ b/tests/scripts/generate_psa_tests.py
@@ -526,25 +526,25 @@
def keys_for_usage_extension(
self,
- extendable: psa_storage.Expr,
+ implyer_usage: psa_storage.Expr,
alg: str,
key_type: str,
params: Optional[Iterable[str]] = None
) -> List[StorageKey]:
# pylint: disable=too-many-locals
- """Generate test keys for the specified extendable usage flag,
+ """Generate test keys for the specified implicit usage flag,
algorithm and key type combination.
"""
keys = [] #type: List[StorageKey]
kt = crypto_knowledge.KeyType(key_type, params)
for bits in kt.sizes_to_test():
- extension = StorageKey.EXTENDABLE_USAGE_FLAGS[extendable]
+ implicit = StorageKey.IMPLICIT_USAGE_FLAGS[implyer_usage]
usage_flags = 'PSA_KEY_USAGE_EXPORT'
- material_usage_flags = usage_flags + ' | ' + extendable.string
- expected_usage_flags = material_usage_flags + ' | ' + extension.string
+ material_usage_flags = usage_flags + ' | ' + implyer_usage.string
+ expected_usage_flags = material_usage_flags + ' | ' + implicit.string
alg2 = 0
key_material = kt.key_material(bits)
- usage_expression = re.sub(r'PSA_KEY_USAGE_', r'', extendable.string)
+ usage_expression = re.sub(r'PSA_KEY_USAGE_', r'', implyer_usage.string)
alg_expression = re.sub(r'PSA_ALG_', r'', alg)
alg_expression = re.sub(r',', r', ', re.sub(r' +', r'', alg_expression))
key_type_expression = re.sub(r'\bPSA_(?:KEY_TYPE|ECC_FAMILY)_',
@@ -621,11 +621,11 @@
# Generate the keys without usage extension
self.key_builder = StorageKeyBuilder(usage_extension=False)
alg_with_keys = self.gather_key_types_for_sign_alg()
- key_filter = StorageKey.EXTENDABLE_USAGE_FLAGS_KEY_RESTRICTION
+ key_filter = StorageKey.IMPLICIT_USAGE_FLAGS_KEY_RESTRICTION
# Use a lookup for the extendable usage flags to able to sort them
usage_lookup = {} #type: Dict[str, psa_storage.Expr]
- for usage_flag in StorageKey.EXTENDABLE_USAGE_FLAGS:
+ for usage_flag in StorageKey.IMPLICIT_USAGE_FLAGS:
usage_lookup[usage_flag.string] = usage_flag
# Walk through all combintion. The key types must be filtered to fit