From 561a3c4ec7bdf4cbe3b1707c4c1beb4e86225913 Mon Sep 17 00:00:00 2001 From: Elena Uziunaite Date: Fri, 1 Nov 2024 14:49:44 +0000 Subject: [PATCH] Fix code style pt2 Signed-off-by: Elena Uziunaite --- scripts/generate_config_tests.py | 2 +- scripts/generate_pkcs7_tests.py | 3 ++- scripts/mbedtls_framework/test_case.py | 9 +++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/generate_config_tests.py b/scripts/generate_config_tests.py index 7d6b3c976..469d895e4 100755 --- a/scripts/generate_config_tests.py +++ b/scripts/generate_config_tests.py @@ -88,7 +88,7 @@ def dependencies_of_setting(cfg: config_common.Config, return 'MBEDTLS_CIPHER_C:MBEDTLS_CIPHER_MODE_CBC' if name.startswith('MBEDTLS_PK_PARSE_EC_'): return 'MBEDTLS_PK_C:' + test_case.psa_or_3_6_feature_macro( - 'PSA_KEY_TYPE_ECC_PUBLIC_KEY', test_case.Domain_3_6.USE_PSA) + 'PSA_KEY_TYPE_ECC_PUBLIC_KEY', test_case.Domain36.USE_PSA) # For TLS settings, insist on having them once off and once on in # a configuration where both client support and server support are diff --git a/scripts/generate_pkcs7_tests.py b/scripts/generate_pkcs7_tests.py index 629b3a8c6..b97cebbf4 100755 --- a/scripts/generate_pkcs7_tests.py +++ b/scripts/generate_pkcs7_tests.py @@ -38,7 +38,8 @@ class TestData: Take in test_suite_pkcs7.data file. Allow for new tests to be added. """ - mandatory_dep = test_case.psa_or_3_6_feature_macro("PSA_ALG_SHA_256", test_case.Domain_3_6.USE_PSA) + mandatory_dep = test_case.psa_or_3_6_feature_macro("PSA_ALG_SHA_256", + test_case.Domain36.USE_PSA) test_name = "PKCS7 Parse Failure Invalid ASN1" test_function = "pkcs7_asn1_fail:" diff --git a/scripts/mbedtls_framework/test_case.py b/scripts/mbedtls_framework/test_case.py index 276eba524..d2de72754 100644 --- a/scripts/mbedtls_framework/test_case.py +++ b/scripts/mbedtls_framework/test_case.py @@ -33,7 +33,7 @@ PK_MACROS_3_6 = { "PSA_KEY_TYPE_ECC_PUBLIC_KEY" : "MBEDTLS_PK_HAVE_ECC_KEYS" } -class Domain_3_6(Enum): +class Domain36(Enum): PSA = 1 TLS_1_3_ONLY = 2 USE_PSA = 3 @@ -117,18 +117,19 @@ def write_data_file(filename: str, os.replace(tempfile, filename) def psa_or_3_6_feature_macro(psa_name: str, - domain_3_6: Domain_3_6) -> str: + domain_3_6: Domain36) -> str: """Determine the dependency symbol for a given psa_alg based on the domain and Mbed TLS version. For more information about the domains, and MBEDTLS_MD_CAN_ prefixed symbols, see transition-guards.md. Currently works with hashes and PK symbols only. """ - if domain_3_6 == Domain_3_6.PSA or domain_3_6 == Domain_3_6.TLS_1_3_ONLY or not build_tree.is_mbedtls_3_6(): + if domain_3_6 == Domain36.PSA or domain_3_6 == Domain36.TLS_1_3_ONLY or \ + not build_tree.is_mbedtls_3_6(): if psa_name in PK_MACROS_3_6 or psa_name in HASHES_3_6: return psa_information.psa_want_symbol(psa_name) - if domain_3_6 == Domain_3_6.USE_PSA: + if domain_3_6 == Domain36.USE_PSA: if psa_name in PK_MACROS_3_6: return PK_MACROS_3_6[psa_name]