Use PSA macros for the `chipher_chaining` domain
Exclude the XTS mode because it is not implemented via the PSA API.
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
diff --git a/tests/scripts/depends.py b/tests/scripts/depends.py
index cc7aca9..ceaac22 100755
--- a/tests/scripts/depends.py
+++ b/tests/scripts/depends.py
@@ -260,11 +260,7 @@
'MBEDTLS_CMAC_C'],
'PSA_WANT_ALG_GCM': ['MBEDTLS_GCM_C'],
- 'MBEDTLS_CIPHER_MODE_CBC': ['PSA_WANT_ALG_CBC_PKCS7',
- 'PSA_WANT_ALG_CBC_NO_PADDING'],
- 'MBEDTLS_CIPHER_MODE_CFB': ['PSA_WANT_ALG_CFB'],
- 'MBEDTLS_CIPHER_MODE_CTR': ['PSA_WANT_ALG_CTR'],
- 'MBEDTLS_CIPHER_MODE_OFB': ['PSA_WANT_ALG_OFB'],
+ 'PSA_WANT_ALG_CBC_NO_PADDING': ['PSA_WANT_ALG_CBC_PKCS7'],
'MBEDTLS_CIPHER_PADDING_PKCS7': ['MBEDTLS_PKCS5_C',
'MBEDTLS_PKCS12_C',
@@ -504,14 +500,26 @@
for key_type, symbol in key_types.items()
for alg in cipher_algs
if key_type.can_do(alg)}
- # Find block cipher chaining and padding mode enabling macros by name.
- cipher_chaining_symbols = self.config_symbols_matching(r'MBEDTLS_CIPHER_MODE_\w+\Z')
+
+ # Get block cipher chaining modes. Do not select ECB, it is always enabled.
+ cipher_modes_filter = re.compile(r'PSA_WANT_ALG_(?!ECB|STREAM|CCM)\w+\Z')
+ cipher_chaining_symbols = {symbol
+ for alg, symbol in algs.items()
+ if alg.can_do(crypto_knowledge.AlgorithmCategory.CIPHER)
+ if re.match(cipher_modes_filter, symbol)}
+
+ # Find block padding mode enabling macros by name.
cipher_padding_symbols = self.config_symbols_matching(r'MBEDTLS_CIPHER_PADDING_\w+\Z')
+
self.domains = {
# Cipher key types
'cipher_id': ExclusiveDomain(cipher_key_types, build_and_test),
+
+ # XTS is not supported via the PSA API.
'cipher_chaining': ExclusiveDomain(cipher_chaining_symbols,
- build_and_test),
+ build_and_test,
+ exclude=r'PSA_WANT_ALG_XTS'),
+
'cipher_padding': ExclusiveDomain(cipher_padding_symbols,
build_and_test),
# Elliptic curves. Run the test suites.