blob: 28bd2e94491335b8a461fec0090e452d7f3b5383 [file] [log] [blame]
Julian Hall9061e6c2021-06-29 14:24:20 +01001/*
2 * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef MBEDCRYPTO_BACKEND_H
8#define MBEDCRYPTO_BACKEND_H
9
10#include <stdbool.h>
11#include <psa/error.h>
12#include <service/secure_storage/backend/storage_backend.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18/**
19 * \brief Initialize the mbedcrypto based backend
20 *
21 * Initializes a crypto backend that uses the mbedcrypto library built by
22 * MbedTLS to realize the PSA crypto API used by the crypto service proviser.
23 *
24 * \param[in] storage_backend The storage backend to use for persistent keys
25 * \param[in] trng_instance_num The TRNG hardware instance number to use
26 *
27 * \return PSA_SUCCESS if backend initialized successfully
28 */
29psa_status_t mbedcrypto_backend_init(struct storage_backend *storage_backend,
30 int trng_instance_num);
31
32/**
33 * \brief Clean-up to free any resource used by the backend
34 */
35void mbedcrypto_backend_deinit(void);
36
37#ifdef __cplusplus
38} /* extern "C" */
39#endif
40
41#endif /* MBEDCRYPTO_BACKEND_H */