TA-REF
tee_api_types.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014, STMicroelectronics International N.V.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26 */
27
28/* Based on GP TEE Internal API Specification Version 0.11 */
29#ifndef TEE_API_TYPES_H
30#define TEE_API_TYPES_H
31
32#include <compiler.h>
33#include <stdint.h>
34#include <stdbool.h>
35#include <stddef.h>
36#include <tee_api_defines.h>
37#include "tee_api_tee_types.h"
38
39/*
40 * Common Definitions
41 */
42
43typedef uint32_t TEE_Result;
44
45typedef struct {
46 uint32_t timeLow;
47 uint16_t timeMid;
49 uint8_t clockSeqAndNode[8];
50} TEE_UUID;
51
52/*
53 * The TEE_Identity structure defines the full identity of a Client:
54 * - login is one of the TEE_LOGIN_XXX constants
55 * - uuid contains the client UUID or Nil if not applicable
56 */
57typedef struct {
58 uint32_t login;
61
62/*
63 * This union describes one parameter passed by the Trusted Core Framework
64 * to the entry points TA_OpenSessionEntryPoint or
65 * TA_InvokeCommandEntryPoint or by the TA to the functions
66 * TEE_OpenTASession or TEE_InvokeTACommand.
67 *
68 * Which of the field value or memref to select is determined by the
69 * parameter type specified in the argument paramTypes passed to the entry
70 * point.
71*/
72typedef union {
73 struct {
74 void *buffer;
75 uint32_t size;
76 } memref;
77 struct {
78 uint32_t a;
79 uint32_t b;
80 } value;
81} TEE_Param;
82
83/*
84 * The type of opaque handles on TA Session. These handles are returned by
85 * the function TEE_OpenTASession.
86 */
87typedef struct __TEE_TASessionHandle *TEE_TASessionHandle;
88
89/*
90 * The type of opaque handles on property sets or enumerators. These
91 * handles are either one of the pseudo handles TEE_PROPSET_XXX or are
92 * returned by the function TEE_AllocatePropertyEnumerator.
93*/
94typedef struct __TEE_PropSetHandle *TEE_PropSetHandle;
95
97typedef struct __TEE_ObjectEnumHandle *TEE_ObjectEnumHandle;
99
100/*
101 * Storage Definitions
102 */
103
104typedef uint32_t TEE_ObjectType;
105
106typedef struct {
107 uint32_t objectType;
108 __extension__ union {
109 uint32_t keySize; /* used in 1.1 spec */
110 uint32_t objectSize; /* used in 1.1.1 spec */
111 };
112 __extension__ union {
113 uint32_t maxKeySize; /* used in 1.1 spec */
114 uint32_t maxObjectSize; /* used in 1.1.1 spec */
115 };
116 uint32_t objectUsage;
117 uint32_t dataSize;
118 uint32_t dataPosition;
119 uint32_t handleFlags;
121
122typedef enum {
127
128typedef struct {
129 uint32_t attributeID;
130 union {
131 struct {
132 void *buffer;
133 uint32_t length;
134 } ref;
135 struct {
136 uint32_t a, b;
137 } value;
138 } content;
140
141#ifndef DOXYGEN_SHOULD_SKIP_THIS
142#define DMREQ_FINISH 0
143#define DMREQ_WRITE 1
144#endif /*DOXYGEN_SHOULD_SKIP_THIS*/
145
146/* Cryptographic Operations API */
147
148typedef enum {
157
158typedef struct {
159 uint32_t algorithm;
161 uint32_t mode;
162 uint32_t digestLength;
163 uint32_t maxKeySize;
164 uint32_t keySize;
166 uint32_t handleState;
168
169typedef struct {
170 uint32_t keySize;
173
174typedef struct {
175 uint32_t algorithm;
177 uint32_t mode;
178 uint32_t digestLength;
179 uint32_t maxKeySize;
180 uint32_t handleState;
182 uint32_t numberOfKeys;
183 TEE_OperationInfoKey keyInformation[];
185
186/* Time & Date API */
187
188typedef struct {
189 uint32_t seconds;
190 uint32_t millis;
191} TEE_Time;
192
193/* TEE Arithmetical APIs */
194
195typedef uint32_t TEE_BigInt;
196
197typedef uint32_t TEE_BigIntFMM;
198
199typedef uint32_t TEE_BigIntFMMContext __aligned(__alignof__(void *));
200
201/* Tee Secure Element APIs */
202
203typedef struct __TEE_SEServiceHandle *TEE_SEServiceHandle;
204typedef struct __TEE_SEReaderHandle *TEE_SEReaderHandle;
205typedef struct __TEE_SESessionHandle *TEE_SESessionHandle;
206typedef struct __TEE_SEChannelHandle *TEE_SEChannelHandle;
207
208typedef struct {
213
214typedef struct {
215 uint8_t *buffer;
216 size_t bufferLen;
217} TEE_SEAID;
218
219/* Other definitions */
220typedef uint32_t TEE_ErrorOrigin;
221typedef void *TEE_Session;
222
223#ifndef DOXYGEN_SHOULD_SKIP_THIS
224#define TEE_MEM_INPUT 0x00000001
225#define TEE_MEM_OUTPUT 0x00000002
226
227#define TEE_MEMREF_0_USED 0x00000001
228#define TEE_MEMREF_1_USED 0x00000002
229#define TEE_MEMREF_2_USED 0x00000004
230#define TEE_MEMREF_3_USED 0x00000008
231
232#define TEE_SE_READER_NAME_MAX 20
233#endif /*DOXYGEN_SHOULD_SKIP_THIS*/
234
235#endif /* TEE_API_TYPES_H */
struct __TEE_OperationHandle * TEE_OperationHandle
Definition: tee_api_types.h:98
struct __TEE_SESessionHandle * TEE_SESessionHandle
Definition: tee_api_types.h:205
uint32_t TEE_BigIntFMMContext __aligned(__alignof__(void *))
Definition: tee_api_types.h:199
struct __TEE_TASessionHandle * TEE_TASessionHandle
Definition: tee_api_types.h:87
uint32_t TEE_ObjectType
Definition: tee_api_types.h:104
struct __TEE_SEServiceHandle * TEE_SEServiceHandle
Definition: tee_api_types.h:203
TEE_Whence
Definition: tee_api_types.h:122
@ TEE_DATA_SEEK_SET
Definition: tee_api_types.h:123
@ TEE_DATA_SEEK_END
Definition: tee_api_types.h:125
@ TEE_DATA_SEEK_CUR
Definition: tee_api_types.h:124
void * TEE_Session
Definition: tee_api_types.h:221
uint32_t TEE_BigInt
Definition: tee_api_types.h:195
struct __TEE_SEReaderHandle * TEE_SEReaderHandle
Definition: tee_api_types.h:204
uint32_t TEE_BigIntFMM
Definition: tee_api_types.h:197
struct __TEE_SEChannelHandle * TEE_SEChannelHandle
Definition: tee_api_types.h:206
TEE_OperationMode
Definition: tee_api_types.h:148
@ TEE_MODE_DIGEST
Definition: tee_api_types.h:154
@ TEE_MODE_MAC
Definition: tee_api_types.h:153
@ TEE_MODE_DERIVE
Definition: tee_api_types.h:155
@ TEE_MODE_SIGN
Definition: tee_api_types.h:151
@ TEE_MODE_DECRYPT
Definition: tee_api_types.h:150
@ TEE_MODE_ENCRYPT
Definition: tee_api_types.h:149
@ TEE_MODE_VERIFY
Definition: tee_api_types.h:152
struct __TEE_PropSetHandle * TEE_PropSetHandle
Definition: tee_api_types.h:94
struct __TEE_ObjectEnumHandle * TEE_ObjectEnumHandle
Definition: tee_api_types.h:97
struct __TEE_ObjectHandle * TEE_ObjectHandle
Definition: tee_api_types.h:96
uint32_t TEE_Result
Definition: tee_api_types.h:43
uint32_t TEE_ErrorOrigin
Definition: tee_api_types.h:220
Definition: tee_api_types.h:45
uint16_t timeMid
Definition: tee_api_types.h:47
uint32_t timeLow
Definition: tee_api_types.h:46
uint16_t timeHiAndVersion
Definition: tee_api_types.h:48
Definition: tee_api_types.h:57
TEE_UUID uuid
Definition: tee_api_types.h:59
uint32_t login
Definition: tee_api_types.h:58
Definition: tee_api_types.h:72
uint32_t size
Definition: tee_api_types.h:75
uint32_t b
Definition: tee_api_types.h:79
void * buffer
Definition: tee_api_types.h:74
uint32_t a
Definition: tee_api_types.h:78
Definition: tee_api_types.h:106
uint32_t handleFlags
Definition: tee_api_types.h:119
uint32_t keySize
Definition: tee_api_types.h:109
uint32_t dataSize
Definition: tee_api_types.h:117
uint32_t maxKeySize
Definition: tee_api_types.h:113
uint32_t objectType
Definition: tee_api_types.h:107
uint32_t maxObjectSize
Definition: tee_api_types.h:114
uint32_t objectUsage
Definition: tee_api_types.h:116
uint32_t objectSize
Definition: tee_api_types.h:110
uint32_t dataPosition
Definition: tee_api_types.h:118
Definition: tee_api_types.h:128
uint32_t attributeID
Definition: tee_api_types.h:129
void * buffer
Definition: tee_api_types.h:132
uint32_t a
Definition: tee_api_types.h:136
uint32_t length
Definition: tee_api_types.h:133
Definition: tee_api_types.h:158
uint32_t mode
Definition: tee_api_types.h:161
uint32_t operationClass
Definition: tee_api_types.h:160
uint32_t handleState
Definition: tee_api_types.h:166
uint32_t requiredKeyUsage
Definition: tee_api_types.h:165
uint32_t digestLength
Definition: tee_api_types.h:162
uint32_t maxKeySize
Definition: tee_api_types.h:163
uint32_t algorithm
Definition: tee_api_types.h:159
uint32_t keySize
Definition: tee_api_types.h:164
Definition: tee_api_types.h:169
uint32_t keySize
Definition: tee_api_types.h:170
uint32_t requiredKeyUsage
Definition: tee_api_types.h:171
Definition: tee_api_types.h:174
uint32_t mode
Definition: tee_api_types.h:177
uint32_t digestLength
Definition: tee_api_types.h:178
uint32_t algorithm
Definition: tee_api_types.h:175
uint32_t maxKeySize
Definition: tee_api_types.h:179
uint32_t handleState
Definition: tee_api_types.h:180
uint32_t numberOfKeys
Definition: tee_api_types.h:182
uint32_t operationState
Definition: tee_api_types.h:181
uint32_t operationClass
Definition: tee_api_types.h:176
Definition: tee_api_types.h:188
uint32_t seconds
Definition: tee_api_types.h:189
uint32_t millis
Definition: tee_api_types.h:190
Definition: tee_api_types.h:208
bool selectResponseEnable
Definition: tee_api_types.h:211
bool teeOnly
Definition: tee_api_types.h:210
bool sePresent
Definition: tee_api_types.h:209
Definition: tee_api_types.h:214
size_t bufferLen
Definition: tee_api_types.h:216
uint8_t * buffer
Definition: tee_api_types.h:215
Definition: tee_api_tee_types.h:87
Definition: tee_api_tee_types.h:114