基本信息
源码名称:TEE相关文档 (GlobalPaltform组织)
源码大小:2.82M
文件格式:.pdf
开发语言:C/C++
更新时间:2020-08-08
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
是GlobalPlatform组织的包括TEE规范的一些文档,由于GlobalPlatform官网访问不流畅,所以下载到此给需要的同学。是研究TrustZone、OP-TEE等技术非常值得参考的文档
Contents 1 Introduction .......................................................................................................................... 11 1.1 Audience .............................................................................................................................................11 1.2 IPR Disclaimer.....................................................................................................................................11 1.3 Normative References ........................................................................................................................12 1.4 Terminology and Definitions................................................................................................................12 1.5 Abbreviations and Notations ...............................................................................................................16 1.6 Revision History ..................................................................................................................................17 2 Overview of the TEE Internal Core API ............................................................................... 18 2.1 Trusted Applications............................................................................................................................18 2.1.1 TA Interface..................................................................................................................................19 2.1.2 Instances, Sessions, Tasks, and Commands ..............................................................................20 2.1.3 Sequential Execution of Entry Points...........................................................................................20 2.1.4 Cancellations................................................................................................................................20 2.1.5 Unexpected Client Termination....................................................................................................21 2.1.6 Instance Types .............................................................................................................................21 2.1.7 Configuration, Development, and Management ..........................................................................21 2.2 Error Handling .....................................................................................................................................22 2.2.1 Normal Errors...............................................................................................................................22 2.2.2 Programmer Errors ......................................................................................................................22 2.2.3 Panics...........................................................................................................................................23 2.3 Opaque Handles ................................................................................................................................. 24 2.4 Properties ............................................................................................................................................25 2.5 Trusted Storage API for Data and Keys..............................................................................................26 2.6 Cryptographic Operations API ............................................................................................................26 2.7 Time API..............................................................................................................................................27 2.8 Arithmetical API...................................................................................................................................27 3 Common Definitions ............................................................................................................ 28 3.1 Header File..........................................................................................................................................28 3.2 Data Types ..........................................................................................................................................28 3.2.1 Basic Types..................................................................................................................................28 3.2.2 Bit Numbering...............................................................................................................................28 3.2.3 TEE_Result, TEEC_Result ..........................................................................................................28 3.2.4 TEE_UUID, TEEC_UUID .............................................................................................................29 3.3 Constants ............................................................................................................................................30 3.3.1 Return Code Ranges and Format................................................................................................30 3.3.2 Return Codes ...............................................................................................................................31 3.4 Parameter Annotations .......................................................................................................................32 3.4.1 [in], [out], and [inout].....................................................................................................................32 3.4.2 [outopt] .........................................................................................................................................32 3.4.3 [inbuf]............................................................................................................................................32 3.4.4 [outbuf] .........................................................................................................................................33 3.4.5 [outbufopt] ....................................................................................................................................33 3.4.6 [instring] and [instringopt] .............................................................................................................34 3.4.7 [outstring] and [outstringopt].........................................................................................................34 3.4.8 [ctx]...............................................................................................................................................34 4 Trusted Core Framework API .............................................................................................. 35 4.1 Data Types ..........................................................................................................................................36 4.1.1 TEE_Identity................................................................................................................................. 36 4/239 TEE Internal Core API Specification – Public Release v1.1 Copyright 2011-2014 GlobalPlatform, Inc. All Rights Reserved. The technology provided or described herein is subject to updates, revisions, and extensions by GlobalPlatform. Use of this information is governed by the GlobalPlatform license agreement and any use inconsistent with that agreement is strictly prohibited. 4.1.2 TEE_Param..................................................................................................................................36 4.1.3 TEE_TASessionHandle ...............................................................................................................36 4.1.4 TEE_PropSetHandle....................................................................................................................36 4.2 Constants ............................................................................................................................................37 4.2.1 Parameter Types..........................................................................................................................37 4.2.2 Login Types..................................................................................................................................37 4.2.3 Origin Codes ................................................................................................................................37 4.2.4 Property Set Pseudo-Handles......................................................................................................38 4.2.5 Memory Access Rights ................................................................................................................38 4.3 TA Interface .........................................................................................................................................39 4.3.1 TA_CreateEntryPoint ...................................................................................................................43 4.3.2 TA_DestroyEntryPoint..................................................................................................................43 4.3.3 TA_OpenSessionEntryPoint ........................................................................................................44 4.3.4 TA_CloseSessionEntryPoint........................................................................................................46 4.3.5 TA_InvokeCommandEntryPoint...................................................................................................47 4.3.6 Operation Parameters in the TA Interface ...................................................................................48 4.4 Property Access Functions .................................................................................................................52 4.4.1 TEE_GetPropertyAsString ...........................................................................................................54 4.4.2 TEE_GetPropertyAsBool .............................................................................................................55 4.4.3 TEE_GetPropertyAsU32 ..............................................................................................................56 4.4.4 TEE_GetPropertyAsBinaryBlock..................................................................................................57 4.4.5 TEE_GetPropertyAsUUID............................................................................................................58 4.4.6 TEE_GetPropertyAsIdentity .........................................................................................................59 4.4.7 TEE_AllocatePropertyEnumerator...............................................................................................60 4.4.8 TEE_FreePropertyEnumerator ....................................................................................................60 4.4.9 TEE_StartPropertyEnumerator ....................................................................................................61 4.4.10 TEE_ResetPropertyEnumerator ..................................................................................................61 4.4.11 TEE_GetPropertyName ...............................................................................................................62 4.4.12 TEE_GetNextProperty .................................................................................................................63 4.5 Trusted Application Configuration Properties .....................................................................................64 4.6 Client Properties..................................................................................................................................66 4.7 Implementation Properties ..................................................................................................................68 4.8 Panics..................................................................................................................................................71 4.8.1 TEE_Panic ...................................................................................................................................71 4.9 Internal Client API ...............................................................................................................................72 4.9.1 TEE_OpenTASession ..................................................................................................................72 4.9.2 TEE_CloseTASession..................................................................................................................73 4.9.3 TEE_InvokeTACommand ............................................................................................................74 4.9.4 Operation Parameters in the Internal Client API..........................................................................76 4.10 Cancellation Functions........................................................................................................................77 4.10.1 TEE_GetCancellationFlag............................................................................................................77 4.10.2 TEE_UnmaskCancellation ...........................................................................................................78 4.10.3 TEE_MaskCancellation................................................................................................................78 4.11 Memory Management Functions.........................................................................................................79 4.11.1 TEE_CheckMemoryAccessRights ...............................................................................................79 4.11.2 TEE_SetInstanceData..................................................................................................................82 4.11.3 TEE_GetInstanceData .................................................................................................................82 4.11.4 TEE_Malloc ..................................................................................................................................83 4.11.5 TEE_Realloc ................................................................................................................................85 4.11.6 TEE_Free.....................................................................................................................................86 4.11.7 TEE_MemMove............................................................................................................................86 4.11.8 TEE_MemCompare .....................................................................................................................87 TEE Internal Core API Specification – Public Release v1.1 5/239 Copyright 2011-2014 GlobalPlatform, Inc. All Rights Reserved. The technology provided or described herein is subject to updates, revisions, and extensions by GlobalPlatform. Use of this information is governed by the GlobalPlatform license agreement and any use inconsistent with that agreement is strictly prohibited. 4.11.9 TEE_MemFill................................................................................................................................88 5 Trusted Storage API for Data and Keys .............................................................................. 89 5.1 Summary of Features and Design ......................................................................................................89 5.2 Trusted Storage and Rollback Detection ............................................................................................91 5.3 Data Types ..........................................................................................................................................92 5.3.1 TEE_Attribute...............................................................................................................................92 5.3.2 TEE_ObjectInfo............................................................................................................................92 5.3.3 TEE_Whence ...............................................................................................................................93 5.3.4 TEE_ObjectHandle ......................................................................................................................93 5.3.5 TEE_ObjectEnumHandle .............................................................................................................93 5.4 Constants ............................................................................................................................................94 5.5 Generic Object Functions....................................................................................................................96 5.5.1 TEE_GetObjectInfo1 ....................................................................................................................96 5.5.2 TEE_RestrictObjectUsage1 .........................................................................................................98 5.5.3 TEE_GetObjectBufferAttribute.....................................................................................................99 5.5.4 TEE_GetObjectValueAttribute ...................................................................................................100 5.5.5 TEE_CloseObject.......................................................................................................................101 5.6 Transient Object Functions ...............................................................................................................102 5.6.1 TEE_AllocateTransientObject....................................................................................................102 5.6.2 TEE_FreeTransientObject .........................................................................................................105 5.6.3 TEE_ResetTransientObject .......................................................................................................106 5.6.4 TEE_PopulateTransientObject...................................................................................................107 5.6.5 TEE_InitRefAttribute, TEE_InitValueAttribute............................................................................111 5.6.6 TEE_CopyObjectAttributes1 ......................................................................................................112 5.6.7 TEE_GenerateKey .....................................................................................................................114 5.7 Persistent Object Functions ..............................................................................................................117 5.7.1 TEE_OpenPersistentObject.......................................................................................................117 5.7.2 TEE_CreatePersistentObject.....................................................................................................119 5.7.3 Persistent Object Sharing Rules ................................................................................................122 5.7.4 TEE_CloseAndDeletePersistentObject1....................................................................................124 5.7.5 TEE_RenamePersistentObject ..................................................................................................125 5.8 Persistent Object Enumeration Functions.........................................................................................126 5.8.1 TEE_AllocatePersistentObjectEnumerator................................................................................126 5.8.2 TEE_FreePersistentObjectEnumerator .....................................................................................127 5.8.3 TEE_ResetPersistentObjectEnumerator ...................................................................................128 5.8.4 TEE_StartPersistentObjectEnumerator .....................................................................................129 5.8.5 TEE_GetNextPersistentObject...................................................................................................130 5.9 Data Stream Access Functions.........................................................................................................131 5.9.1 TEE_ReadObjectData................................................................................................................131 5.9.2 TEE_WriteObjectData................................................................................................................133 5.9.3 TEE_TruncateObjectData ..........................................................................................................134 5.9.4 TEE_SeekObjectData ................................................................................................................135 6 Cryptographic Operations API .......................................................................................... 136 6.1 Data Types ........................................................................................................................................138 6.1.1 TEE_OperationMode .................................................................................................................138 6.1.2 TEE_OperationInfo ....................................................................................................................138 6.1.3 TEE_OperationInfoMultiple........................................................................................................139 6.1.4 TEE_OperationHandle ...............................................................................................................139 6.2 Generic Operation Functions ............................................................................................................140 6.2.1 TEE_AllocateOperation..............................................................................................................140 6.2.2 TEE_FreeOperation ...................................................................................................................144 6/239 TEE Internal Core API Specification – Public Release v1.1 Copyright 2011-2014 GlobalPlatform, Inc. All Rights Reserved. The technology provided or described herein is subject to updates, revisions, and extensions by GlobalPlatform. Use of this information is governed by the GlobalPlatform license agreement and any use inconsistent with that agreement is strictly prohibited. 6.2.3 TEE_GetOperationInfo...............................................................................................................145 6.2.4 TEE_GetOperationInfoMultiple ..................................................................................................146 6.2.5 TEE_ResetOperation .................................................................................................................148 6.2.6 TEE_SetOperationKey...............................................................................................................149 6.2.7 TEE_SetOperationKey2.............................................................................................................151 6.2.8 TEE_CopyOperation ..................................................................................................................152 6.3 Message Digest Functions................................................................................................................153 6.3.1 TEE_DigestUpdate ....................................................................................................................153 6.3.2 TEE_DigestDoFinal....................................................................................................................154 6.4 Symmetric Cipher Functions .............................................................................................................155 6.4.1 TEE_CipherInit...........................................................................................................................155 6.4.2 TEE_CipherUpdate ....................................................................................................................156 6.4.3 TEE_CipherDoFinal ...................................................................................................................157 6.5 MAC Functions..................................................................................................................................158 6.5.1 TEE_MACInit..............................................................................................................................158 6.5.2 TEE_MACUpdate.......................................................................................................................159 6.5.3 TEE_MACComputeFinal............................................................................................................160 6.5.4 TEE_MACCompareFinal............................................................................................................161 6.6 Authenticated Encryption Functions ................................................................................................. 162 6.6.1 TEE_AEInit................................................................................................................................. 162 6.6.2 TEE_AEUpdateAAD ..................................................................................................................163 6.6.3 TEE_AEUpdate..........................................................................................................................164 6.6.4 TEE_AEEncryptFinal .................................................................................................................165 6.6.5 TEE_AEDecryptFinal .................................................................................................................166 6.7 Asymmetric Functions.......................................................................................................................167 6.7.1 TEE_AsymmetricEncrypt, TEE_AsymmetricDecrypt................................................................. 167 6.7.2 TEE_AsymmetricSignDigest......................................................................................................169 6.7.3 TEE_AsymmetricVerifyDigest....................................................................................................171 6.8 Key Derivation Functions ..................................................................................................................173 6.8.1 TEE_DeriveKey..........................................................................................................................173 6.9 Random Data Generation Function ..................................................................................................174 6.9.1 TEE_GenerateRandom..............................................................................................................174 6.10 Cryptographic Algorithms Specification ............................................................................................175 6.10.1 List of Algorithm Identifiers.........................................................................................................175 6.10.2 Object Types ..............................................................................................................................179 6.10.3 Elliptic Curve Types ...................................................................................................................180 6.11 Object or Operation Attributes...........................................................................................................181 7 Time API.............................................................................................................................. 183 7.1 Data Types ........................................................................................................................................183 7.1.1 TEE_Time ..................................................................................................................................183 7.2 Time Functions..................................................................................................................................184 7.2.1 TEE_GetSystemTime ................................................................................................................184 7.2.2 TEE_Wait ...................................................................................................................................185 7.2.3 TEE_GetTAPersistentTime........................................................................................................186 7.2.4 TEE_SetTAPersistentTime ........................................................................................................188 7.2.5 TEE_GetREETime .....................................................................................................................189 8 TEE Arithmetical API.......................................................................................................... 190 8.1 Introduction........................................................................................................................................190 8.2 Error Handling and Parameter Checking ..........................................................................................190 8.3 Data Types ........................................................................................................................................ 191 8.3.1 TEE_BigInt ................................................................................................................................. 191 TEE Internal Core API Specification – Public Release v1.1 7/239 Copyright 2011-2014 GlobalPlatform, Inc. All Rights Reserved. The technology provided or described herein is subject to updates, revisions, and extensions by GlobalPlatform. Use of this information is governed by the GlobalPlatform license agreement and any use inconsistent with that agreement is strictly prohibited. 8.3.2 TEE_BigIntFMMContext ............................................................................................................192 8.3.3 TEE_BigIntFMM.........................................................................................................................192 8.4 Memory Allocation and Size of Objects ............................................................................................193 8.4.1 TEE_BigIntSizeInU32 ................................................................................................................193 8.4.2 TEE_BigIntFMMContextSizeInU32............................................................................................194 8.4.3 TEE_BigIntFMMSizeInU32 ........................................................................................................194 8.5 Initialization Functions.......................................................................................................................195 8.5.1 TEE_BigIntInit ............................................................................................................................195 8.5.2 TEE_BigIntInitFMMContext........................................................................................................196 8.5.3 TEE_BigIntInitFMM ....................................................................................................................197 8.6 Converter Functions..........................................................................................................................198 8.6.1 TEE_BigIntConvertFromOctetString..........................................................................................198 8.6.2 TEE_BigIntConvertToOctetString ..............................................................................................199 8.6.3 TEE_BigIntConvertFromS32......................................................................................................200 8.6.4 TEE_BigIntConvertToS32..........................................................................................................200 8.7 Logical Operations ............................................................................................................................201 8.7.1 TEE_BigIntCmp..........................................................................................................................201 8.7.2 TEE_BigIntCmpS32 ...................................................................................................................201 8.7.3 TEE_BigIntShiftRight .................................................................................................................202 8.7.4 TEE_BigIntGetBit .......................................................................................................................202 8.7.5 TEE_BigIntGetBitCount .............................................................................................................203 8.8 Basic Arithmetic Operations..............................................................................................................204 8.8.1 TEE_BigIntAdd...........................................................................................................................204 8.8.2 TEE_BigIntSub...........................................................................................................................205 8.8.3 TEE_BigIntNeg...........................................................................................................................206 8.8.4 TEE_BigIntMul ...........................................................................................................................207 8.8.5 TEE_BigIntSquare .....................................................................................................................208 8.8.6 TEE_BigIntDiv............................................................................................................................209 8.9 Modular Arithmetic Operations..........................................................................................................210 8.9.1 TEE_BigIntMod ..........................................................................................................................210 8.9.2 TEE_BigIntAddMod....................................................................................................................211 8.9.3 TEE_BigIntSubMod....................................................................................................................212 8.9.4 TEE_BigIntMulMod ....................................................................................................................213 8.9.5 TEE_BigIntSquareMod ..............................................................................................................214 8.9.6 TEE_BigIntInvMod .....................................................................................................................215 8.10 Other Arithmetic Operations..............................................................................................................216 8.10.1 TEE_BigIntRelativePrime...........................................................................................................216 8.10.2 TEE_BigIntComputeExtendedGcd ............................................................................................217 8.10.3 TEE_BigIntIsProbablePrime ......................................................................................................218 8.11 Fast Modular Multiplication Operations.............................................................................................219 8.11.1 TEE_BigIntConvertToFMM ........................................................................................................219 8.11.2 TEE_BigIntConvertFromFMM....................................................................................................220 8.11.3 TEE_BigIntComputeFMM ..........................................................................................................221 Annex A Panicked Function Identification.......................................................................... 222 Annex B Deprecated Functions ........................................................................................... 227 B.1.1 TEE_GetObjectInfo – Deprecated .............................................................................................227 B.1.2 TEE_RestrictObjectUsage – Deprecated ..................................................................................229 B.1.3 TEE_CopyObjectAttributes – Deprecated .................................................................................230 B.1.4 TEE_CloseAndDeletePersistentObject - Deprecated................................................................231 Annex C Normative References for Algorithms.................................................................. 232 8/239 TEE Internal Core API Specification – Public Release v1.1 Copyright 2011-2014 GlobalPlatform, Inc. All Rights Reserved. The technology provided or described herein is subject to updates, revisions, and extensions by GlobalPlatform. Use of this information is governed by the GlobalPlatform license agreement and any use inconsistent with that agreement is strictly prohibited. Functions................................................................................................................................... 236 Functions by Category ............................................................................................................. 238