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_ELF_VERIFY_INNER_H 13 #define TEE_ELF_VERIFY_INNER_H 14 15 #include <ta_lib_img_unpack.h> 16 #include "tee_defines.h" 17 #include "ta_framework.h" 18 #include "tee_elf_verify.h" 19 #include "dyn_conf_dispatch_inf.h" 20 21 ta_property_t *get_ta_property_ptr(void); 22 load_img_info *get_img_info(void); 23 teec_image_head *get_image_hd(void); 24 ta_payload_layer_t *get_ta_payload(void); 25 uint32_t get_img_size(void); 26 bool overflow_check(uint32_t a, uint32_t b); 27 void copy_hash_data(elf_hash_data *hash_data, uint8_t *hash_src, uint32_t hash_src_size); 28 TEE_Result tee_secure_img_manifest_extention_process(const uint8_t *extension, uint32_t extension_size, 29 manifest_extension_t *mani_ext, struct dyn_conf_t *dyn_conf); 30 bool boundary_check(uint32_t max_size, uint32_t input_size); 31 TEE_Result tee_secure_img_duplicate_buff(const uint8_t *src, uint32_t src_size, uint8_t **dst); 32 33 struct process_version { 34 uint32_t version; 35 void (*tee_free_func)(void); 36 TEE_Result (*img_copy_rsp)(elf_verify_reply *rep); 37 TEE_Result (*tee_secure_img_unpack)(uint32_t rsa_algo_len, uint32_t ta_hd_len, uint8_t *img_buf, 38 uint32_t img_size, elf_hash_data *hash_data); 39 uint32_t rsa_algo_len; 40 uint32_t ta_hd_len; 41 }; 42 43 #endif 44 45