Unify PSA symbol identification
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
diff --git a/tf-psa-crypto/scripts/config.py b/tf-psa-crypto/scripts/config.py
index a5253b4..8412637 100755
--- a/tf-psa-crypto/scripts/config.py
+++ b/tf-psa-crypto/scripts/config.py
@@ -11,6 +11,7 @@
## SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
##
+import re
import os
import sys
@@ -18,6 +19,8 @@
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 @@
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 @@
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)