Move MbedTLS includes from crypto provider

Move the MbedTLS specific includes from the crypto provider into the
MbedTLS backend. This solves an issue that the component-test linux-pc
build was broken because the pkcs7 and x509 related headers included the
wrong psa/crypto.h (not the one from the MbedTLS install directory).

Signed-off-by: Balint Dobszay <balint.dobszay@arm.com>
Change-Id: If1526fae2a9b17ef9c6d63262fad81374829e71d
diff --git a/components/service/crypto/backend/mbedcrypto/mbedtls_fake_x509/mbedtls_fake_x509.c b/components/service/crypto/backend/mbedcrypto/mbedtls_fake_x509/mbedtls_fake_x509.c
index a579252..82a2896 100644
--- a/components/service/crypto/backend/mbedcrypto/mbedtls_fake_x509/mbedtls_fake_x509.c
+++ b/components/service/crypto/backend/mbedcrypto/mbedtls_fake_x509/mbedtls_fake_x509.c
@@ -4,10 +4,8 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
-#include <mbedtls/build_info.h>
-#include <mbedtls/error.h>
-#include <mbedtls/pkcs7.h>
-#include <mbedtls/x509_crt.h>
+#include "../mbedtls_psa_crypto_backend.h"
+
 #include <compiler.h>
 #include <stdlib.h>
 
diff --git a/components/service/crypto/backend/mbedcrypto/mbedtls_psa_crypto_backend.h b/components/service/crypto/backend/mbedcrypto/mbedtls_psa_crypto_backend.h
index afe45fe..490ca5a 100644
--- a/components/service/crypto/backend/mbedcrypto/mbedtls_psa_crypto_backend.h
+++ b/components/service/crypto/backend/mbedcrypto/mbedtls_psa_crypto_backend.h
@@ -17,6 +17,11 @@
 #include MBEDTLS_PSA_CRYPTO_H
 #endif
 
+#include <mbedtls/build_info.h>
+#include <mbedtls/error.h>
+#include <mbedtls/pkcs7.h>
+#include <mbedtls/x509_crt.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/components/service/crypto/provider/crypto_provider.c b/components/service/crypto/provider/crypto_provider.c
index bc0e90e..9cd5208 100644
--- a/components/service/crypto/provider/crypto_provider.c
+++ b/components/service/crypto/provider/crypto_provider.c
@@ -3,9 +3,6 @@
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
-#include <mbedtls/build_info.h>
-#include <mbedtls/pkcs7.h>
-#include <mbedtls/x509_crt.h>
 #include <protocols/rpc/common/packed-c/status.h>
 #include <protocols/service/crypto/packed-c/opcodes.h>
 #include <service/crypto/backend/crypto_backend.h>
@@ -628,6 +625,7 @@
 	return rpc_status;
 }
 
+#if defined(MBEDTLS_PKCS7_C) && defined(MBEDTLS_X509_CRT_PARSE_C)
 static rpc_status_t verify_pkcs7_signature_handler(void *context, struct rpc_request *req)
 {
 	rpc_status_t rpc_status = RPC_ERROR_INTERNAL;
@@ -704,3 +702,12 @@
 
 	return rpc_status;
 }
+#else
+static rpc_status_t verify_pkcs7_signature_handler(void *context, struct rpc_request *req)
+{
+	(void)context;
+	(void)req;
+
+	return RPC_ERROR_INTERNAL;
+}
+#endif