From 4c7da69c2bab5209975c56552e1757899f88e570 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Wed, 21 Apr 2021 21:39:27 +0200 Subject: [PATCH] Collect lifetime constructors Signed-off-by: Gilles Peskine --- scripts/mbedtls_dev/macro_collector.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/mbedtls_dev/macro_collector.py b/scripts/mbedtls_dev/macro_collector.py index b87bed699..5530f7abb 100644 --- a/scripts/mbedtls_dev/macro_collector.py +++ b/scripts/mbedtls_dev/macro_collector.py @@ -81,11 +81,15 @@ class PSAMacroEnumerator: `self.arguments_for` for arguments that are not of a kind that is enumerated here. """ + #pylint: disable=too-many-instance-attributes def __init__(self) -> None: """Set up an empty set of known constructor macros. """ self.statuses = set() #type: Set[str] + self.lifetimes = set() #type: Set[str] + self.locations = set() #type: Set[str] + self.persistence_levels = set() #type: Set[str] self.algorithms = set() #type: Set[str] self.ecc_curves = set() #type: Set[str] self.dh_groups = set() #type: Set[str] @@ -132,6 +136,9 @@ class PSAMacroEnumerator: self.arguments_for['aead_alg'] = sorted(self.aead_algorithms) self.arguments_for['curve'] = sorted(self.ecc_curves) self.arguments_for['group'] = sorted(self.dh_groups) + self.arguments_for['persistence'] = sorted(self.persistence_levels) + self.arguments_for['location'] = sorted(self.locations) + self.arguments_for['lifetime'] = sorted(self.lifetimes) @staticmethod def _format_arguments(name: str, arguments: Iterable[str]) -> str: @@ -340,6 +347,9 @@ enumerate 'ALG': self.algorithms, 'ECC_CURVE': self.ecc_curves, 'DH_GROUP': self.dh_groups, + 'KEY_LIFETIME': self.lifetimes, + 'KEY_LOCATION': self.locations, + 'KEY_PERSISTENCE': self.persistence_levels, 'KEY_TYPE': self.key_types, 'KEY_USAGE': self.key_usage_flags, } #type: Dict[str, Set[str]] @@ -365,7 +375,7 @@ enumerate 'asymmetric_signature_wildcard': [self.algorithms], 'asymmetric_encryption_algorithm': [], 'other_algorithm': [], - 'lifetime': [], + 'lifetime': [self.lifetimes], } #type: Dict[str, List[Set[str]]] self.arguments_for['mac_length'] += ['1', '63'] self.arguments_for['min_mac_length'] += ['1', '63']