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 13 #ifndef TEE_LOADER_IMG_LOAD_H 14 #define TEE_LOADER_IMG_LOAD_H 15 16 #include <stdint.h> 17 18 #ifndef ARRAY_SIZE 19 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) 20 #endif 21 22 #define KEY_INFO_MAX 8 23 24 struct asym_key_t { 25 uint32_t key_magic; 26 uint32_t key_offset; 27 uint32_t key_size; 28 }; 29 30 struct secure_img_header { 31 uint32_t header_size; 32 unsigned long long kernel_load_addr; 33 uint32_t kernel_size; 34 uint32_t task_num; 35 uint32_t task_total_size; 36 uint32_t got_size; 37 unsigned long long image_load_addr; 38 unsigned long long task_offset; 39 unsigned long long kernel_offset; 40 uint32_t sig_key_version; 41 unsigned long long sig_offset; 42 struct asym_key_t teeos_key_info[KEY_INFO_MAX]; 43 } __attribute__((packed)); 44 45 /* 46 * part_name: teeos partition name 47 * part_size: part_name buffer size 48 * maybe have other arguments 49 */ 50 int32_t load_teeos(const char *part_name, uint32_t part_size, ...); 51 52 #endif 53