Julian Hall | 9061e6c | 2021-06-29 14:24:20 +0100 | [diff] [blame] | 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/trng_adapter/trng_adapter.h> |
| 8 | #include <service/secure_storage/frontend/psa/its/its_frontend.h> |
| 9 | #include <psa/crypto.h> |
| 10 | |
| 11 | |
| 12 | psa_status_t mbedcrypto_backend_init(struct storage_backend *storage_backend, |
| 13 | int trng_instance_num) |
| 14 | { |
| 15 | psa_status_t status; |
| 16 | |
| 17 | status = trng_adapter_init(trng_instance_num); |
| 18 | |
| 19 | if (status == PSA_SUCCESS) |
| 20 | status = psa_its_frontend_init(storage_backend); |
| 21 | |
| 22 | if (status == PSA_SUCCESS) |
| 23 | status = psa_crypto_init(); |
| 24 | |
| 25 | return status; |
| 26 | } |
| 27 | |
| 28 | void mbedcrypto_backend_deinit(void) |
| 29 | { |
| 30 | trng_adapter_deinit(); |
| 31 | } |