1 /*
2  * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <service/crypto/backend/mbedcrypto/mbedtls_psa_crypto_backend.h>
8 #include <service/crypto/backend/mbedcrypto/trng_adapter/trng_adapter.h>
9 #include <service/secure_storage/frontend/psa/its/its_frontend.h>
10 
mbedcrypto_backend_init(struct storage_backend * storage_backend,int trng_instance_num)11 psa_status_t mbedcrypto_backend_init(struct storage_backend *storage_backend,
12 						int trng_instance_num)
13 {
14 	psa_status_t status;
15 
16 	status = trng_adapter_init(trng_instance_num);
17 
18 	if (status == PSA_SUCCESS)
19 		status = psa_its_frontend_init(storage_backend);
20 
21 	if (status == PSA_SUCCESS)
22 		status = psa_crypto_init();
23 
24 	return status;
25 }
26 
mbedcrypto_backend_deinit(void)27 void mbedcrypto_backend_deinit(void)
28 {
29 	trng_adapter_deinit();
30 }
31