From c154a043bb299847ec6c36b32517f0d99b032a1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Tue, 18 Jul 2023 11:01:14 +0200 Subject: [PATCH] Fix dependencies for DH (and RSA) key pairs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - RSA was missing the MBEDTLS_ prefix. - DH needs the same temporary fix (prefix + suffix) for now. - hack_dependencies_not_implemented() needs to ignore MBEDTLS_PSA_WANT dependencies. While at it, make the code currently used for ECC more generic, so that it's ready to be used for RSA and DH in the near future. Signed-off-by: Manuel Pégourié-Gonnard --- tests/scripts/generate_psa_tests.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/scripts/generate_psa_tests.py b/tests/scripts/generate_psa_tests.py index 738136cfc..cad788461 100755 --- a/tests/scripts/generate_psa_tests.py +++ b/tests/scripts/generate_psa_tests.py @@ -111,7 +111,7 @@ def hack_dependencies_not_implemented(dependencies: List[str]) -> None: _implemented_dependencies = \ read_implemented_dependencies('include/psa/crypto_config.h') if not all((dep.lstrip('!') in _implemented_dependencies or - 'PSA_WANT' not in dep) + not dep.lstrip('!').startswith('PSA_WANT')) for dep in dependencies): dependencies.append('DEPENDENCY_NOT_IMPLEMENTED_YET') @@ -121,7 +121,14 @@ def tweak_key_pair_dependency(dep: str, usage: str): symbols according to the required usage. """ ret_list = list() - if dep.endswith('KEY_PAIR'): + # Note: this LEGACY replacement DH is temporary and it's going + # to be aligned with ECC one in #7773. + if dep.endswith('DH_KEY_PAIR'): + legacy = dep + legacy = re.sub(r'KEY_PAIR\Z', r'KEY_PAIR_LEGACY', legacy) + legacy = re.sub(r'PSA_WANT', r'MBEDTLS_PSA_WANT', legacy) + ret_list.append(legacy) + elif dep.endswith('KEY_PAIR'): if usage == "BASIC": # BASIC automatically includes IMPORT and EXPORT for test purposes (see # config_psa.h).