blob: 404fb4105eba11b7294857d474d862108b17f90c [file] [log] [blame]
Tamas Ban48a0eb52018-08-17 12:48:05 +01001/*
Tamas Ban2318feb2019-01-02 16:50:51 +00002 * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
Tamas Ban48a0eb52018-08-17 12:48:05 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#ifndef __ATTESTATION_H__
9#define __ATTESTATION_H__
10
11#include "psa_initial_attestation_api.h"
Tamas Band2b2f092019-01-23 22:29:14 +000012#include "tfm_client.h"
Tamas Ban48a0eb52018-08-17 12:48:05 +010013
14#ifdef __cplusplus
15extern "C" {
16#endif
17
Tamas Ban48a0eb52018-08-17 12:48:05 +010018/*!
Tamas Band2b2f092019-01-23 22:29:14 +000019 * \brief Type of memory access
20 */
21enum attest_memory_access_t {
22 TFM_ATTEST_ACCESS_RO = 1,
23 TFM_ATTEST_ACCESS_RW = 2,
24};
25
26/*!
27 * \brief Copy the boot data (coming from boot loader) from shared memory area
28 * to service memory area
29 *
30 * \param[in] major_type Major type of TLV entries to copy
31 * \param[out] ptr Pointer to the buffer to store the boot data
32 * \parma[in] len Size of the buffer to store the boot data
33 *
34 * \return Returns error code as specified in \ref psa_attest_err_t
35 */
36enum psa_attest_err_t
37attest_get_boot_data(uint8_t major_type, void *ptr, uint32_t len);
38
39/*!
40 * \brief Get the ID of the caller thread.
41 *
42 * \param[out] caller_id Pointer where to store caller ID
43 *
44 * \return Returns error code as specified in \ref psa_attest_err_t
45 */
46enum psa_attest_err_t
47attest_get_caller_client_id(int32_t *caller_id);
48
49/*!
50 * \brief Verify memory access rights
51 *
52 * \param[in] addr Pointer to the base of the address range to check
53 * \param[in] size Size of the address range to check
54 * \param[in] access Type of memory access as specified in
55 * \ref attest_memory_access
56 *
57 * \return Returns error code as specified in \ref psa_attest_err_t
58 */
59enum psa_attest_err_t
60attest_check_memory_access(void *addr,
61 uint32_t size,
62 enum attest_memory_access_t access);
63
64/*!
Tamas Ban48a0eb52018-08-17 12:48:05 +010065 * \brief Initialise the initial attestation service during the TF-M boot up
66 * process.
67 *
68 * \return Returns PSA_ATTEST_ERR_SUCCESS if init has been completed,
69 * otherwise error as specified in \ref psa_attest_err_t
70 */
71enum psa_attest_err_t attest_init(void);
72
73/*!
74 * \brief Get initial attestation token
75 *
76 * \param[in] in_vec Pointer to in_vec array, which contains input data
77 * to attestation service
78 * \param[in] num_invec Number of elements in in_vec array
Gyorgy Szing40a7af02019-02-06 14:19:47 +010079 * \param[in,out] out_vec Pointer out_vec array, which contains output data
Tamas Ban48a0eb52018-08-17 12:48:05 +010080 * to attestation service
81 * \param[in] num_outvec Number of elements in out_vec array
82 *
83 * \return Returns error code as specified in \ref psa_attest_err_t
84 */
85enum psa_attest_err_t
86initial_attest_get_token(const psa_invec *in_vec, uint32_t num_invec,
87 psa_outvec *out_vec, uint32_t num_outvec);
88
Tamas Banb6b80562019-01-04 22:49:24 +000089/**
90 * \brief Get the size of the initial attestation token
91 *
92 * \param[in] in_vec Pointer to in_vec array, which contains input data
93 * to attestation service
94 * \param[in] num_invec Number of elements in in_vec array
95 * \param[out] out_vec Pointer to out_vec array, which contains pointer
96 * where to store the output data
97 * \param[in] num_outvec Number of elements in out_vec array
98 *
99 * \return Returns error code as specified in \ref psa_attest_err_t
100 */
101enum psa_attest_err_t
102initial_attest_get_token_size(const psa_invec *in_vec, uint32_t num_invec,
103 psa_outvec *out_vec, uint32_t num_outvec);
Tamas Ban48a0eb52018-08-17 12:48:05 +0100104#ifdef __cplusplus
105}
106#endif
107
108#endif /* __ATTESTATION_H__ */