日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

[optee]-opteeTA启动的过程(open_ta的过程)

發布時間:2025/3/21 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 [optee]-opteeTA启动的过程(open_ta的过程) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

open TA

        • 1、open TA的兩種方式
        • 2、TA的分類 & 查詢TA的順序
          • (1)、Look for already loaded TA
          • (2)、Look for pseudo TA
          • (3)、Look for user TA


★★★ 友情鏈接 : 個人博客導讀首頁—點擊此處 ★★★

1、open TA的兩種方式

  • 在CA中TEEC_OpenSession()打開一個TA
  • 在TA中TEE_OpenSession()打開一個TA

如下圖所示,是打開一個user_ta的過程,最終都是調用了rpc_load,然后再調用shdr_verify_signature()驗證TA簽名.

2、TA的分類 & 查詢TA的順序

  • Look for already loaded TA
  • Look for pseudo TA
  • Look for user TA

如代碼所示在tee_ta_manage.c的tee_ta_init_session中,先去查找已經loaded的TA,再去尋址PTA,最好才去找user TA

static TEE_Result tee_ta_init_session(TEE_ErrorOrigin *err,struct tee_ta_session_head *open_sessions,const TEE_UUID *uuid,struct tee_ta_session **sess) {TEE_Result res;struct tee_ta_ctx *ctx;struct tee_ta_session *s = calloc(1, sizeof(struct tee_ta_session));*err = TEE_ORIGIN_TEE;if (!s)return TEE_ERROR_OUT_OF_MEMORY;s->cancel_mask = true;condvar_init(&s->refc_cv);condvar_init(&s->lock_cv);s->lock_thread = THREAD_ID_INVALID;s->ref_count = 1;/** We take the global TA mutex here and hold it while doing* RPC to load the TA. This big critical section should be broken* down into smaller pieces.*/mutex_lock(&tee_ta_mutex);TAILQ_INSERT_TAIL(open_sessions, s, link);/* Look for already loaded TA */ctx = tee_ta_context_find(uuid);if (ctx) {res = tee_ta_init_session_with_context(ctx, s);if (res == TEE_SUCCESS || res != TEE_ERROR_ITEM_NOT_FOUND)goto out;}/* Look for pseudo TA */res = tee_ta_init_pseudo_ta_session(uuid, s);if (res == TEE_SUCCESS || res != TEE_ERROR_ITEM_NOT_FOUND)goto out;/* Look for user TA */res = tee_ta_init_user_ta_session(uuid, s);out:if (res == TEE_SUCCESS) {*sess = s;} else {TAILQ_REMOVE(open_sessions, s, link);free(s);}mutex_unlock(&tee_ta_mutex);return res; }
(1)、Look for already loaded TA

其實就是遍歷鏈表link,查看TA是否已經被loaded了

/* Look for already loaded TA */ctx = tee_ta_context_find(uuid);if (ctx) {res = tee_ta_init_session_with_context(ctx, s);if (res == TEE_SUCCESS || res != TEE_ERROR_ITEM_NOT_FOUND)goto out;} static struct tee_ta_ctx *tee_ta_context_find(const TEE_UUID *uuid) {struct tee_ta_ctx *ctx;TAILQ_FOREACH(ctx, &tee_ctxes, link) {if (memcmp(&ctx->uuid, uuid, sizeof(TEE_UUID)) == 0)return ctx;}return NULL; }
(2)、Look for pseudo TA

其實就算去rodata中的__start_ta_head_section段就尋找PTA

/* Look for pseudo TA */res = tee_ta_init_pseudo_ta_session(uuid, s);if (res == TEE_SUCCESS || res != TEE_ERROR_ITEM_NOT_FOUND)goto out;*(.rodata .rodata.*)/** 8 to avoid unwanted padding between __start_ta_head_section* and the first structure in ta_head_section, in 64-bit* builds*/. = ALIGN(8);__start_ta_head_section = . ;KEEP(*(ta_head_section))__stop_ta_head_section = . ;. = ALIGN(8);__start_phys_mem_map_section = . ;KEEP(*(phys_mem_map_section))__end_phys_mem_map_section = . ;. = ALIGN(8);__start_phys_sdp_mem_section = . ;KEEP(*(phys_sdp_mem_section))__end_phys_sdp_mem_section = . ;. = ALIGN(8);__start_phys_nsec_ddr_section = . ;KEEP(*(phys_nsec_ddr_section))__end_phys_nsec_ddr_section = . ;. = ALIGN(8);__start_phys_ddr_overall_section = . ;KEEP(*(phys_ddr_overall_section))__end_phys_ddr_overall_section = . ;
(3)、Look for user TA

通過RPC調用,從REE側的文件系統中讀取TA Binary

總結

以上是生活随笔為你收集整理的[optee]-opteeTA启动的过程(open_ta的过程)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。