psa: driver: Reduce the scope of test driver entry points

Define test driver entry points that provide an alternative
to Mbed TLS driver entry points only when the PSA configuration
is used. Their purpose is only to test the PSA configuration
thus there is no good reason to use them out of this scope.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
diff --git a/library/psa_crypto_mac.c b/library/psa_crypto_mac.c
index cf20a9b..d59178e 100644
--- a/library/psa_crypto_mac.c
+++ b/library/psa_crypto_mac.c
@@ -33,11 +33,15 @@
 /* Use builtin defines specific to this compilation unit, since the test driver
  * relies on the software driver. */
 #if( defined(MBEDTLS_PSA_BUILTIN_ALG_CMAC) || \
-    ( defined(PSA_CRYPTO_DRIVER_TEST) && defined(MBEDTLS_PSA_ACCEL_ALG_CMAC) ) )
+    ( defined(PSA_CRYPTO_DRIVER_TEST) && \
+      defined(MBEDTLS_PSA_CRYPTO_CONFIG) && \
+      defined(MBEDTLS_PSA_ACCEL_ALG_CMAC) ) )
 #define BUILTIN_ALG_CMAC        1
 #endif
 #if( defined(MBEDTLS_PSA_BUILTIN_ALG_HMAC) || \
-    ( defined(PSA_CRYPTO_DRIVER_TEST) && defined(MBEDTLS_PSA_ACCEL_ALG_HMAC) ) )
+    ( defined(PSA_CRYPTO_DRIVER_TEST) && \
+      defined(MBEDTLS_PSA_CRYPTO_CONFIG) && \
+      defined(MBEDTLS_PSA_ACCEL_ALG_HMAC) ) )
 #define BUILTIN_ALG_HMAC        1
 #endif
 
@@ -560,7 +564,7 @@
  /*
   * BEYOND THIS POINT, TEST DRIVER ENTRY POINTS ONLY.
   */
-#if defined(PSA_CRYPTO_DRIVER_TEST)
+#if defined(PSA_CRYPTO_DRIVER_TEST) && defined(MBEDTLS_PSA_CRYPTO_CONFIG)
 
 static int is_mac_accelerated( psa_algorithm_t alg )
 {
@@ -667,6 +671,6 @@
     return( mac_abort( operation ) );
 }
 
-#endif /* PSA_CRYPTO_DRIVER_TEST */
+#endif /* PSA_CRYPTO_DRIVER_TEST && MBEDTLS_PSA_CRYPTO_CONFIG */
 
 #endif /* MBEDTLS_PSA_CRYPTO_C */