GP TEE_ObjectInfo结构体在不同的版本之间的变化
生活随笔
收集整理的這篇文章主要介紹了
GP TEE_ObjectInfo结构体在不同的版本之间的变化
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
概況和背景: 在optee SDK中使用GP標準接口開發的TA,移植到Trustonic-TEE上,編譯報錯了。rootcause:我開發的TA是參考optee_example repository的,這里的代碼使用的是GP internal API 1.1,而Trustonic-TEE的SDK已經更新到了GP internal API 1.2.1. 恰好在這兩個版本之間TEE_ObjectInfo結構體發生了變化…
詳細信息如下
在使用GP接口編寫的Crypto代碼,在optee3.12編譯通過,將其TA代碼移植到Trustonic-TEE上后編譯報錯,錯誤信息如下:
Locals/Code/gp.c:363:55: error: 'TEE_ObjectInfo' {aka 'struct <anonymous>'} has no member named 'keySize'; did you mean 'dataSize'?res = TEE_AllocateOperation(&op, alg, mode, key_info.keySize);代碼如下:
TEE_ObjectInfo key_info;res = TEE_GetObjectInfo1(key, &key_info);if (res) {EMSG("%s : error! res = 0x%x", __func__, res);return res;}res = TEE_AllocateOperation(&op, alg, mode, key_info.keySize);if (res) {EMSG("%s : error! res = 0x%x", __func__, res);return res;}究其原因,是因為在optee3.12中,目前使用的還是1.1 spec
typedef struct {uint32_t objectType;__extension__ union {uint32_t keySize; /* used in 1.1 spec */uint32_t objectSize; /* used in 1.1.1 spec */};__extension__ union {uint32_t maxKeySize; /* used in 1.1 spec */uint32_t maxObjectSize; /* used in 1.1.1 spec */};uint32_t objectUsage;uint32_t dataSize;uint32_t dataPosition;uint32_t handleFlags; } TEE_ObjectInfo;而在Trustonic-TEE中,該結構體使用了和GP TEE Internal Core API Specification版本到Version 1.2.1(2019)版本中一致的數據類型
typedef struct {uint32_t objectType;uint32_t objectSize;uint32_t maxObjectSize;uint32_t objectUsage;size_t dataSize;size_t dataPosition;uint32_t handleFlags; } TEE_ObjectInfo;最終的修改方案:將key_info.keySize改成key_info.objectSize
總結
以上是生活随笔為你收集整理的GP TEE_ObjectInfo结构体在不同的版本之间的变化的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [armv8-arch64]linux
- 下一篇: 写博客必备的复制黏贴