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 PERM_SRV_COMMON_H 13 #define PERM_SRV_COMMON_H 14 15 #include <tee_defines.h> 16 #include "permission_service.h" 17 #include "tee_crypto_api.h" 18 #include "tee_crypto_hal.h" 19 20 typedef TEE_Result (*perm_srv_cmd_func)(const perm_srv_req_msg_t *req_msg, uint32_t sndr_taskid, 21 const TEE_UUID *sndr_uuid, perm_srv_reply_msg_t *rsp); 22 23 typedef struct { 24 uint32_t cmd; 25 perm_srv_cmd_func func; 26 } perm_srv_cmd_t; 27 28 int32_t perm_srv_map_from_task(uint32_t taskid, uint64_t src_vaddr, uint32_t size, uint64_t *dst_vaddr); 29 30 void perm_srv_unmap_from_task(uint64_t vaddr, uint32_t size); 31 32 TEE_Result perm_srv_get_buffer(uint64_t src_buffer, uint32_t src_len, uint32_t sndr_taskid, 33 uint8_t *dst_buffer, uint32_t dst_len); 34 35 TEE_Result perm_srv_calc_hash(const uint8_t *hash_body, size_t hash_body_size, uint8_t *hash_result, 36 size_t hash_result_size, uint32_t alg); 37 #endif 38