all.sh: unset MBEDTLS symbols for modes/keys only when !PSA_CRYPTO_CONFIG

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh
index eb12a89..1eea025 100755
--- a/tests/scripts/all.sh
+++ b/tests/scripts/all.sh
@@ -1554,6 +1554,15 @@
     else
         # Don't pull in cipher via PSA mechanisms
         scripts/config.py unset MBEDTLS_PSA_CRYPTO_CONFIG
+        # Disable cipher modes/keys that make PSA depend on CIPHER_C.
+        # Keep CHACHA20 and CHACHAPOLY enabled since they do not depend on CIPHER_C.
+        scripts/config.py unset-all MBEDTLS_CIPHER_MODE
+        scripts/config.py unset MBEDTLS_AES_C
+        scripts/config.py unset MBEDTLS_DES_C
+        scripts/config.py unset MBEDTLS_ARIA_C
+        scripts/config.py unset MBEDTLS_CAMELLIA_C
+        # Dependencies on AES_C
+        scripts/config.py unset MBEDTLS_CTR_DRBG_C
     fi
     # The following modules directly depends on CIPHER_C
     scripts/config.py unset MBEDTLS_CCM_C
@@ -1564,15 +1573,6 @@
     scripts/config.py unset MBEDTLS_PKCS5_C
     scripts/config.py unset MBEDTLS_SSL_TLS_C
     scripts/config.py unset MBEDTLS_SSL_TICKET_C
-    # Disable cipher modes/keys that make PSA depend on CIPHER_C.
-    # Keep CHACHA20 and CHACHAPOLY enabled since they do not depend on CIPHER_C.
-    scripts/config.py unset-all MBEDTLS_CIPHER_MODE
-    scripts/config.py unset MBEDTLS_AES_C
-    scripts/config.py unset MBEDTLS_DES_C
-    scripts/config.py unset MBEDTLS_ARIA_C
-    scripts/config.py unset MBEDTLS_CAMELLIA_C
-    # Dependencies on AES_C
-    scripts/config.py unset MBEDTLS_CTR_DRBG_C
 
     make