Unify PSA symbol identification

Signed-off-by: Gabor Mezei <[email protected]>
This commit is contained in:
Gabor Mezei
2024-12-05 18:59:11 +01:00
parent 1a7bbe1ca8
commit fc719d6e8c
+5 -2
View File
@@ -11,6 +11,7 @@ Basic usage, to read the TF PSA Crypto configuration:
## SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
##
import re
import os
import sys
@@ -18,6 +19,8 @@ import framework_scripts_path # pylint: disable=unused-import
from mbedtls_framework import config_common
PSA_SYMBOL_REGEXP = re.compile(r'^PSA_.*')
PSA_UNSUPPORTED_FEATURE = frozenset([
'PSA_WANT_ALG_CBC_MAC',
'PSA_WANT_ALG_XTS',
@@ -93,7 +96,7 @@ def is_boolean_setting(name, value):
this might change to mean disabling them. Currently we just never set
them to 0.)
"""
if name.startswith('PSA_WANT_'):
if re.match(PSA_SYMBOL_REGEXP, name):
return True
if not value:
return True
@@ -179,7 +182,7 @@ class TFPSACryptoConfig(config_common.Config):
self._get_configfile().templates.append((name, '', f'#define {name} '))
# Default value for PSA macros is '1'
if name.startswith('PSA_') and not value:
if not value and re.match(PSA_SYMBOL_REGEXP, name):
value = '1'
super().set(name, value)