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 | |
Balint Dobszay | abec464 | 2024-01-16 10:51:51 +0100 | [diff] [blame] | 7 | #include <service/crypto/backend/mbedcrypto/mbedtls_psa_crypto_backend.h> |
Julian Hall | 9061e6c | 2021-06-29 14:24:20 +0100 | [diff] [blame] | 8 | #include <service/crypto/backend/mbedcrypto/trng_adapter/trng_adapter.h> |
| 9 | #include <service/secure_storage/frontend/psa/its/its_frontend.h> |
Julian Hall | 9061e6c | 2021-06-29 14:24:20 +0100 | [diff] [blame] | 10 | |
| 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 | |
| 27 | void mbedcrypto_backend_deinit(void) |
| 28 | { |
| 29 | trng_adapter_deinit(); |
| 30 | } |