| /optee_os/core/crypto/ |
| H A D | signed_hdr.c | 20 struct shdr *shdr_alloc_and_copy(size_t offs, const void *img, size_t img_size) in shdr_alloc_and_copy() 23 struct shdr *shdr; in shdr_alloc_and_copy() local 28 if (ADD_OVERFLOW(offs, sizeof(struct shdr), &end) || end > img_size) in shdr_alloc_and_copy() 31 shdr_size = SHDR_GET_SIZE((const struct shdr *)(img_va + offs)); in shdr_alloc_and_copy() 38 shdr = malloc(shdr_size); in shdr_alloc_and_copy() 39 if (!shdr) in shdr_alloc_and_copy() 41 memcpy(shdr, (const uint8_t *)img + offs, shdr_size); in shdr_alloc_and_copy() 44 if (shdr_size != SHDR_GET_SIZE(shdr)) { in shdr_alloc_and_copy() 45 free(shdr); in shdr_alloc_and_copy() 49 return shdr; in shdr_alloc_and_copy() [all …]
|
| /optee_os/core/include/ |
| H A D | signed_hdr.h | 34 struct shdr { struct 53 static inline size_t shdr_get_size(const struct shdr *shdr) in shdr_get_size() argument 55 size_t s = sizeof(*shdr); in shdr_get_size() 57 if (ADD_OVERFLOW(s, shdr->hash_size, &s) || in shdr_get_size() 58 ADD_OVERFLOW(s, shdr->sig_size, &s)) in shdr_get_size() 65 #define SHDR_GET_HASH(x) (uint8_t *)(((struct shdr *)(x)) + 1) 190 struct shdr *shdr_alloc_and_copy(size_t offs, const void *img, size_t img_size); 193 static inline void shdr_free(struct shdr *shdr) in shdr_free() argument 195 free(shdr); in shdr_free() 210 TEE_Result shdr_load_pub_key(const struct shdr *shdr, size_t offs, [all …]
|
| /optee_os/core/pta/ |
| H A D | secstor_ta_mgmt.c | 40 static TEE_Result install_ta(struct shdr *shdr, const uint8_t *nw, in install_ta() argument 52 if (shdr->img_type != SHDR_BOOTSTRAP_TA) in install_ta() 55 if (nw_size < (sizeof(struct shdr_bootstrap_ta) + SHDR_GET_SIZE(shdr))) in install_ta() 58 if (shdr->hash_size > buf_size) in install_ta() 70 TEE_DIGEST_HASH_TO_ALGO(shdr->algo)); in install_ta() 76 res = crypto_hash_update(hash_ctx, (uint8_t *)shdr, sizeof(*shdr)); in install_ta() 80 offs = SHDR_GET_SIZE(shdr); in install_ta() 118 res = crypto_hash_final(hash_ctx, buf, shdr->hash_size); in install_ta() 121 if (consttime_memcmp(buf, SHDR_GET_HASH(shdr), shdr->hash_size)) { in install_ta() 143 struct shdr *shdr; in bootstrap() local [all …]
|
| /optee_os/ta/remoteproc/src/ |
| H A D | elf_parser.c | 100 Elf32_Shdr *shdr = NULL; in e32_parser_find_rsc_table() local 110 shdr = (void *)(fw + ehdr->e_shoff); in e32_parser_find_rsc_table() 111 if (!IS_ALIGNED_WITH_TYPE(shdr, uint32_t) || in e32_parser_find_rsc_table() 112 !va_in_fwm_image_range(shdr, fw, fw_size)) in e32_parser_find_rsc_table() 115 name_table = (char *)elf_data + shdr[ehdr->e_shstrndx].sh_offset; in e32_parser_find_rsc_table() 119 for (i = 0; i < ehdr->e_shnum; i++, shdr++) { in e32_parser_find_rsc_table() 120 size_t size = shdr->sh_size; in e32_parser_find_rsc_table() 121 size_t offset = shdr->sh_offset; in e32_parser_find_rsc_table() 124 if (!va_in_fwm_image_range(shdr, fw, fw_size)) in e32_parser_find_rsc_table() 127 if (strcmp(name_table + shdr->sh_name, ".resource_table")) in e32_parser_find_rsc_table() [all …]
|
| H A D | elf_parser.h | 49 Elf32_Shdr *shdr; member
|
| /optee_os/core/kernel/ |
| H A D | ree_fs_ta.c | 61 struct shdr *nw_ta; /* Non-secure (shared memory) */ 65 struct shdr *shdr; /* Verified secure copy of @nw_ta's signed header */ member 196 static TEE_Result rpc_load(const TEE_UUID *uuid, struct shdr **ta, in rpc_load() 247 struct shdr *shdr = NULL; in ree_fs_ta_open() local 250 struct shdr *ta = NULL; in ree_fs_ta_open() 271 shdr = shdr_alloc_and_copy(0, ta, ta_size); in ree_fs_ta_open() 272 if (!shdr) { in ree_fs_ta_open() 278 FTMN_CALL_FUNC(res, &ftmn, FTMN_INCR0, shdr_verify_signature, shdr); in ree_fs_ta_open() 283 shdr_sz = SHDR_GET_SIZE(shdr); in ree_fs_ta_open() 290 while (shdr->img_type == SHDR_SUBKEY) { in ree_fs_ta_open() [all …]
|
| /optee_os/ldelf/ |
| H A D | ta_elf_rel.c | 341 Elf32_Shdr *shdr = elf->shdr; in e32_relocate() local 351 assert(shdr[rel_sidx].sh_type == SHT_REL); in e32_relocate() 353 assert(shdr[rel_sidx].sh_entsize == sizeof(Elf32_Rel)); in e32_relocate() 355 sym_tab_idx = shdr[rel_sidx].sh_link; in e32_relocate() 363 assert(shdr[sym_tab_idx].sh_entsize == sizeof(Elf32_Sym)); in e32_relocate() 366 if (ADD_OVERFLOW(shdr[sym_tab_idx].sh_addr, in e32_relocate() 367 shdr[sym_tab_idx].sh_size, &sh_end)) in e32_relocate() 373 shdr[sym_tab_idx].sh_addr); in e32_relocate() 375 num_syms = shdr[sym_tab_idx].sh_size / sizeof(Elf32_Sym); in e32_relocate() 377 str_tab_idx = shdr[sym_tab_idx].sh_link; in e32_relocate() [all …]
|
| H A D | ta_elf.c | 307 Elf32_Shdr *shdr = elf->shdr; in save_hashtab() local 310 void *addr = (void *)(vaddr_t)(shdr[n].sh_addr + in save_hashtab() 313 if (shdr[n].sh_type == SHT_HASH) { in save_hashtab() 315 } else if (shdr[n].sh_type == SHT_GNU_HASH) { in save_hashtab() 317 elf->gnu_hashtab_size = shdr[n].sh_size; in save_hashtab() 321 Elf64_Shdr *shdr = elf->shdr; in save_hashtab() local 324 void *addr = (void *)(vaddr_t)(shdr[n].sh_addr + in save_hashtab() 327 if (shdr[n].sh_type == SHT_HASH) { in save_hashtab() 329 } else if (shdr[n].sh_type == SHT_GNU_HASH) { in save_hashtab() 331 elf->gnu_hashtab_size = shdr[n].sh_size; in save_hashtab() [all …]
|
| H A D | ta_elf.h | 51 void *shdr; member
|
| /optee_os/scripts/ |
| H A D | sign_encrypt.py | 370 self.shdr = struct.pack('<IIIIHH', SHDR_MAGIC, img_type, len(self.img), 379 h.update(self.shdr) 478 self.shdr = self.inf[offs:offs + SHDR_SIZE] 480 sig_size] = struct.unpack('<IIIIHH', self.shdr) 656 shdr = self.inf[offs:offs + SHDR_SIZE] 658 sig_size] = struct.unpack('<IIIIHH', shdr) 815 f.write(self.shdr)
|
| H A D | sign_rproc_fw.py | 276 self.shdr = struct.pack('<IIIII',
|