generate_psa_tests.py: adapt OpFail test generator for HKDF-Exract/Expand algs

Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
Przemek Stekiel 2022-05-11 14:05:40 +02:00
parent 6786a87ccd
commit 398c503f6f

View file

@ -78,6 +78,11 @@ def automatic_dependencies(*expressions: str) -> List[str]:
"""
used = set()
for expr in expressions:
# HKDF_EXTRACT and HKDF_EXPAND algs depend on HKDF
if "HKDF_EXTRACT" in expr:
expr = expr.replace("HKDF_EXTRACT", "HKDF")
if "HKDF_EXPAND" in expr:
expr = expr.replace("HKDF_EXPAND", "HKDF")
used.update(re.findall(r'PSA_(?:ALG|ECC_FAMILY|KEY_TYPE)_\w+', expr))
used.difference_update(SYMBOLS_WITHOUT_DEPENDENCY)
return sorted(psa_want_symbol(name) for name in used)