From 659d905cf95bf5e50e70019d15f8f38adeea0b23 Mon Sep 17 00:00:00 2001 From: David Horstmann Date: Tue, 24 Jan 2023 18:59:07 +0000 Subject: [PATCH] Give proper Dict type hints in crypto_knowledge.py This prevents a return type error in a later function that uses the dictionaries here properly typed. Signed-off-by: David Horstmann --- scripts/mbedtls_dev/crypto_knowledge.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/mbedtls_dev/crypto_knowledge.py b/scripts/mbedtls_dev/crypto_knowledge.py index f227a411b093..5e579ce6f5a6 100644 --- a/scripts/mbedtls_dev/crypto_knowledge.py +++ b/scripts/mbedtls_dev/crypto_knowledge.py @@ -20,7 +20,7 @@ import enum import re -from typing import FrozenSet, Iterable, List, Optional, Tuple +from typing import FrozenSet, Iterable, List, Optional, Tuple, Dict from .asymmetric_key_data import ASYMMETRIC_KEY_DATA @@ -148,7 +148,7 @@ def is_public(self) -> bool: 'PSA_ECC_FAMILY_BRAINPOOL_P_R1': (160, 192, 224, 256, 320, 384, 512), 'PSA_ECC_FAMILY_MONTGOMERY': (255, 448), 'PSA_ECC_FAMILY_TWISTED_EDWARDS': (255, 448), - } + } # type: Dict[str, Tuple[int, ...]] KEY_TYPE_SIZES = { 'PSA_KEY_TYPE_AES': (128, 192, 256), # exhaustive 'PSA_KEY_TYPE_ARC4': (8, 128, 2048), # extremes + sensible @@ -160,7 +160,7 @@ def is_public(self) -> bool: 'PSA_KEY_TYPE_HMAC': (128, 160, 224, 256, 384, 512), # standard size for each supported hash 'PSA_KEY_TYPE_RAW_DATA': (8, 40, 128), # sample 'PSA_KEY_TYPE_RSA_KEY_PAIR': (1024, 1536), # small sample - } + } # type: Dict[str, Tuple[int, ...]] def sizes_to_test(self) -> Tuple[int, ...]: """Return a tuple of key sizes to test.