Enable libpsa in psa-api-tests
Refactor psa-api-test deployments to use libpsa.
Signed-off-by: Gabor Toth <gabor.toth2@arm.com>
Change-Id: If7f8fdbd48ce082a810983bf0696c791db185a9c
diff --git a/deployments/psa-api-test/crypto/crypto.c b/deployments/psa-api-test/crypto/crypto.c
new file mode 100644
index 0000000..9cbc67b
--- /dev/null
+++ b/deployments/psa-api-test/crypto/crypto.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2023, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include "../psa_api_test_common.h"
+#include "libpsa.h"
+#include "trace.h"
+
+psa_status_t test_setup(const char *service_name_crypto, const char *service_name_iat,
+ const char *service_name_ps, const char *service_name_its)
+{
+ psa_status_t psa_status = PSA_ERROR_GENERIC_ERROR;
+
+ if (!service_name_crypto)
+ service_name_crypto = "sn:trustedfirmware.org:crypto:0";
+
+ psa_status = libpsa_init_crypto_context(service_name_crypto);
+ if (psa_status) {
+ EMSG("libpsa_init_crypto_context failed: %d\n", psa_status);
+ return psa_status;
+ }
+
+ psa_status = psa_crypto_init();
+ if (psa_status) {
+ EMSG("psa_crypto_init failed: %d\n", psa_status);
+ return psa_status;
+ }
+
+ return PSA_SUCCESS;
+}
+
+void test_teardown(void)
+{
+ libpsa_deinit_crypto_context();
+}