• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 Huawei Technologies Co., Ltd.
3  * Licensed under the Mulan PSL v2.
4  * You can use this software according to the terms and conditions of the Mulan PSL v2.
5  * You may obtain a copy of Mulan PSL v2 at:
6  *     http://license.coscl.org.cn/MulanPSL2
7  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
8  * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
9  * PURPOSE.
10  * See the Mulan PSL v2 for more details.
11  */
12 #ifndef __TEE_CORE_API_H
13 #define __TEE_CORE_API_H
14 
15 #include "tee_defines.h"
16 #ifndef _TEE_TA_SESSION_HANDLE
17 #define _TEE_TA_SESSION_HANDLE
18 typedef uint32_t TEE_TASessionHandle;
19 #endif
20 
21 /*
22  * Raises a Panic in the Trusted Application instance
23  *
24  * @param panicCode [IN] informative panic code defined by the TA
25  *
26  * @return void
27  */
28 void TEE_Panic(TEE_Result panicCode);
29 
30 /*
31  * opens a new session with a Trusted Application
32  *
33  * @param destination [IN]  A pointer to a TEE_UUID structure containing the UUID of the destination Trusted
34  * Application
35  * @param cancellationRequestTimeout [IN] Timeout in milliseconds or the special value
36  * @param paramTypes  [IN]  The types of all parameters passed in the operation
37  * @param params      [IN]  The parameters passed in the operation
38  * @param session     [OUT] A pointer to a variable that will receive the client session handle
39  * @param returnOrigin[OUT] A pointer to a variable which will contain the return origin
40  *
41  * @return TEE_SUCCESS open session successfully
42  * @return TEE_ERROR_ITEM_NOT_FOUND failed to find target TA in TEE
43  * @return TEE_ERROR_ACCESS_DENIED access to the destination Trusted Application is denied
44  */
45 TEE_Result TEE_OpenTASession(const TEE_UUID *destination, uint32_t cancellationRequestTimeout, uint32_t paramTypes,
46                              TEE_Param params[TEE_PARAMS_NUM], TEE_TASessionHandle *session, uint32_t *returnOrigin);
47 
48 /*
49  * closes a client session opened by TEE_OpenTASession
50  *
51  * @param session [IN] session handle opened by TEE_OpenTASession
52  *
53  * @return void
54  */
55 void TEE_CloseTASession(TEE_TASessionHandle session);
56 
57 /*
58  * invokes a command within a session opened between the client Trusted Application instance
59  * and a destination Trusted Application instance
60  *
61  * @param session      [IN] An opened session handle
62  * @param cancellationRequestTimeout [IN] Timeout in milliseconds or the special value
63  * @param commandID    [IN] The identifier of the Command to invoke
64  * @param paramTypes   [IN] The types of all parameters passed in the operation
65  * @param params       [IN] The parameters passed in the operation
66  * @param returnOrigin [IN] A pointer to a variable which will contain the return origin
67  *
68  * @return TEE_SUCCESS invoke operation successfully
69  * @return TEE_ERROR_ACCESS_DENIED invoke command to target TA is denied
70  */
71 TEE_Result TEE_InvokeTACommand(TEE_TASessionHandle session, uint32_t cancellationRequestTimeout, uint32_t commandID,
72                                uint32_t paramTypes, TEE_Param params[TEE_PARAMS_NUM], uint32_t *returnOrigin);
73 
74 #ifndef CONFIG_OH_PLATFORM
75 /* not supported */
76 bool TEE_GetCancellationFlag(void);
77 
78 /* not supported */
79 bool TEE_UnmaskCancellation(void);
80 
81 /* not supported */
82 bool TEE_MaskCancellation(void);
83 #endif
84 
85 #endif
86