• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 /**
17  * @addtogroup TeeTrusted
18  * @{
19  *
20  * @brief TEE(Trusted Excution Environment) API.
21  * Provides security capability APIs such as trusted storage, encryption and decryption,
22  * and trusted time for trusted application development.
23  *
24  * @since 20
25  */
26 
27 /**
28  * @file tee_drv_client.h
29  *
30  * @brief Declare tee driver client API.
31  *
32  * @library NA
33  * @kit TEEKit
34  * @syscap SystemCapability.Tee.TeeClient
35  * @since 20
36  */
37 
38 #ifndef TEE_DRV_CLIENT_H
39 #define TEE_DRV_CLIENT_H
40 
41 #include <stdint.h>
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /**
48  * @brief Open the specified driver in the TEE.
49  *
50  * @param drv_name [IN] The driver name.
51  * @param param [IN] The parameter information.
52  * @param param_len [IN] The length of the parameter.
53  *
54  * @return Returns greater than 0, which means the fd of the corresponding driver.
55  *         Returns less than or equal to 0, which means falied to open the driver.
56  *
57  * @since 20
58  */
59 int64_t tee_drv_open(const char *drv_name, const void *param, uint32_t param_len);
60 
61 /**
62  * @brief Cancels an operation.
63  *
64  * @param fd [IN] The file descriptor of the driver.
65  * @param cmd_id [IN] The command id.
66  * @param param [IN] The parameter information.
67  * @param param_len [IN] The length of the parameter.
68  *
69  * @return Returns <b>0</b> if the operation is successful.
70  *         Returns <b>-1</b> if the operation is failed.
71  *
72  * @since 20
73  */
74 int64_t tee_drv_ioctl(int64_t fd, uint32_t cmd_id, const void *param, uint32_t param_len);
75 
76 /**
77  * @brief Open the specified driver in the TEE.
78  *
79  * @param fd [IN] The file descriptor of the driver.
80  *
81  * @return Returns <b>0</b> if the operation is successful.
82  *         Returns <b>-1</b> if the operation is failed.
83  *
84  * @since 20
85  */
86 int64_t tee_drv_close(int64_t fd);
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 
92 #endif
93 /** @} */