libtestdriver: Addded crypto_config_test_driver

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
diff --git a/tests/Makefile b/tests/Makefile
index bde6c1b..c141abf 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -340,14 +340,20 @@
 
 	# Set the test driver base (minimal) configuration.
 	cp ../tf-psa-crypto/tests/configs/config_test_driver.h ./libtestdriver1/include/mbedtls/mbedtls_config.h
+	cp ../tf-psa-crypto/tests/configs/crypto_config_test_driver.h ./libtestdriver1/tf-psa-crypto/include/psa/crypto_config.h
 
 	# Set the PSA cryptography configuration for the test library.
-	# It is set from the copied include/psa/crypto_config.h of the Mbed TLS
-        # library the test library is intended to be linked with extended by
-        # ../tf-psa-crypto/tests/configs/crypto_config_test_driver_extension.h
-        # to mirror the PSA_ACCEL_* macros.
+	# The configuration is created by joining the base
+	# ../tf-psa-crypto/tests/configs/crypto_config_test_driver.h,
+	# with the the library's PSA_WANT_* macros extracted from
+	# ./tf-psa-crypto/include/psa/crypto_config.h
+	# and then extended with entries of
+	# ../tf-psa-crypto/tests/configs/crypto_config_test_driver_extension.h
+	# to mirror the PSA_ACCEL_* macros.
+
 	mv ./libtestdriver1/tf-psa-crypto/include/psa/crypto_config.h ./libtestdriver1/tf-psa-crypto/include/psa/crypto_config.h.bak
 	head -n -1 ./libtestdriver1/tf-psa-crypto/include/psa/crypto_config.h.bak > ./libtestdriver1/tf-psa-crypto/include/psa/crypto_config.h
+	grep '^#define PSA_WANT_*' ../tf-psa-crypto/include/psa/crypto_config.h >> ./libtestdriver1/tf-psa-crypto/include/psa/crypto_config.h
 	cat ../tf-psa-crypto/tests/configs/crypto_config_test_driver_extension.h >> ./libtestdriver1/tf-psa-crypto/include/psa/crypto_config.h
 	echo "#endif /* PSA_CRYPTO_CONFIG_H */" >> ./libtestdriver1/tf-psa-crypto/include/psa/crypto_config.h
 
diff --git a/tests/scripts/components-configuration-crypto.sh b/tests/scripts/components-configuration-crypto.sh
index 0cf2ca9..7a428db 100644
--- a/tests/scripts/components-configuration-crypto.sh
+++ b/tests/scripts/components-configuration-crypto.sh
@@ -1534,8 +1534,8 @@
 
         # We need PEM parsing in the test library as well to support the import
         # of PEM encoded RSA keys.
-        scripts/config.py -f "$CONFIG_TEST_DRIVER_H" set MBEDTLS_PEM_PARSE_C
-        scripts/config.py -f "$CONFIG_TEST_DRIVER_H" set MBEDTLS_BASE64_C
+        scripts/config.py -c "$CONFIG_TEST_DRIVER_H" set MBEDTLS_PEM_PARSE_C
+        scripts/config.py -c "$CONFIG_TEST_DRIVER_H" set MBEDTLS_BASE64_C
     fi
 }
 
diff --git a/tf-psa-crypto/tests/configs/config_test_driver.h b/tf-psa-crypto/tests/configs/config_test_driver.h
index ed3b640..0ade508 100644
--- a/tf-psa-crypto/tests/configs/config_test_driver.h
+++ b/tf-psa-crypto/tests/configs/config_test_driver.h
@@ -17,29 +17,4 @@
 #define _CRT_SECURE_NO_DEPRECATE 1
 #endif
 
-#define MBEDTLS_PSA_CRYPTO_C
-
-/* PSA core mandatory configuration options */
-#define MBEDTLS_CIPHER_C
-#define MBEDTLS_AES_C
-#define MBEDTLS_SHA256_C
-#define MBEDTLS_PSA_BUILTIN_ALG_SHA_256 1
-#define MBEDTLS_CTR_DRBG_C
-#define MBEDTLS_ENTROPY_C
-#define MBEDTLS_ENTROPY_FORCE_SHA256
-
-/*
- * Configuration options that may need to be additionally enabled for the
- * purpose of a specific set of tests.
- */
-//#define MBEDTLS_SHA1_C
-//#define MBEDTLS_SHA224_C
-//#define MBEDTLS_SHA384_C
-//#define MBEDTLS_SHA512_C
-//#define MBEDTLS_MD_C
-//#define MBEDTLS_PEM_PARSE_C
-//#define MBEDTLS_BASE64_C
-//#define MBEDTLS_THREADING_C
-//#define MBEDTLS_THREADING_PTHREAD
-
 #endif /* MBEDTLS_CONFIG_H */
diff --git a/tf-psa-crypto/tests/configs/crypto_config_test_driver.h b/tf-psa-crypto/tests/configs/crypto_config_test_driver.h
new file mode 100644
index 0000000..2e75b78
--- /dev/null
+++ b/tf-psa-crypto/tests/configs/crypto_config_test_driver.h
@@ -0,0 +1,40 @@
+/*
+ * PSA Crypto configuration base for PSA test driver libraries. It includes:
+ * . the minimum set of modules needed by the PSA core.
+ * . the Mbed TLS configuration options that may need to be additionally
+ *   enabled for the purpose of a specific test.
+ */
+/*
+ *  Copyright The Mbed TLS Contributors
+ *  SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
+ */
+
+#ifndef PSA_CRYPTO_CONFIG_H
+#define PSA_CRYPTO_CONFIG_H
+
+#define MBEDTLS_PSA_CRYPTO_C
+
+/* PSA core mandatory configuration options */
+#define MBEDTLS_CIPHER_C
+#define MBEDTLS_AES_C
+#define MBEDTLS_SHA256_C
+#define MBEDTLS_PSA_BUILTIN_ALG_SHA_256 1
+#define MBEDTLS_CTR_DRBG_C
+#define MBEDTLS_ENTROPY_C
+#define MBEDTLS_ENTROPY_FORCE_SHA256
+
+/*
+ * Configuration options that may need to be additionally enabled for the
+ * purpose of a specific set of tests.
+ */
+//#define MBEDTLS_SHA1_C
+//#define MBEDTLS_SHA224_C
+//#define MBEDTLS_SHA384_C
+//#define MBEDTLS_SHA512_C
+//#define MBEDTLS_MD_C
+//#define MBEDTLS_PEM_PARSE_C
+//#define MBEDTLS_BASE64_C
+//#define MBEDTLS_THREADING_C
+//#define MBEDTLS_THREADING_PTHREAD
+
+#endif /* PSA_CRYPTO_CONFIG_H */