Skip to content

Commit

Permalink
[Review] core: add interface to load and decrypt/authenticate user TAs
Browse files Browse the repository at this point in the history
- No need to check UUID twice, simplify code a bit (drop
init_session_with_ta_store()).
- Fix a compile error (unused out: label).

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
  • Loading branch information
jforissier committed May 9, 2017
1 parent 744c693 commit 3700b0f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
1 change: 0 additions & 1 deletion core/arch/arm/kernel/ree_fs_ta.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ static TEE_Result rpc_load(const TEE_UUID *uuid, struct shdr **ta,
/* Note that params[1].u.tmem.size is already assigned */

res = thread_rpc_cmd(OPTEE_MSG_RPC_CMD_LOAD_TA, 2, params);
out:
if (res != TEE_SUCCESS)
thread_rpc_free_payload(cta);
return res;
Expand Down
19 changes: 2 additions & 17 deletions core/arch/arm/kernel/user_ta.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,21 +470,6 @@ static TEE_Result user_ta_enter(TEE_ErrorOrigin *err,
return res;
}

static TEE_Result init_session_with_ta_store(const TEE_UUID *uuid,
const struct user_ta_store_ops *ta_store,
struct tee_ta_session *s)
{
TEE_Result res;

DMSG("Load user TA %pUl", (void *)uuid);
res = ta_load(uuid, ta_store, &s->ctx);
if (res != TEE_SUCCESS)
return res;
if (memcmp(uuid, &s->ctx->uuid, sizeof(TEE_UUID)));
panic();
return res;
}

static TEE_Result user_ta_enter_open_session(struct tee_ta_session *s,
struct tee_ta_param *param, TEE_ErrorOrigin *eo)
{
Expand Down Expand Up @@ -614,9 +599,9 @@ TEE_Result tee_ta_init_user_ta_session(const TEE_UUID *uuid,
if (!user_ta_store)
return TEE_ERROR_ITEM_NOT_FOUND;

res = init_session_with_ta_store(uuid, user_ta_store, s);
DMSG("Load user TA %pUl", (void *)uuid);
res = ta_load(uuid, user_ta_store, &s->ctx);
if (res == TEE_SUCCESS)
s->ctx->ops = &user_ta_ops;

return res;
}

0 comments on commit 3700b0f

Please sign in to comment.