Lines Matching refs:shdr
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()
298 res = shdr_load_pub_key(shdr, offs, (const void *)ta, in ree_fs_ta_open()
304 if (ADD_OVERFLOW(offs, shdr->img_size, &offs) || in ree_fs_ta_open()
322 shdr_free(shdr); in ree_fs_ta_open()
323 shdr = shdr_alloc_and_copy(offs, ta, ta_size); in ree_fs_ta_open()
325 if (shdr) { in ree_fs_ta_open()
327 shdr_verify_signature2, &pub_key, shdr); in ree_fs_ta_open()
334 shdr_sz = SHDR_GET_SIZE(shdr); in ree_fs_ta_open()
346 if (shdr->img_type != SHDR_TA && shdr->img_type != SHDR_BOOTSTRAP_TA && in ree_fs_ta_open()
347 shdr->img_type != SHDR_ENCRYPTED_TA) { in ree_fs_ta_open()
373 TEE_DIGEST_HASH_TO_ALGO(shdr->algo)); in ree_fs_ta_open()
379 res = crypto_hash_update(hash_ctx, (uint8_t *)shdr, sizeof(*shdr)); in ree_fs_ta_open()
383 if (shdr->img_type == SHDR_BOOTSTRAP_TA || in ree_fs_ta_open()
384 shdr->img_type == SHDR_ENCRYPTED_TA) { in ree_fs_ta_open()
421 if (shdr->img_type == SHDR_ENCRYPTED_TA) { in ree_fs_ta_open()
446 if (ta_size != offs + ehdr_sz + shdr->img_size) { in ree_fs_ta_open()
467 shdr->img_size); in ree_fs_ta_open()
475 if (ta_size != offs + shdr->img_size) { in ree_fs_ta_open()
484 handle->shdr = shdr; in ree_fs_ta_open()
498 shdr_free(shdr); in ree_fs_ta_open()
511 *size = handle->shdr->img_size; in ree_fs_ta_get_size()
520 if (!tag || *tag_len < handle->shdr->hash_size) { in ree_fs_ta_get_tag()
521 *tag_len = handle->shdr->hash_size; in ree_fs_ta_get_tag()
524 *tag_len = handle->shdr->hash_size; in ree_fs_ta_get_tag()
526 memcpy(tag, SHDR_GET_HASH(handle->shdr), handle->shdr->hash_size); in ree_fs_ta_get_tag()
536 digest = malloc(h->shdr->hash_size); in check_digest()
539 res = crypto_hash_final(h->hash_ctx, digest, h->shdr->hash_size); in check_digest()
544 if (FTMN_CALLEE_DONE_MEMCMP(memcmp, digest, SHDR_GET_HASH(h->shdr), in check_digest()
545 h->shdr->hash_size)) in check_digest()
589 if (handle->shdr->img_type == SHDR_ENCRYPTED_TA) { in ree_fs_ta_read()
618 if (handle->shdr->img_type == SHDR_ENCRYPTED_TA) { in ree_fs_ta_read()
656 free(handle->shdr); in ree_fs_ta_close()