forked from ARMmbed/mbed-os
-
Notifications
You must be signed in to change notification settings - Fork 0
/
attestation.h
executable file
·115 lines (101 loc) · 3.42 KB
/
attestation.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
* Copyright (c) 2018-2019, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
/** @addtogroup PSA-Attestation
* @{
*/
#ifndef __ATTESTATION_H__
#define __ATTESTATION_H__
#include "psa_initial_attestation_api.h"
#include "tfm_client.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* \brief Type of memory access
*/
enum attest_memory_access_t {
TFM_ATTEST_ACCESS_RO = 1,
TFM_ATTEST_ACCESS_RW = 2,
};
/**
* \brief Copy the boot data (coming from boot loader) from shared memory area
* to service memory area
*
* \param[in] major_type Major type of TLV entries to copy
* \param[out] ptr Pointer to the buffer to store the boot data
* \parma[in] len Size of the buffer to store the boot data
*
* \return Returns error code as specified in \ref psa_attest_err_t
*/
enum psa_attest_err_t
attest_get_boot_data(uint8_t major_type, void *ptr, uint32_t len);
/**
* \brief Get the ID of the caller thread.
*
* \param[out] caller_id Pointer where to store caller ID
*
* \return Returns error code as specified in \ref psa_attest_err_t
*/
enum psa_attest_err_t
attest_get_caller_client_id(int32_t *caller_id);
/**
* \brief Verify memory access rights
*
* \param[in] addr Pointer to the base of the address range to check
* \param[in] size Size of the address range to check
* \param[in] access Type of memory access as specified in
* \ref attest_memory_access
*
* \return Returns error code as specified in \ref psa_attest_err_t
*/
enum psa_attest_err_t
attest_check_memory_access(void *addr,
uint32_t size,
enum attest_memory_access_t access);
/**
* \brief Initialise the initial attestation service during the TF-M boot up
* process.
*
* \return Returns PSA_ATTEST_ERR_SUCCESS if init has been completed,
* otherwise error as specified in \ref psa_attest_err_t
*/
enum psa_attest_err_t attest_init(void);
/**
* \brief Get initial attestation token
*
* \param[in] in_vec Pointer to in_vec array, which contains input data
* to attestation service
* \param[in] num_invec Number of elements in in_vec array
* \param[in/out] out_vec Pointer out_vec array, which contains output data
* to attestation service
* \param[in] num_outvec Number of elements in out_vec array
*
* \return Returns error code as specified in \ref psa_attest_err_t
*/
enum psa_attest_err_t
initial_attest_get_token(const psa_invec *in_vec, uint32_t num_invec,
psa_outvec *out_vec, uint32_t num_outvec);
/**
* \brief Get the size of the initial attestation token
*
* \param[in] in_vec Pointer to in_vec array, which contains input data
* to attestation service
* \param[in] num_invec Number of elements in in_vec array
* \param[out] out_vec Pointer to out_vec array, which contains pointer
* where to store the output data
* \param[in] num_outvec Number of elements in out_vec array
*
* \return Returns error code as specified in \ref psa_attest_err_t
*/
enum psa_attest_err_t
initial_attest_get_token_size(const psa_invec *in_vec, uint32_t num_invec,
psa_outvec *out_vec, uint32_t num_outvec);
#ifdef __cplusplus
}
#endif
/** @}*/ // PSA-Attestation
#endif /* __ATTESTATION_H__ */