test: minor refactoring

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
diff --git a/tests/scripts/all.sh b/tests/scripts/all.sh
index 754b083..31df467 100755
--- a/tests/scripts/all.sh
+++ b/tests/scripts/all.sh
@@ -2414,8 +2414,7 @@
     scripts/config.py set $BUILTIN_CURVE
     # Accelerate all curves listed in "crypto_config.h" (skipping the ones that
     # are commented out)
-    for CURVE in $(sed -n 's/^#define \(PSA_WANT_ECC_[0-9A-Z_a-z]*\).*/\1/p' <"$CRYPTO_CONFIG_H"); do
-        CURVE=$(echo $CURVE | sed 's/PSA_WANT_//')
+    for CURVE in $(sed -n 's/^#define PSA_WANT_\(ECC_[0-9A-Z_a-z]*\).*/\1/p' <"$CRYPTO_CONFIG_H"); do
         loc_accel_list="$loc_accel_list $CURVE"
     done