mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 16:45:28 +00:00
Implement basic update of PSA_WANT dependencies
Remove any existing PSA_WANT_xxx dependency. Add PSA_WANT_xxx dependencies based on the PSA_KEY_TYPE_xxx and PSA_ALG_xxx symbols used in the test case arguments. PSA_ECC_FAMILY_xxx and PSA_DH_GROUP_xxx are not implemented yet in the PSA conditional inclusion mechanism in Mbed TLS, so this script doesn't handle them yet. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
45e9e73e66
commit
2d2e924401
|
@ -22,6 +22,23 @@ import os
|
|||
import re
|
||||
import sys
|
||||
|
||||
def is_systematic_dependency(dep):
|
||||
"""Whether dep is a PSA dependency which is determined systematically."""
|
||||
return dep.startswith('PSA_WANT_')
|
||||
|
||||
def dependencies_of_symbol(symbol):
|
||||
"""Return the dependencies for a symbol that designates a cryptographic mechanism."""
|
||||
return {symbol.replace('_', '_WANT_', 1)}
|
||||
|
||||
def systematic_dependencies(file_name, function_name, arguments):
|
||||
#pylint: disable=unused-argument
|
||||
"""List the systematically determined dependency for a test case."""
|
||||
deps = set()
|
||||
for arg in arguments:
|
||||
for symbol in re.findall(r'PSA_(?:ALG|KEY_TYPE)_\w+', arg):
|
||||
deps.update(dependencies_of_symbol(symbol))
|
||||
return sorted(deps)
|
||||
|
||||
def updated_dependencies(file_name, function_name, arguments, dependencies):
|
||||
"""Rework the list of dependencies into PSA_WANT_xxx.
|
||||
|
||||
|
@ -31,7 +48,10 @@ def updated_dependencies(file_name, function_name, arguments, dependencies):
|
|||
Add systematic PSA_WANT_xxx dependencies based on the called function and
|
||||
its arguments, replacing existing PSA_WANT_xxx dependencies.
|
||||
"""
|
||||
return dependencies #TODO
|
||||
automatic = systematic_dependencies(file_name, function_name, arguments)
|
||||
manual = [dep for dep in dependencies
|
||||
if not is_systematic_dependency(dep)]
|
||||
return automatic + manual
|
||||
|
||||
def keep_manual_dependencies(file_name, function_name, arguments):
|
||||
#pylint: disable=unused-argument
|
||||
|
|
Loading…
Reference in a new issue