Julian Hall | c02fffb | 2020-11-23 18:22:06 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #ifndef MBED_CRYPTO_PROVIDER_H |
| 8 | #define MBED_CRYPTO_PROVIDER_H |
| 9 | |
| 10 | #include <rpc/common/endpoint/call_ep.h> |
| 11 | #include <rpc_caller.h> |
| 12 | #include <service/common/provider/service_provider.h> |
| 13 | |
| 14 | #ifdef __cplusplus |
| 15 | extern "C" { |
| 16 | #endif |
| 17 | |
| 18 | struct mbed_crypto_provider |
| 19 | { |
| 20 | struct service_provider base_provider; |
| 21 | }; |
| 22 | |
| 23 | /* |
| 24 | * Initializes an instance of the crypto service provider that uses the |
| 25 | * Mbed Crypto library to implement crypto operations. Secure storage |
| 26 | * for persistent keys needs to be provided by a suitable storage |
| 27 | * provider, accessed using the secure storage service access protocol |
| 28 | * using the provided rpc_caller. Any rpc endpoint discovery and |
| 29 | * session establishment should have been performed prior to initializing |
| 30 | * the mbed_crypto_provider. On successfully initializing the provider, |
| 31 | * a pointer to the call_ep for the service is returned. |
| 32 | */ |
| 33 | struct call_ep *mbed_crypto_provider_init(struct mbed_crypto_provider *context, |
| 34 | struct rpc_caller *storage_provider); |
| 35 | |
| 36 | /* |
| 37 | * When operation of the provider is no longer required, this function |
| 38 | * frees any resource used by the previously initialized provider instance. |
| 39 | */ |
| 40 | void mbed_crypto_provider_deinit(struct mbed_crypto_provider *context); |
| 41 | |
| 42 | #ifdef __cplusplus |
| 43 | } /* extern "C" */ |
| 44 | #endif |
| 45 | |
| 46 | #endif /* MBED_CRYPTO_PROVIDER_H */ |