1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *    http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef __TEE_DEFINES_H
17 #define __TEE_DEFINES_H
18 
19 /**
20  * @addtogroup TeeTrusted
21  * @{
22  *
23  * @brief TEE(Trusted Excution Environment) API.
24  * Provides security capability APIs such as trusted storage, encryption and decryption,
25  * and trusted time for trusted application development.
26  *
27  * @since 12
28  */
29 
30 /**
31  * @file tee_defines.h
32  *
33  * @brief Defines basic data types and data structures of TEE.
34  *
35  * @library NA
36  * @kit TEEKit
37  * @syscap SystemCapability.Tee.TeeClient
38  * @since 12
39  * @version 1.0
40  */
41 
42 #include <stdint.h>
43 #include <stdbool.h>
44 #include <stddef.h>
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 #ifndef TA_EXPORT
50 #define TA_EXPORT
51 #endif
52 
53 /**
54  * @brief Defines the tee mutex handle.
55  *
56  * @since 12
57  */
58 typedef int *tee_mutex_handle;
59 
60 #define API_LEVEL1_1_1 2
61 #define API_LEVEL1_2   3
62 
63 #define TEE_PARAMS_NUM 4
64 #undef true
65 #define true 1
66 
67 #undef false
68 #define false 0
69 
70 #ifndef NULL
71 #define NULL ((void *)0)
72 #endif
73 
74 #define PARAM_NOT_USED(val) ((void)(val))
75 
76 /**
77  * @brief Enumerates the TEE parameter.
78  *
79  * @since 12
80  */
81 typedef union {
82     struct {
83         void *buffer;
84         size_t size;
85     } memref;
86     struct {
87         unsigned int a;
88         unsigned int b;
89     } value;
90     struct {
91         void *buffer;
92         size_t size;
93     } sharedmem;
94 } TEE_Param;
95 
96 #define TEE_PARAM_TYPES(param0Type, param1Type, param2Type, param3Type) \
97     (((param3Type) << 12) | ((param2Type) << 8) | ((param1Type) << 4) | (param0Type))
98 
99 #define TEE_PARAM_TYPE_GET(paramTypes, index) (((paramTypes) >> (4U * (index))) & 0x0F)
100 
101 /**
102  * @brief Checks parameter types.
103  *
104  * @param param_to_check Indicates the expected parameter values.
105  * @param valid0 Indicates the first parameter type to check.
106  * @param valid1 Indicates the second parameter type to check.
107  * @param valid2 Indicates the third parameter type to check.
108  * @param valid3 Indicates the fourth parameter type to check.
109  *
110  * @return Returns <b>true</b> if the parameter types are correct.
111  *         Returns <b>false</b> otherwise.
112  * @since 12
113  */
check_param_type(uint32_t param_to_check, uint32_t valid0, uint32_t valid1, uint32_t valid2, uint32_t valid3)114 static inline bool check_param_type(uint32_t param_to_check, uint32_t valid0, uint32_t valid1, uint32_t valid2,
115                                     uint32_t valid3)
116 {
117     return (TEE_PARAM_TYPES(valid0, valid1, valid2, valid3) == param_to_check);
118 }
119 
120 /**
121  * @brief Enumerates the types of the TEE parameter.
122  *
123  * @since 12
124  */
125 enum TEE_ParamType {
126     TEE_PARAM_TYPE_NONE             = 0x0,
127     TEE_PARAM_TYPE_VALUE_INPUT      = 0x1,
128     TEE_PARAM_TYPE_VALUE_OUTPUT     = 0x2,
129     TEE_PARAM_TYPE_VALUE_INOUT      = 0x3,
130     TEE_PARAM_TYPE_MEMREF_INPUT     = 0x5,
131     TEE_PARAM_TYPE_MEMREF_OUTPUT    = 0x6,
132     TEE_PARAM_TYPE_MEMREF_INOUT     = 0x7,
133     TEE_PARAM_TYPE_ION_INPUT        = 0x8,
134     TEE_PARAM_TYPE_ION_SGLIST_INPUT = 0x9,
135     TEE_PARAM_TYPE_MEMREF_SHARED_INOUT = 0xa,
136     TEE_PARAM_TYPE_RESMEM_INPUT        = 0xc,
137     TEE_PARAM_TYPE_RESMEM_OUTPUT       = 0xd,
138     TEE_PARAM_TYPE_RESMEM_INOUT        = 0xe,
139 };
140 
141 #define S_VAR_NOT_USED(variable) \
142     do {                         \
143         (void)(variable);        \
144     } while (0)
145 
146 /**
147  * @brief Defines an object information.
148  *
149  * @since 12
150  */
151 typedef struct {
152     uint32_t objectType;
153     uint32_t objectSize;
154     uint32_t maxObjectSize;
155     uint32_t objectUsage;
156     uint32_t dataSize;
157     uint32_t dataPosition;
158     uint32_t handleFlags;
159 } TEE_ObjectInfo;
160 
161 /**
162  * @brief Defines an object attribute.
163  *
164  * @since 12
165  */
166 typedef struct {
167     uint32_t attributeID;
168     union {
169         struct {
170             void *buffer;
171             size_t length;
172         } ref;
173         struct {
174             uint32_t a;
175             uint32_t b;
176         } value;
177     } content;
178 } TEE_Attribute;
179 
180 /**
181  * @brief Enumerates the types of object attribute.
182  *
183  * @since 12
184  */
185 enum TEE_ObjectAttribute {
186     TEE_ATTR_SECRET_VALUE          = 0xC0000000,
187     TEE_ATTR_RSA_MODULUS           = 0xD0000130,
188     TEE_ATTR_RSA_PUBLIC_EXPONENT   = 0xD0000230,
189     TEE_ATTR_RSA_PRIVATE_EXPONENT  = 0xC0000330,
190     TEE_ATTR_RSA_PRIME1            = 0xC0000430,
191     TEE_ATTR_RSA_PRIME2            = 0xC0000530,
192     TEE_ATTR_RSA_EXPONENT1         = 0xC0000630,
193     TEE_ATTR_RSA_EXPONENT2         = 0xC0000730,
194     TEE_ATTR_RSA_COEFFICIENT       = 0xC0000830,
195     TEE_ATTR_RSA_MGF1_HASH         = 0xF0000830,
196     TEE_ATTR_DSA_PRIME             = 0xD0001031,
197     TEE_ATTR_DSA_SUBPRIME          = 0xD0001131,
198     TEE_ATTR_DSA_BASE              = 0xD0001231,
199     TEE_ATTR_DSA_PUBLIC_VALUE      = 0xD0000131,
200     TEE_ATTR_DSA_PRIVATE_VALUE     = 0xC0000231,
201     TEE_ATTR_DH_PRIME              = 0xD0001032,
202     TEE_ATTR_DH_SUBPRIME           = 0xD0001132,
203     TEE_ATTR_DH_BASE               = 0xD0001232,
204     TEE_ATTR_DH_X_BITS             = 0xF0001332,
205     TEE_ATTR_DH_PUBLIC_VALUE       = 0xD0000132,
206     TEE_ATTR_DH_PRIVATE_VALUE      = 0xC0000232,
207     TEE_ATTR_RSA_OAEP_LABEL        = 0xD0000930,
208     TEE_ATTR_RSA_PSS_SALT_LENGTH   = 0xF0000A30,
209     TEE_ATTR_ECC_PUBLIC_VALUE_X    = 0xD0000141,
210     TEE_ATTR_ECC_PUBLIC_VALUE_Y    = 0xD0000241,
211     TEE_ATTR_ECC_PRIVATE_VALUE     = 0xC0000341,
212     TEE_ATTR_ECC_CURVE             = 0xF0000441,
213     TEE_ATTR_ED25519_CTX           = 0xD0000643,
214     TEE_ATTR_ED25519_PUBLIC_VALUE  = 0xD0000743,
215     TEE_ATTR_ED25519_PRIVATE_VALUE = 0xC0000843,
216     TEE_ATTR_ED25519_PH            = 0xF0000543,
217     TEE_ATTR_X25519_PUBLIC_VALUE   = 0xD0000944,
218     TEE_ATTR_X25519_PRIVATE_VALUE  = 0xC0000A44,
219     TEE_ATTR_PBKDF2_HMAC_PASSWORD  = 0xD0000133,
220     TEE_ATTR_PBKDF2_HMAC_SALT      = 0xD0000134,
221     TEE_ATTR_PBKDF2_HMAC_DIGEST    = 0xF0000135,
222 };
223 
224 /**
225  * @brief Enumerates the types of object.
226  *
227  * @since 12
228  */
229 enum TEE_ObjectType {
230     TEE_TYPE_AES                = 0xA0000010,
231     TEE_TYPE_DES                = 0xA0000011,
232     TEE_TYPE_DES3               = 0xA0000013,
233     TEE_TYPE_HMAC_MD5           = 0xA0000001,
234     TEE_TYPE_HMAC_SHA1          = 0xA0000002,
235     TEE_TYPE_HMAC_SHA224        = 0xA0000003,
236     TEE_TYPE_HMAC_SHA256        = 0xA0000004,
237     TEE_TYPE_HMAC_SHA384        = 0xA0000005,
238     TEE_TYPE_HMAC_SHA512        = 0xA0000006,
239     TEE_TYPE_RSA_PUBLIC_KEY     = 0xA0000030,
240     TEE_TYPE_RSA_KEYPAIR        = 0xA1000030,
241     TEE_TYPE_DSA_PUBLIC_KEY     = 0xA0000031,
242     TEE_TYPE_DSA_KEYPAIR        = 0xA1000031,
243     TEE_TYPE_DH_KEYPAIR         = 0xA1000032,
244     TEE_TYPE_GENERIC_SECRET     = 0xA0000000,
245     TEE_TYPE_DATA               = 0xA1000033,
246     TEE_TYPE_DATA_GP1_1         = 0xA00000BF,
247     TEE_TYPE_ECDSA_PUBLIC_KEY   = 0xA0000041,
248     TEE_TYPE_ECDSA_KEYPAIR      = 0xA1000041,
249     TEE_TYPE_ECDH_PUBLIC_KEY    = 0xA0000042,
250     TEE_TYPE_ECDH_KEYPAIR       = 0xA1000042,
251     TEE_TYPE_ED25519_PUBLIC_KEY = 0xA0000043,
252     TEE_TYPE_ED25519_KEYPAIR    = 0xA1000043,
253     TEE_TYPE_X25519_PUBLIC_KEY  = 0xA0000044,
254     TEE_TYPE_X25519_KEYPAIR     = 0xA1000044,
255     TEE_TYPE_SM2_DSA_PUBLIC_KEY = 0xA0000045,
256     TEE_TYPE_SM2_DSA_KEYPAIR    = 0xA1000045,
257     TEE_TYPE_SM2_KEP_PUBLIC_KEY = 0xA0000046,
258     TEE_TYPE_SM2_KEP_KEYPAIR    = 0xA1000046,
259     TEE_TYPE_SM2_PKE_PUBLIC_KEY = 0xA0000047,
260     TEE_TYPE_SM2_PKE_KEYPAIR    = 0xA1000047,
261     TEE_TYPE_HMAC_SM3           = 0xA0000007,
262     TEE_TYPE_SM4                = 0xA0000014,
263     TEE_TYPE_SIP_HASH           = 0xF0000002,
264     TEE_TYPE_PBKDF2_HMAC        = 0xF0000004,
265 
266     TEE_TYPE_CORRUPTED_OBJECT = 0xA00000BE,
267 };
268 
269 #define OBJECT_NAME_LEN_MAX 255
270 
271 /**
272  * @brief Defines an object handle.
273  *
274  * @since 12
275  */
276 struct __TEE_ObjectHandle {
277     void *dataPtr;
278     uint32_t dataLen;
279     uint8_t dataName[OBJECT_NAME_LEN_MAX];
280     TEE_ObjectInfo *ObjectInfo;
281     TEE_Attribute *Attribute;
282     uint32_t attributesLen;
283     uint32_t CRTMode;
284     void *infoattrfd;
285     uint32_t generate_flag;
286     uint32_t storage_id;
287 };
288 
289 /**
290  * @brief Defines the <b>__TEE_ObjectHandle</b> struct.
291  *
292  * @see __TEE_ObjectHandle
293  *
294  * @since 12
295  */
296 typedef struct __TEE_ObjectHandle *TEE_ObjectHandle;
297 
298 #define NODE_LEN 8
299 
300 /**
301  * @brief Defines an UUID of TA.
302  *
303  * @since 12
304  */
305 typedef struct tee_uuid {
306     uint32_t timeLow;
307     uint16_t timeMid;
308     uint16_t timeHiAndVersion;
309     uint8_t clockSeqAndNode[NODE_LEN];
310 } TEE_UUID;
311 
312 /**
313  * @brief Defines the type of spawn UUID.
314  *
315  * @since 12
316  */
317 typedef struct spawn_uuid {
318     uint64_t uuid_valid;
319     TEE_UUID uuid;
320 } spawn_uuid_t;
321 
322 /**
323  * @brief Enumerates the result codes used in the TEEKit APIs.
324  *
325  * @since 12
326  */
327 enum TEE_Result_Value {
328     /* The operation is successful. */
329     TEE_SUCCESS                        = 0x00000000,
330     /* The command is invalid. */
331     TEE_ERROR_INVALID_CMD              = 0x00000001,
332     /* The service does not exist. */
333     TEE_ERROR_SERVICE_NOT_EXIST        = 0x00000002,
334     /* The session does not exist. */
335     TEE_ERROR_SESSION_NOT_EXIST        = 0x00000003,
336     /* The number of sessions exceeds the limit. */
337     TEE_ERROR_SESSION_MAXIMUM          = 0x00000004,
338     /* The service has been already registered. */
339     TEE_ERROR_REGISTER_EXIST_SERVICE   = 0x00000005,
340     /* An internal error occurs. */
341     TEE_ERROR_TARGET_DEAD_FATAL        = 0x00000006,
342     /* Failed to read data. */
343     TEE_ERROR_READ_DATA                = 0x00000007,
344     /* Failed to write data. */
345     TEE_ERROR_WRITE_DATA               = 0x00000008,
346     /* Failed to truncate data. */
347     TEE_ERROR_TRUNCATE_OBJECT          = 0x00000009,
348     /* Failed to seek data. */
349     TEE_ERROR_SEEK_DATA                = 0x0000000A,
350     /* Failed to synchronize data. */
351     TEE_ERROR_SYNC_DATA                = 0x0000000B,
352     /* Failed to rename the file. */
353     TEE_ERROR_RENAME_OBJECT            = 0x0000000C,
354     /* An error occurs when the TA is loaded. */
355     TEE_ERROR_TRUSTED_APP_LOAD_ERROR   = 0x0000000D,
356     /* An I/O error occurs when data is stored. */
357     TEE_ERROR_STORAGE_EIO              = 0x80001001,
358     /* The storage section is unavailable. */
359     TEE_ERROR_STORAGE_EAGAIN           = 0x80001002,
360     /* The operation target is not a directory. */
361     TEE_ERROR_STORAGE_ENOTDIR          = 0x80001003,
362     /* This operation cannot be performed on a directory. */
363     TEE_ERROR_STORAGE_EISDIR           = 0x80001004,
364     /* The number of opened files exceeds the limit in system. */
365     TEE_ERROR_STORAGE_ENFILE           = 0x80001005,
366     /* The number of files opened for the process exceeds the limit.*/
367     TEE_ERROR_STORAGE_EMFILE           = 0x80001006,
368     /* The storage section is read only. */
369     TEE_ERROR_STORAGE_EROFS            = 0x80001007,
370     /* The file path is not correct. */
371     TEE_ERROR_STORAGE_PATH_WRONG       = 0x8000100A,
372     /* The service message queue overflows. */
373     TEE_ERROR_MSG_QUEUE_OVERFLOW       = 0x8000100B,
374     /* The file object is corrupted. */
375     TEE_ERROR_CORRUPT_OBJECT           = 0xF0100001,
376     /* The storage section is unavailable. */
377     TEE_ERROR_STORAGE_NOT_AVAILABLE    = 0xF0100003,
378     /* The cipher text is incorrect. */
379     TEE_ERROR_CIPHERTEXT_INVALID       = 0xF0100006,
380     /* Protocol error in socket connection. */
381     TEE_ISOCKET_ERROR_PROTOCOL         = 0xF1007001,
382     /* The socket is closed by the remote end. */
383     TEE_ISOCKET_ERROR_REMOTE_CLOSED    = 0xF1007002,
384     /* The socket connection timed out. */
385     TEE_ISOCKET_ERROR_TIMEOUT          = 0xF1007003,
386     /* There is no resource available for the socket connection. */
387     TEE_ISOCKET_ERROR_OUT_OF_RESOURCES = 0xF1007004,
388     /* The buffer is too large for the socket connection. */
389     TEE_ISOCKET_ERROR_LARGE_BUFFER     = 0xF1007005,
390     /* A warning is given in the socket connection. */
391     TEE_ISOCKET_WARNING_PROTOCOL       = 0xF1007006,
392     /* Generic error. */
393     TEE_ERROR_GENERIC                  = 0xFFFF0000,
394     /* The access is denied. */
395     TEE_ERROR_ACCESS_DENIED            = 0xFFFF0001,
396     /* The operation has been canceled. */
397     TEE_ERROR_CANCEL                   = 0xFFFF0002,
398     /* An access conflict occurs. */
399     TEE_ERROR_ACCESS_CONFLICT          = 0xFFFF0003,
400     /* The data size exceeds the maximum. */
401     TEE_ERROR_EXCESS_DATA              = 0xFFFF0004,
402     /* Incorrect data format. */
403     TEE_ERROR_BAD_FORMAT               = 0xFFFF0005,
404     /* Incorrect parameters. */
405     TEE_ERROR_BAD_PARAMETERS           = 0xFFFF0006,
406     /* The current state does not support the operation. */
407     TEE_ERROR_BAD_STATE                = 0xFFFF0007,
408     /* Failed to find the target item. */
409     TEE_ERROR_ITEM_NOT_FOUND           = 0xFFFF0008,
410     /* The API is not implemented. */
411     TEE_ERROR_NOT_IMPLEMENTED          = 0xFFFF0009,
412     /* The API is not supported. */
413     TEE_ERROR_NOT_SUPPORTED            = 0xFFFF000A,
414     /* There is no data available for this operation. */
415     TEE_ERROR_NO_DATA                  = 0xFFFF000B,
416     /* There is no memory available for this operation. */
417     TEE_ERROR_OUT_OF_MEMORY            = 0xFFFF000C,
418     /* The system does not respond to this operation. */
419     TEE_ERROR_BUSY                     = 0xFFFF000D,
420     /* Failed to communicate with the target. */
421     TEE_ERROR_COMMUNICATION            = 0xFFFF000E,
422     /* A security error occurs. */
423     TEE_ERROR_SECURITY                 = 0xFFFF000F,
424     /* The buffer is insufficient for this operation. */
425     TEE_ERROR_SHORT_BUFFER             = 0xFFFF0010,
426     /* The operation has been canceled. */
427     TEE_ERROR_EXTERNAL_CANCEL          = 0xFFFF0011,
428     /* The service is in the pending state (asynchronous state). */
429     TEE_PENDING                        = 0xFFFF2000,
430     /* The service is in the pending state(). */
431     TEE_PENDING2                       = 0xFFFF2001,
432     /* Reserved. */
433     TEE_PENDING3                       = 0xFFFF2002,
434     /* The operation timed out. */
435     TEE_ERROR_TIMEOUT                  = 0xFFFF3001,
436     /* Overflow occurs. */
437     TEE_ERROR_OVERFLOW                 = 0xFFFF300f,
438     /* The TA is crashed. */
439     TEE_ERROR_TARGET_DEAD              = 0xFFFF3024,
440     /* There is no enough space to store data. */
441     TEE_ERROR_STORAGE_NO_SPACE         = 0xFFFF3041,
442     /* The MAC operation failed. */
443     TEE_ERROR_MAC_INVALID              = 0xFFFF3071,
444     /* The signature verification failed. */
445     TEE_ERROR_SIGNATURE_INVALID        = 0xFFFF3072,
446     /* Interrupted by CFC. Broken control flow is detected. */
447     TEE_CLIENT_INTR                    = 0xFFFF4000,
448     /* Time is not set. */
449     TEE_ERROR_TIME_NOT_SET             = 0xFFFF5000,
450     /* Time needs to be reset. */
451     TEE_ERROR_TIME_NEEDS_RESET         = 0xFFFF5001,
452     /* System error. */
453     TEE_FAIL                           = 0xFFFF5002,
454     /* Base value of the timer error code. */
455     TEE_ERROR_TIMER                    = 0xFFFF6000,
456     /* Failed to create the timer. */
457     TEE_ERROR_TIMER_CREATE_FAILED      = 0xFFFF6001,
458     /* Failed to destroy the timer. */
459     TEE_ERROR_TIMER_DESTORY_FAILED     = 0xFFFF6002,
460     /* The timer is not found. */
461     TEE_ERROR_TIMER_NOT_FOUND          = 0xFFFF6003,
462     /* Generic error of RPMB operations. */
463     TEE_ERROR_RPMB_GENERIC             = 0xFFFF7001,
464     /* Verify MAC failed in RPMB operations. */
465     TEE_ERROR_RPMB_MAC_FAIL            = 0xFFFF7002,
466     /* Incorrect message data MAC in RPMB response. */
467     TEE_ERROR_RPMB_RESP_UNEXPECT_MAC   = 0xFFFF7105,
468     /* The file is not found in RPMB.  */
469     TEE_ERROR_RPMB_FILE_NOT_FOUND      = 0xFFFF7106,
470     /* No spece left for RPMB operations. */
471     TEE_ERROR_RPMB_NOSPC               = 0xFFFF7107,
472     /* sec flash is not available. */
473     TEE_ERROR_SEC_FLASH_NOT_AVAILABLE  = 0xFFFF7118,
474     /* The BIO service is not available. */
475     TEE_ERROR_BIOSRV_NOT_AVAILABLE     = 0xFFFF711A,
476     /* The ROT service is not available.  */
477     TEE_ERROR_ROTSRV_NOT_AVAILABLE     = 0xFFFF711B,
478     /* The TA Anti-Rollback service is not available. */
479     TEE_ERROR_ARTSRV_NOT_AVAILABLE     = 0xFFFF711C,
480     /* The HSM service is not available. */
481     TEE_ERROR_HSMSRV_NOT_AVAILABLE     = 0xFFFF711D,
482     /* Failed to verify AntiRoot response. */
483     TEE_ERROR_ANTIROOT_RSP_FAIL        = 0xFFFF9110,
484     /* AntiRoot error in invokeCmd(). */
485     TEE_ERROR_ANTIROOT_INVOKE_ERROR    = 0xFFFF9111,
486     /* Audit failed. */
487     TEE_ERROR_AUDIT_FAIL               = 0xFFFF9112,
488     /* Unused. */
489     TEE_FAIL2                          = 0xFFFF9113,
490 };
491 
492 /**
493  * @brief Login type definitions
494  *
495  * @since 12
496  */
497 enum TEE_LoginMethod {
498     TEE_LOGIN_PUBLIC = 0x0,
499     TEE_LOGIN_USER,
500     TEE_LOGIN_GROUP,
501     TEE_LOGIN_APPLICATION      = 0x4,
502     TEE_LOGIN_USER_APPLICATION = 0x5,
503     TEE_LOGIN_GROUP_APPLICATION = 0x6,
504     TEE_LOGIN_IDENTIFY = 0x7, /* Customized login type */
505 };
506 
507 /**
508  * @brief Definitions the TEE Identity.
509  *
510  * @since 12
511  */
512 typedef struct {
513     uint32_t login;
514     TEE_UUID uuid;
515 } TEE_Identity;
516 
517 /**
518  * @brief Defines the return values.
519  *
520  * @since 12
521  * @version 1.0
522  */
523 typedef uint32_t TEE_Result;
524 
525 /**
526  * @brief Defines the return values.
527  *
528  * @since 12
529  * @version 1.0
530  */
531 typedef TEE_Result TEEC_Result;
532 
533 #define TEE_ORIGIN_TEE             0x00000003
534 #define TEE_ORIGIN_TRUSTED_APP     0x00000004
535 
536 #ifndef _TEE_TA_SESSION_HANDLE
537 #define _TEE_TA_SESSION_HANDLE
538 /**
539  * @brief Defines the handle of TA session.
540  *
541  * @since 12
542  */
543 typedef uint32_t TEE_TASessionHandle;
544 #endif
545 
546 /**
547  * @brief Defines the pointer to <b>TEE_ObjectEnumHandle</b>.
548  *
549  * @see __TEE_ObjectEnumHandle
550  *
551  * @since 12
552  */
553 typedef struct __TEE_ObjectEnumHandle *TEE_ObjectEnumHandle;
554 
555 /**
556  * @brief Defines the pointer to <b>__TEE_OperationHandle</b>.
557  *
558  * @see __TEE_OperationHandle
559  *
560  * @since 12
561  */
562 typedef struct __TEE_OperationHandle *TEE_OperationHandle;
563 
564 #define TEE_TIMEOUT_INFINITE (0xFFFFFFFF)
565 
566 /**
567  * @brief Definitions the TEE time.
568  *
569  * @since 12
570  */
571 typedef struct {
572     uint32_t seconds;
573     uint32_t millis;
574 } TEE_Time;
575 
576 /**
577  * @brief Definitions the date time of TEE.
578  *
579  * @since 12
580  */
581 typedef struct {
582     int32_t seconds;
583     int32_t millis;
584     int32_t min;
585     int32_t hour;
586     int32_t day;
587     int32_t month;
588     int32_t year;
589 } TEE_Date_Time;
590 
591 /**
592  * @brief Definitions the timer property of TEE.
593  *
594  * @since 12
595  */
596 typedef struct {
597     uint32_t type;
598     uint32_t timer_id;
599     uint32_t timer_class;
600     uint32_t reserved2;
601 } TEE_timer_property;
602 
603 #ifdef __cplusplus
604 }
605 #endif
606 /** @} */
607 #endif
608