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_V3_ELF_VERIFY_H 13 #define TEE_V3_ELF_VERIFY_H 14 15 #include "tee_defines.h" 16 #include "tee_perm_img.h" 17 #include "tee_elf_verify.h" 18 #include "ta_load_key.h" 19 #include "tee_elf_verify_inner.h" 20 21 #define SIGN_SEC_ALG_ECDSA 1 22 #define SIGN_SEC_ALG_RSA 2 23 #define SIGN_SEC_ALG_DEFAULT 0 24 #define HASH_LEN_MAX 64 25 26 ta_cipher_layer_t *get_ta_cipher_layer(void); 27 TEE_Result process_header_v3(const uint8_t *share_buf, uint32_t buf_len); 28 TEE_Result judge_rsa_key_type(uint32_t rsa_cipher_size, enum ta_type *type); 29 TEE_Result secure_img_copy_rsp_v3(elf_verify_reply *rep); 30 void free_verify_v3(); 31 TEE_Result tee_secure_img_unpack_v3(uint32_t rsa_algo_byte_len, 32 uint32_t ta_hd_len, uint8_t *img_buf, uint32_t img_size, elf_hash_data *hash_data); 33 void get_sign_config(struct sign_config_t *config); 34 uint32_t get_v3_cipher_layer_len(void); 35 bool check_img_format_valid(struct sign_config_t *config); 36 37 #endif 38 39