Fix code style pt2

Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
This commit is contained in:
Elena Uziunaite
2024-11-01 14:49:44 +00:00
parent f7e1f6ff1d
commit 561a3c4ec7
3 changed files with 8 additions and 6 deletions
+1 -1
View File
@@ -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
+2 -1
View File
@@ -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:"
+5 -4
View File
@@ -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]