mirror of
https://github.com/Mbed-TLS/mbedtls-framework.git
synced 2026-08-07 03:37:47 +00:00
@@ -87,7 +87,8 @@ def dependencies_of_setting(cfg: config_common.Config,
|
||||
if name.startswith('MBEDTLS_CIPHER_PADDING_'):
|
||||
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_WANT_KEY_TYPE_ECC_PUBLIC_KEY','')
|
||||
return 'MBEDTLS_PK_C:' + test_case.psa_or_3_6_feature_macro(
|
||||
'PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY', '')
|
||||
|
||||
# For TLS settings, insist on having them once off and once on in
|
||||
# a configuration where both client support and server support are
|
||||
|
||||
@@ -14,7 +14,7 @@ from . import build_tree
|
||||
from . import psa_information
|
||||
from . import typing_util
|
||||
|
||||
hashes_3_6 = {
|
||||
HASHES_3_6 = {
|
||||
"PSA_WANT_ALG_MD5" : "MBEDTLS_MD_CAN_MD5",
|
||||
"PSA_WANT_ALG_RIPEMD160" : "MBEDTLS_MD_CAN_RIPEMD160",
|
||||
"PSA_WANT_ALG_SHA_1" : "MBEDTLS_MD_CAN_SHA1",
|
||||
@@ -28,7 +28,7 @@ hashes_3_6 = {
|
||||
"PSA_WANT_ALG_SHA3_512" : "MBEDTLS_MD_CAN_SHA3_512"
|
||||
}
|
||||
|
||||
pk_macros_3_6 = {
|
||||
PK_MACROS_3_6 = {
|
||||
"PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY" : "MBEDTLS_PK_HAVE_ECC_KEYS",
|
||||
"PSA_HAVE_ALG_SOME_ECDSA" : "MBEDTLS_PK_CAN_ECDSA_SOME",
|
||||
"PSA_HAVE_ALG_ECDSA_SIGN" : "MBEDTLS_PK_CAN_ECDSA_SIGN",
|
||||
@@ -120,18 +120,19 @@ def psa_or_3_6_feature_macro(psa_alg: str,
|
||||
"""
|
||||
|
||||
if domain_3_6 == "DOMAIN_3_6_PSA" or not build_tree.is_mbedtls_3_6():
|
||||
if psa_alg in pk_macros_3_6 or psa_alg in hashes_3_6:
|
||||
if psa_alg in PK_MACROS_3_6 or psa_alg in HASHES_3_6:
|
||||
return psa_alg
|
||||
elif psa_alg.startswith('PSA_ALG_') and psa_alg[8:] in ['MD5', 'RIPEMD160', 'SHA_1', 'SHA_224',
|
||||
'SHA_256', 'SHA_384', 'SHA_512', 'SHA3_224',
|
||||
'SHA3_256', 'SHA3_384', 'SHA3_512']:
|
||||
if psa_alg.startswith('PSA_ALG_') and \
|
||||
psa_alg[8:] in ['MD5', 'RIPEMD160', 'SHA_1', 'SHA_224', 'SHA_256',
|
||||
'SHA_384', 'SHA_512', 'SHA3_224',
|
||||
'SHA3_256', 'SHA3_384', 'SHA3_512']:
|
||||
return psa_information.psa_want_symbol(psa_alg)
|
||||
|
||||
if psa_alg in hashes_3_6:
|
||||
return hashes_3_6[psa_alg]
|
||||
if psa_information.psa_want_symbol(psa_alg) in hashes_3_6:
|
||||
return hashes_3_6[psa_information.psa_want_symbol(psa_alg)]
|
||||
if psa_alg in pk_macros_3_6:
|
||||
return pk_macros_3_6[psa_alg]
|
||||
if psa_alg in HASHES_3_6:
|
||||
return HASHES_3_6[psa_alg]
|
||||
if psa_information.psa_want_symbol(psa_alg) in HASHES_3_6:
|
||||
return HASHES_3_6[psa_information.psa_want_symbol(psa_alg)]
|
||||
if psa_alg in PK_MACROS_3_6:
|
||||
return PK_MACROS_3_6[psa_alg]
|
||||
|
||||
raise ValueError('Unable to determine dependency symbol for ' + psa_alg)
|
||||
|
||||
Reference in New Issue
Block a user