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_agent.h 29 * 30 * @brief Provides the API about TA agent. 31 * 32 * @library NA 33 * @kit TEEKit 34 * @syscap SystemCapability.Tee.TeeClient 35 * @since 20 36 */ 37 38 #ifndef TEE_AGENT_H 39 #define TEE_AGENT_H 40 41 #include <stdint.h> 42 #include <tee_defines.h> 43 44 #ifdef __cplusplus 45 extern "C" { 46 #endif 47 48 /** 49 * @brief The TA sends a message to the gtask to lock the agent. 50 * 51 * @param agent_id ID of the agent that requests to be locked. 52 * 53 * @return Returns {@code TEE_SUCCESS} if the operation is successful. 54 * Returns other information otherwise. 55 * 56 * @since 20 57 */ 58 TEE_Result tee_agent_lock(uint32_t agent_id); 59 60 /** 61 * @brief Unlock the agent. 62 * 63 * @param agent_id ID of the agent that requests to be unlocked. 64 * 65 * @return Returns {@code TEE_SUCCESS} if the operation is successful. 66 * Returns other information otherwise. 67 * 68 * @since 20 69 */ 70 TEE_Result tee_agent_unlock(uint32_t agent_id); 71 72 /** 73 * @brief Send agent cmd to gtask. 74 * 75 * @param agent_id The agent ID. 76 * 77 * @return Returns {@code TEE_SUCCESS} if the operation is successful. 78 * Returns other information otherwise. 79 * 80 * @since 20 81 */ 82 TEE_Result tee_send_agent_cmd(uint32_t agent_id); 83 84 /** 85 * @brief Receive messgage in get agent buffer. 86 * 87 * @param agent_id The agent ID. 88 * @param buffer The agent buffer. 89 * @param length The length of the agent buffer. 90 * 91 * @return Returns {@code TEE_SUCCESS} if the operation is successful. 92 * Returns other information otherwise. 93 * 94 * @since 20 95 */ 96 TEE_Result tee_get_agent_buffer(uint32_t agent_id, void **buffer, uint32_t *length); 97 98 #ifdef __cplusplus 99 } 100 #endif 101 102 #endif 103 /** @} */