blob: ed3b59a79656f4148375ab087ef45a6543b9ebb3 [file] [log] [blame]
Julian Hall700aa362021-05-13 15:30:39 +01001/*
2 * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef ATTEST_PROVIDER_H
8#define ATTEST_PROVIDER_H
9
10#include <rpc/common/endpoint/rpc_interface.h>
11#include <rpc_caller.h>
12#include <service/common/provider/service_provider.h>
13#include <service/attestation/provider/serializer/attest_provider_serializer.h>
14#include <service/attestation/key_mngr/attest_key_mngr.h>
15#include <protocols/rpc/common/packed-c/encoding.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21/**
22 * The attest_provider is a service provider that implements an RPC interface
23 * for an instance of the attestation service.
24 */
25struct attest_provider
26{
27 struct service_provider base_provider;
28 const struct attest_provider_serializer *serializers[TS_RPC_ENCODING_LIMIT];
29};
30
31/**
32 * \brief Initialize an instance of the service provider
33 *
34 * Initializes a an attestation service provider. Returns an rpc_interface
35 * that should be associated with a suitable rpc endpoint.
36 *
37 * \param[in] context The instance to initialize
38 * \param[in] iak_id The key ID for the IAK
39 *
40 * \return An rpc_interface or NULL on failure
41 */
42struct rpc_interface *attest_provider_init(struct attest_provider *context,
43 psa_key_id_t iak_id);
44
45/**
46 * \brief Cleans up when the instance is no longer needed
47 *
48 * \param[in] context The instance to de-initialize
49 */
50void attest_provider_deinit(struct attest_provider *context);
51
52/**
53 * \brief Register a protocol serializer
54 *
55 * \param[in] context The instance
56 * \param[in] encoding Serialization encoding e.g. packed-c
57 * \param[in] serializer A concrete serializer
58 */
59void attest_provider_register_serializer(struct attest_provider *context,
60 unsigned int encoding, const struct attest_provider_serializer *serializer);
61
62#ifdef __cplusplus
63} /* extern "C" */
64#endif
65
66#endif /* ATTEST_PROVIDER_H */