1 /* 2 * Copyright (c) 2023, Arm Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include "../psa_api_test_common.h" 8 #include "libpsats.h" 9 #include "trace.h" 10 test_setup(const char * service_name_crypto,const char * service_name_iat,const char * service_name_ps,const char * service_name_its)11psa_status_t test_setup(const char *service_name_crypto, const char *service_name_iat, 12 const char *service_name_ps, const char *service_name_its) 13 { 14 psa_status_t psa_status = PSA_ERROR_GENERIC_ERROR; 15 16 if (!service_name_crypto) 17 service_name_crypto = "sn:trustedfirmware.org:crypto:0"; 18 19 psa_status = libpsats_init_crypto_context(service_name_crypto); 20 if (psa_status) { 21 EMSG("libpsats_init_crypto_context failed: %d\n", psa_status); 22 return psa_status; 23 } 24 25 psa_status = psa_crypto_init(); 26 if (psa_status) { 27 EMSG("psa_crypto_init failed: %d\n", psa_status); 28 return psa_status; 29 } 30 31 return PSA_SUCCESS; 32 } 33 test_teardown(void)34void test_teardown(void) 35 { 36 libpsats_deinit_crypto_context(); 37 } 38