Copyright
2011-2014 GlobalPlatform, Inc. All Rights Reserved.
Recipients of this document are invited to submit, with their comments, notification of any relevant patents or other intellectual property rights
(collectively, “IPR”) of which they may be aware which might be necessarily infringed by the implementation of the specification or other work
product set forth in this document, and to provide supporting documentation. 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.
GlobalPlatform Device Technology
TEE Internal Core API Specification
Version 1.1
Public Release
June 2014
D
ocument Reference: GPD_SPE_010
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.
THIS SPECIFICATION OR OTHER WORK PRODUCT IS BEING OFFERED WITHOUT ANY WARRANTY
WHATSOEVER, AND IN PARTICULAR, ANY WARRANTY OF NON-INFRINGEMENT IS EXPRESSLY
DISCLAIMED. ANY IMPLEMENTATION OF THIS SPECIFICATION OR OTHER WORK PRODUCT SHALL
BE MADE ENTIRELY AT THE IMPLEMENTER’S OWN RISK, AND NEITHER THE COMPANY, NOR ANY
OF ITS MEMBERS OR SUBMITTERS, SHALL HAVE ANY LIABILITY WHATSOEVER TO ANY
IMPLEMENTER OR THIRD PARTY FOR ANY DAMAGES OF ANY NATURE WHATSOEVER DIRECTLY
OR INDIRECTLY ARISING FROM THE IMPLEMENTATION OF THIS SPECIFICATION OR OTHER
WORK PRODUCT.
TEE Internal Core API Specification – Public Release v1.1 3/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.
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
- 1
- 2
前往页