trusted platform module library part 4: supporting routines … · trusted platform module library...
TRANSCRIPT
-
TCG
Trusted Platform Module Library
Part 4: Supporting Routines
Family "2.0"
Level 00 Revision 01.16
October 30, 2014
Published
Contact: [email protected]
TCG Published
Copyright TCG 2006-2014
-
Trusted Platform Module Library Part 4: Supporting Routines
Page ii TCG Published Family "2.0"
October 30, 2014 Copyright TCG 2006-2014 Level 00 Revision 01.16
Licenses and Notices
1. Copyright Licenses:
Trusted Computing Group (TCG) grants to the user of the source code in this specification (the Source Code) a worldwide, irrevocable, nonexclusive, royalty free, copyright license to reproduce, create derivative works, distribute, display and perform the Source Code and derivative works thereof, and to grant others the rights granted herein.
The TCG grants to the user of the other parts of the specification (other than the Source Code) the rights to reproduce, distribute, display, and perform the specification solely for the purpose of developing products based on such documents.
2. Source Code Distribution Conditions:
Redistributions of Source Code must retain the above copyright licenses, this list of conditions and the following disclaimers.
Redistributions in binary form must reproduce the above copyright licenses, this list of conditions and the following disclaimers in the documentation and/or other materials provided with the distribution.
3. Disclaimers:
THE COPYRIGHT LICENSES SET FORTH ABOVE DO NOT REPRESENT ANY FORM OF LICENSE OR WAIVER, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, WITH RESPECT TO PATENT RIGHTS HELD BY TCG MEMBERS (OR OTHER THIRD PARTIES) THAT MAY BE NECESSARY TO IMPLEMENT THIS SPECIFICATION OR OTHERWISE. Contact TCG Administration ([email protected]) for information on specification licensing rights available through TCG membership agreements.
THIS SPECIFICATION IS PROVIDED "AS IS" WITH NO EXPRESS OR IMPLIED WARRANTIES WHATSOEVER, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ACCURACY, COMPLETENESS, OR NONINFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS, OR ANY WARRANTY OTHERWISE ARISING OUT OF ANY PROPOSAL, SPECIFICATION OR SAMPLE.
Without limitation, TCG and its members and licensors disclaim all liability, including liability for infringement of any proprietary rights, relating to use of information in this specification and to the implementation of this specification, and TCG disclaims all liability for cost of procurement of substitute goods or services, lost profits, loss of use, loss of data or any incidental, consequential, direct, indirect, or special damages, whether under contract, tort, warranty or otherwise, arising in any way out of use or reliance upon this specification or any information herein.
Any marks and brands contained herein are the property of their respective owner.
mailto:[email protected]
-
Part 4: Supporting Routines Trusted Platform Module Library
Family "2.0" TCG Published Page iii
Level 00 Revision 01.16 Copyright TCG 2006-2014 October 30, 2014
CONTENTS
1 Scope ................................................................................................................................... 1
2 Terms and definitions ........................................................................................................... 1
3 Symbols and abbreviated terms ............................................................................................ 1
4 Automation ........................................................................................................................... 1
4.1 Configuration Parser ................................................................................................... 1 4.2 Structure Parser .......................................................................................................... 2
4.2.1 Introduction .......................................................................................................... 2 4.2.2 Unmarshaling Code Prototype .............................................................................. 2
4.2.2.1 Simple Types and Structures .......................................................................... 2 4.2.2.2 Union Types ................................................................................................... 3 4.2.2.3 Null Types ...................................................................................................... 3 4.2.2.4 Arrays ............................................................................................................. 3
4.2.3 Marshaling Code Function Prototypes .................................................................. 4
4.2.3.1 Simple Types and Structures .......................................................................... 4 4.2.3.2 Union Types ................................................................................................... 4 4.2.3.3 Arrays ............................................................................................................. 4
4.3 Command Parser ........................................................................................................ 5 4.4 Portability .................................................................................................................... 5
5 Header Files ......................................................................................................................... 6
5.1 Introduction ................................................................................................................. 6 5.2 BaseTypes.h ............................................................................................................... 6 5.3 bits.h ........................................................................................................................... 7 5.4 bool.h .......................................................................................................................... 8 5.5 Capabilities.h .............................................................................................................. 8 5.6 TPMB.h ....................................................................................................................... 8 5.7 TpmError.h .................................................................................................................. 9 5.8 Global.h ...................................................................................................................... 9
5.8.1 Description ........................................................................................................... 9 5.8.2 Includes ............................................................................................................... 9 5.8.3 Defines and Types ............................................................................................. 10
5.8.3.1 Unreferenced Parameter .............................................................................. 10 5.8.3.2 Crypto Self-Test Values ................................................................................ 10 5.8.3.3 Hash and HMAC State Structures ................................................................. 10 5.8.3.4 Other Types .................................................................................................. 11
5.8.4 Loaded Object Structures ................................................................................... 11
5.8.4.1 Description ................................................................................................... 11 5.8.4.2 OBJECT_ATTRIBUTES ................................................................................ 11 5.8.4.3 OBJECT Structure ........................................................................................ 12 5.8.4.4 HASH_OBJECT Structure ............................................................................. 12 5.8.4.5 ANY_OBJECT .............................................................................................. 13
5.8.5 AUTH_DUP Types .............................................................................................. 13 5.8.6 Active Session Context ....................................................................................... 13
5.8.6.1 Description ................................................................................................... 13 5.8.6.2 SESSION_ATTRIBUTES .............................................................................. 13 5.8.6.3 SESSION Structure ...................................................................................... 14
5.8.7 PCR ................................................................................................................... 15
5.8.7.1 PCR_SAVE Structure ................................................................................... 15
-
Trusted Platform Module Library Part 4: Supporting Routines
Page iv TCG Published Family "2.0"
October 30, 2014 Copyright TCG 2006-2014 Level 00 Revision 01.16
5.8.7.2 PCR_POLICY ............................................................................................... 16 5.8.7.3 PCR_AUTHVALUE ....................................................................................... 16
5.8.8 Startup ............................................................................................................... 16
5.8.8.1 SHUTDOWN_NONE ..................................................................................... 16 5.8.8.2 STARTUP_TYPE .......................................................................................... 16
5.8.9 NV ...................................................................................................................... 16
5.8.9.1 NV_RESERVE .............................................................................................. 16 5.8.9.2 NV_INDEX .................................................................................................... 18
5.8.10 COMMIT_INDEX_MASK ..................................................................................... 18 5.8.11 RAM Global Values ............................................................................................ 18
5.8.11.1 Description ................................................................................................... 18 5.8.11.2 g_rcIndex ..................................................................................................... 18 5.8.11.3 g_exclusiveAuditSession .............................................................................. 18 5.8.11.4 g_time .......................................................................................................... 18 5.8.11.5 g_phEnable .................................................................................................. 18 5.8.11.6 g_pceReConfig ............................................................................................. 19 5.8.11.7 g_DRTMHandle ............................................................................................ 19 5.8.11.8 g_DrtmPreStartup ......................................................................................... 19 5.8.11.9 g_StartupLocality3 ........................................................................................ 19 5.8.11.10 g_updateNV ................................................................................................. 19 5.8.11.11 g_clearOrderly .............................................................................................. 19 5.8.11.12 g_prevOrderlyState ...................................................................................... 20 5.8.11.13 g_nvOk ......................................................................................................... 20 5.8.11.14 g_platformUnique ......................................................................................... 20
5.8.12 Persistent Global Values .................................................................................... 20
5.8.12.1 Description ................................................................................................... 20 5.8.12.2 PERSISTENT_DATA .................................................................................... 20 5.8.12.3 ORDERLY_DATA ......................................................................................... 22 5.8.12.4 STATE_CLEAR_DATA ................................................................................. 23 5.8.12.5 State Reset Data .......................................................................................... 24
5.8.13 Global Macro Definitions .................................................................................... 25 5.8.14 Private data ........................................................................................................ 25
5.9 Tpm.h ........................................................................................................................ 29 5.10 swap.h ...................................................................................................................... 30 5.11 InternalRoutines.h ..................................................................................................... 31 5.12 TpmBuildSwitches.h .................................................................................................. 32 5.13 VendorString.h .......................................................................................................... 33
6 Main ................................................................................................................................... 35
6.1 CommandDispatcher() ............................................................................................... 35 6.2 ExecCommand.c ....................................................................................................... 35
6.2.1 Introduction ........................................................................................................ 35 6.2.2 Includes ............................................................................................................. 35 6.2.3 ExecuteCommand() ............................................................................................ 35
6.3 ParseHandleBuffer() .................................................................................................. 41 6.4 SessionProcess.c ...................................................................................................... 42
6.4.1 Introduction ........................................................................................................ 42 6.4.2 Includes and Data Definitions ............................................................................. 42 6.4.3 Authorization Support Functions ......................................................................... 42
6.4.3.1 IsDAExempted() ........................................................................................... 42 6.4.3.2 IncrementLockout() ....................................................................................... 43
-
Part 4: Supporting Routines Trusted Platform Module Library
Family "2.0" TCG Published Page v
Level 00 Revision 01.16 Copyright TCG 2006-2014 October 30, 2014
6.4.3.3 IsSessionBindEntity() ................................................................................... 44 6.4.3.4 IsPolicySessionRequired() ............................................................................ 45 6.4.3.5 IsAuthValueAvailable() ................................................................................. 46 6.4.3.6 IsAuthPolicyAvailable() ................................................................................. 48
6.4.4 Session Parsing Functions ................................................................................. 49
6.4.4.1 ComputeCpHash() ........................................................................................ 49 6.4.4.2 CheckPWAuthSession() ................................................................................ 50 6.4.4.3 ComputeCommandHMAC() ........................................................................... 51 6.4.4.4 CheckSessionHMAC() .................................................................................. 53 6.4.4.5 CheckPolicyAuthSession() ............................................................................ 53 6.4.4.6 RetrieveSessionData() .................................................................................. 56 6.4.4.7 CheckLockedOut() ........................................................................................ 59 6.4.4.8 CheckAuthSession() ..................................................................................... 60 6.4.4.9 CheckCommandAudit() ................................................................................. 62 6.4.4.10 ParseSessionBuffer() .................................................................................... 63 6.4.4.11 CheckAuthNoSession() ................................................................................. 65
6.4.5 Response Session Processing ........................................................................... 66
6.4.5.1 Introduction .................................................................................................. 66 6.4.5.2 ComputeRpHash() ........................................................................................ 66 6.4.5.3 InitAuditSession() ......................................................................................... 67 6.4.5.4 Audit() .......................................................................................................... 67 6.4.5.5 CommandAudit() ........................................................................................... 68 6.4.5.6 UpdateAuditSessionStatus() ......................................................................... 69 6.4.5.7 ComputeResponseHMAC() ........................................................................... 70 6.4.5.8 BuildSingleResponseAuth() .......................................................................... 71 6.4.5.9 UpdateTPMNonce() ...................................................................................... 72 6.4.5.10 UpdateInternalSession() ............................................................................... 72 6.4.5.11 BuildResponseSession() ............................................................................... 73
7 Command Support Functions .............................................................................................. 76
7.1 Introduction ............................................................................................................... 76 7.2 Attestation Command Support (Attest_spt.c) ............................................................. 76
7.2.1 Includes ............................................................................................................. 76 7.2.2 Functions ........................................................................................................... 76
7.2.2.1 FillInAttestInfo() ............................................................................................ 76 7.2.2.2 SignAttestInfo() ............................................................................................ 77
7.3 Context Management Command Support (Context_spt.c) .......................................... 79
7.3.1 Includes ............................................................................................................. 79 7.3.2 Functions ........................................................................................................... 79
7.3.2.1 ComputeContextProtectionKey() ................................................................... 79 7.3.2.2 ComputeContextIntegrity() ............................................................................ 80 7.3.2.3 SequenceDataImportExport() ........................................................................ 81
7.4 Policy Command Support (Policy_spt.c) .................................................................... 81
7.4.1 PolicyParameterChecks() ................................................................................... 81 7.4.2 PolicyContextUpdate() ........................................................................................ 82
7.5 NV Command Support (NV_spt.c) ............................................................................. 83
7.5.1 Includes ............................................................................................................. 83 7.5.2 Fuctions ............................................................................................................. 83
7.5.2.1 NvReadAccessChecks() ............................................................................... 83 7.5.2.2 NvWriteAccessChecks() ............................................................................... 84
7.6 Object Command Support (Object_spt.c) ................................................................... 85
-
Trusted Platform Module Library Part 4: Supporting Routines
Page vi TCG Published Family "2.0"
October 30, 2014 Copyright TCG 2006-2014 Level 00 Revision 01.16
7.6.1 Includes ............................................................................................................. 85 7.6.2 Local Functions .................................................................................................. 86
7.6.2.1 EqualCryptSet() ............................................................................................ 86 7.6.2.2 GetIV2BSize() .............................................................................................. 86 7.6.2.3 ComputeProtectionKeyParms() ..................................................................... 87 7.6.2.4 ComputeOuterIntegrity() ............................................................................... 88 7.6.2.5 ComputeInnerIntegrity() ................................................................................ 89 7.6.2.6 ProduceInnerIntegrity() ................................................................................. 89 7.6.2.7 CheckInnerIntegrity() .................................................................................... 90
7.6.3 Public Functions ................................................................................................. 90
7.6.3.1 AreAttributesForParent() ............................................................................... 90 7.6.3.2 SchemeChecks() .......................................................................................... 91 7.6.3.3 PublicAttributesValidation()........................................................................... 94 7.6.3.4 FillInCreationData() ...................................................................................... 95 7.6.3.5 GetSeedForKDF() ......................................................................................... 97 7.6.3.6 ProduceOuterWrap() ..................................................................................... 97 7.6.3.7 UnwrapOuter() .............................................................................................. 99 7.6.3.8 SensitiveToPrivate() ................................................................................... 100 7.6.3.9 PrivateToSensitive() ................................................................................... 101 7.6.3.10 SensitiveToDuplicate()................................................................................ 103 7.6.3.11 DuplicateToSensitive()................................................................................ 105 7.6.3.12 SecretToCredential() .................................................................................. 107 7.6.3.13 CredentialToSecret() .................................................................................. 108
8 Subsystem........................................................................................................................ 109
8.1 CommandAudit.c ..................................................................................................... 109
8.1.1 Introduction ...................................................................................................... 109 8.1.2 Includes ........................................................................................................... 109 8.1.3 Functions ......................................................................................................... 109
8.1.3.1 CommandAuditPreInstall_Init() ................................................................... 109 8.1.3.2 CommandAuditStartup() ............................................................................. 109 8.1.3.3 CommandAuditSet() ................................................................................... 110 8.1.3.4 CommandAuditClear() ................................................................................ 110 8.1.3.5 CommandAuditIsRequired() ........................................................................ 111 8.1.3.6 CommandAuditCapGetCCList() .................................................................. 111 8.1.3.7 CommandAuditGetDigest ............................................................................ 112
8.2 DA.c ........................................................................................................................ 113
8.2.1 Introduction ...................................................................................................... 113 8.2.2 Includes and Data Definitions ........................................................................... 113 8.2.3 Functions ......................................................................................................... 113
8.2.3.1 DAPreInstall_Init() ...................................................................................... 113 8.2.3.2 DAStartup() ................................................................................................ 114 8.2.3.3 DARegisterFailure() .................................................................................... 114 8.2.3.4 DASelfHeal() .............................................................................................. 115
8.3 Hierarchy.c .............................................................................................................. 116
8.3.1 Introduction ...................................................................................................... 116 8.3.2 Includes ........................................................................................................... 116 8.3.3 Functions ......................................................................................................... 116
8.3.3.1 HierarchyPreInstall() ................................................................................... 116 8.3.3.2 HierarchyStartup() ...................................................................................... 117 8.3.3.3 HierarchyGetProof() ................................................................................... 118 8.3.3.4 HierarchyGetPrimarySeed() ........................................................................ 118 8.3.3.5 HierarchyIsEnabled() .................................................................................. 119
-
Part 4: Supporting Routines Trusted Platform Module Library
Family "2.0" TCG Published Page vii
Level 00 Revision 01.16 Copyright TCG 2006-2014 October 30, 2014
8.4 NV.c ........................................................................................................................ 119
8.4.1 Introduction ...................................................................................................... 119 8.4.2 Includes, Defines and Data Definitions ............................................................. 119 8.4.3 NV Utility Functions .......................................................................................... 120
8.4.3.1 NvCheckState() .......................................................................................... 120 8.4.3.2 NvIsAvailable() ........................................................................................... 120 8.4.3.3 NvCommit ................................................................................................... 120 8.4.3.4 NvReadMaxCount() .................................................................................... 121 8.4.3.5 NvWriteMaxCount() .................................................................................... 121
8.4.4 NV Index and Persistent Object Access Functions ............................................ 121
8.4.4.1 Introduction ................................................................................................ 121 8.4.4.2 NvNext() ..................................................................................................... 121 8.4.4.3 NvGetEnd() ................................................................................................ 122 8.4.4.4 NvGetFreeByte ........................................................................................... 122 8.4.4.5 NvGetEvictObjectSize................................................................................. 123 8.4.4.6 NvGetCounterSize ...................................................................................... 123 8.4.4.7 NvTestSpace() ............................................................................................ 123 8.4.4.8 NvAdd() ...................................................................................................... 124 8.4.4.9 NvDelete() .................................................................................................. 124
8.4.5 RAM-based NV Index Data Access Functions ................................................... 125
8.4.5.1 Introduction ................................................................................................ 125 8.4.5.2 NvTestRAMSpace() .................................................................................... 125 8.4.5.3 NvGetRamIndexOffset ................................................................................ 126 8.4.5.4 NvAddRAM() .............................................................................................. 126 8.4.5.5 NvDeleteRAM() .......................................................................................... 127
8.4.6 Utility Functions ................................................................................................ 128
8.4.6.1 NvInitStatic() .............................................................................................. 128 8.4.6.2 NvInit() ....................................................................................................... 129 8.4.6.3 NvReadReserved() ..................................................................................... 129 8.4.6.4 NvWriteReserved() ..................................................................................... 130 8.4.6.5 NvReadPersistent() .................................................................................... 130 8.4.6.6 NvIsPlatformPersistentHandle() .................................................................. 131 8.4.6.7 NvIsOwnerPersistentHandle() ..................................................................... 131 8.4.6.8 NvNextIndex() ............................................................................................ 131 8.4.6.9 NvNextEvict() ............................................................................................. 132 8.4.6.10 NvFindHandle() .......................................................................................... 132 8.4.6.11 NvPowerOn() .............................................................................................. 133 8.4.6.12 NvStateSave() ............................................................................................ 133 8.4.6.13 NvEntityStartup() ........................................................................................ 134
8.4.7 NV Access Functions ....................................................................................... 135
8.4.7.1 Introduction ................................................................................................ 135 8.4.7.2 NvIsUndefinedIndex() ................................................................................. 135 8.4.7.3 NvIndexIsAccessible() ................................................................................ 136 8.4.7.4 NvIsUndefinedEvictHandle() ....................................................................... 137 8.4.7.5 NvGetEvictObject() ..................................................................................... 138 8.4.7.6 NvGetIndexInfo() ........................................................................................ 138 8.4.7.7 NvInitialCounter() ....................................................................................... 139 8.4.7.8 NvGetIndexData() ....................................................................................... 139 8.4.7.9 NvGetIntIndexData() ................................................................................... 140 8.4.7.10 NvWriteIndexInfo() ...................................................................................... 141 8.4.7.11 NvWriteIndexData() .................................................................................... 142 8.4.7.12 NvGetName() ............................................................................................. 143 8.4.7.13 NvDefineIndex().......................................................................................... 143
-
Trusted Platform Module Library Part 4: Supporting Routines
Page viii TCG Published Family "2.0"
October 30, 2014 Copyright TCG 2006-2014 Level 00 Revision 01.16
8.4.7.14 NvAddEvictObject() .................................................................................... 144 8.4.7.15 NvDeleteEntity() ......................................................................................... 145 8.4.7.16 NvFlushHierarchy() ..................................................................................... 146 8.4.7.17 NvSetGlobalLock()...................................................................................... 147 8.4.7.18 InsertSort() ................................................................................................. 148 8.4.7.19 NvCapGetPersistent() ................................................................................. 149 8.4.7.20 NvCapGetIndex() ........................................................................................ 150 8.4.7.21 NvCapGetIndexNumber() ............................................................................ 151 8.4.7.22 NvCapGetPersistentNumber() .................................................................... 151 8.4.7.23 NvCapGetPersistentAvail() ......................................................................... 151 8.4.7.24 NvCapGetCounterNumber() ........................................................................ 151 8.4.7.25 NvCapGetCounterAvail() ............................................................................ 152
8.5 Object.c................................................................................................................... 153
8.5.1 Introduction ...................................................................................................... 153 8.5.2 Includes and Data Definitions ........................................................................... 153 8.5.3 Functions ......................................................................................................... 153
8.5.3.1 ObjectStartup() ........................................................................................... 153 8.5.3.2 ObjectCleanupEvict() .................................................................................. 153 8.5.3.3 ObjectIsPresent() ....................................................................................... 154 8.5.3.4 ObjectIsSequence() .................................................................................... 154 8.5.3.5 ObjectGet() ................................................................................................. 155 8.5.3.6 ObjectGetName() ........................................................................................ 155 8.5.3.7 ObjectGetNameAlg() ................................................................................... 155 8.5.3.8 ObjectGetQualifiedName() .......................................................................... 156 8.5.3.9 ObjectDataGetHierarchy() .......................................................................... 156 8.5.3.10 ObjectGetHierarchy() .................................................................................. 156 8.5.3.11 ObjectAllocateSlot() .................................................................................... 157 8.5.3.12 ObjectLoad()............................................................................................... 157 8.5.3.13 AllocateSequenceSlot() .............................................................................. 160 8.5.3.14 ObjectCreateHMACSequence() .................................................................. 160 8.5.3.15 ObjectCreateHashSequence() .................................................................... 161 8.5.3.16 ObjectCreateEventSequence() ................................................................... 161 8.5.3.17 ObjectTerminateEvent() .............................................................................. 162 8.5.3.18 ObjectContextLoad() ................................................................................... 163 8.5.3.19 ObjectFlush() .............................................................................................. 163 8.5.3.20 ObjectFlushHierarchy() ............................................................................... 163 8.5.3.21 ObjectLoadEvict() ....................................................................................... 164 8.5.3.22 ObjectComputeName() ............................................................................... 165 8.5.3.23 ObjectComputeQualifiedName() ................................................................. 166 8.5.3.24 ObjectDataIsStorage() ................................................................................ 166 8.5.3.25 ObjectIsStorage() ....................................................................................... 167 8.5.3.26 ObjectCapGetLoaded() ............................................................................... 167 8.5.3.27 ObjectCapGetTransientAvail() .................................................................... 168
8.6 PCR.c ..................................................................................................................... 168
8.6.1 Introduction ...................................................................................................... 168 8.6.2 Includes, Defines, and Data Definitions ............................................................ 168 8.6.3 Functions ......................................................................................................... 169
8.6.3.1 PCRBelongsAuthGroup() ............................................................................ 169 8.6.3.2 PCRBelongsPolicyGroup() .......................................................................... 169 8.6.3.3 PCRBelongsTCBGroup() ............................................................................ 170 8.6.3.4 PCRPolicyIsAvailable() ............................................................................... 170 8.6.3.5 PCRGetAuthValue() .................................................................................... 171 8.6.3.6 PCRGetAuthPolicy() ................................................................................... 171 8.6.3.7 PCRSimStart() ............................................................................................ 172 8.6.3.8 GetSavedPcrPointer() ................................................................................. 172
-
Part 4: Supporting Routines Trusted Platform Module Library
Family "2.0" TCG Published Page ix
Level 00 Revision 01.16 Copyright TCG 2006-2014 October 30, 2014
8.6.3.9 PcrIsAllocated() .......................................................................................... 173 8.6.3.10 GetPcrPointer() .......................................................................................... 174 8.6.3.11 IsPcrSelected() ........................................................................................... 175 8.6.3.12 FilterPcr() ................................................................................................... 175 8.6.3.13 PcrDrtm() .................................................................................................... 176 8.6.3.14 PCRStartup() .............................................................................................. 176 8.6.3.15 PCRStateSave() ......................................................................................... 177 8.6.3.16 PCRIsStateSaved() .................................................................................... 178 8.6.3.17 PCRIsResetAllowed() ................................................................................. 179 8.6.3.18 PCRChanged() ........................................................................................... 179 8.6.3.19 PCRIsExtendAllowed() ............................................................................... 179 8.6.3.20 PCRExtend() .............................................................................................. 180 8.6.3.21 PCRComputeCurrentDigest() ...................................................................... 181 8.6.3.22 PCRRead() ................................................................................................. 181 8.6.3.23 PcrWrite() ................................................................................................... 183 8.6.3.24 PCRAllocate() ............................................................................................. 183 8.6.3.25 PCRSetValue() ........................................................................................... 185 8.6.3.26 PCRResetDynamics ................................................................................... 185 8.6.3.27 PCRCapGetAllocation() .............................................................................. 186 8.6.3.28 PCRSetSelectBit() ...................................................................................... 186 8.6.3.29 PCRGetProperty() ...................................................................................... 187 8.6.3.30 PCRCapGetProperties() ............................................................................. 188 8.6.3.31 PCRCapGetHandles() ................................................................................. 189
8.7 PP.c ........................................................................................................................ 190
8.7.1 Introduction ...................................................................................................... 190 8.7.2 Includes ........................................................................................................... 190 8.7.3 Functions ......................................................................................................... 190
8.7.3.1 PhysicalPresencePreInstall_Init() ............................................................... 190 8.7.3.2 PhysicalPresenceCommandSet() ................................................................ 191 8.7.3.3 PhysicalPresenceCommandClear() ............................................................. 191 8.7.3.4 PhysicalPresenceIsRequired() .................................................................... 192 8.7.3.5 PhysicalPresenceCapGetCCList() .............................................................. 192
8.8 Session.c ................................................................................................................ 193
8.8.1 Introduction ...................................................................................................... 193 8.8.2 Includes, Defines, and Local Variables ............................................................. 194 8.8.3 File Scope Function -- ContextIdSetOldest() ..................................................... 194 8.8.4 Startup Function -- SessionStartup() ................................................................ 195 8.8.5 Access Functions ............................................................................................. 196
8.8.5.1 SessionIsLoaded() ...................................................................................... 196 8.8.5.2 SessionIsSaved() ....................................................................................... 196 8.8.5.3 SessionPCRValueIsCurrent() ...................................................................... 197 8.8.5.4 SessionGet() .............................................................................................. 197
8.8.6 Utility Functions ................................................................................................ 198
8.8.6.1 ContextIdSessionCreate() ........................................................................... 198 8.8.6.2 SessionCreate().......................................................................................... 199 8.8.6.3 SessionContextSave() ................................................................................ 201 8.8.6.4 SessionContextLoad() ................................................................................ 202 8.8.6.5 SessionFlush() ........................................................................................... 204 8.8.6.6 SessionComputeBoundEntity() ................................................................... 204 8.8.6.7 SessionInitPolicyData()............................................................................... 205 8.8.6.8 SessionResetPolicyData() .......................................................................... 206 8.8.6.9 SessionCapGetLoaded() ............................................................................. 206 8.8.6.10 SessionCapGetSaved() .............................................................................. 207 8.8.6.11 SessionCapGetLoadedNumber() ................................................................ 208
-
Trusted Platform Module Library Part 4: Supporting Routines
Page x TCG Published Family "2.0"
October 30, 2014 Copyright TCG 2006-2014 Level 00 Revision 01.16
8.8.6.12 SessionCapGetLoadedAvail() ..................................................................... 208 8.8.6.13 SessionCapGetActiveNumber() .................................................................. 209 8.8.6.14 SessionCapGetActiveAvail() ....................................................................... 209
8.9 Time.c ..................................................................................................................... 209
8.9.1 Introduction ...................................................................................................... 209 8.9.2 Includes ........................................................................................................... 209 8.9.3 Functions ......................................................................................................... 210
8.9.3.1 TimePowerOn() .......................................................................................... 210 8.9.3.2 TimeStartup() ............................................................................................. 210 8.9.3.3 TimeUpdateToCurrent() .............................................................................. 211 8.9.3.4 TimeSetAdjustRate() .................................................................................. 212 8.9.3.5 TimeGetRange() ......................................................................................... 212 8.9.3.6 TimeFillInfo ................................................................................................ 213
9 Support ............................................................................................................................ 214
9.1 AlgorithmCap.c ........................................................................................................ 214
9.1.1 Description ....................................................................................................... 214 9.1.2 Includes and Defines ........................................................................................ 214 9.1.3 AlgorithmCapGetImplemented() ........................................................................ 215
9.2 Bits.c ....................................................................................................................... 217
9.2.1 Introduction ...................................................................................................... 217 9.2.2 Includes ........................................................................................................... 217 9.2.3 Functions ......................................................................................................... 217
9.2.3.1 BitIsSet() .................................................................................................... 217 9.2.3.2 BitSet() ....................................................................................................... 217 9.2.3.3 BitClear() .................................................................................................... 218
9.3 CommandAttributeData.c ........................................................................................ 218 9.4 CommandCodeAttributes.c ...................................................................................... 224
9.4.1 Introduction ...................................................................................................... 224 9.4.2 Includes and Defines ........................................................................................ 224 9.4.3 Command Attribute Functions .......................................................................... 224
9.4.3.1 CommandAuthRole() .................................................................................. 224 9.4.3.2 CommandIsImplemented() .......................................................................... 224 9.4.3.3 CommandGetAttribute() .............................................................................. 225 9.4.3.4 EncryptSize() .............................................................................................. 225 9.4.3.5 DecryptSize().............................................................................................. 226 9.4.3.6 IsSessionAllowed() ..................................................................................... 226 9.4.3.7 IsHandleInResponse() ................................................................................ 226 9.4.3.8 IsWriteOperation() ...................................................................................... 227 9.4.3.9 IsReadOperation() ...................................................................................... 227 9.4.3.10 CommandCapGetCCList() .......................................................................... 227
9.5 DRTM.c ................................................................................................................... 228
9.5.1 Description ....................................................................................................... 228 9.5.2 Includes ........................................................................................................... 228 9.5.3 Functions ......................................................................................................... 229
9.5.3.1 Signal_Hash_Start() ................................................................................... 229 9.5.3.2 Signal_Hash_Data() ................................................................................... 229 9.5.3.3 Signal_Hash_End() ..................................................................................... 229
9.6 Entity.c .................................................................................................................... 229
9.6.1 Description ....................................................................................................... 229 9.6.2 Includes ........................................................................................................... 229
-
Part 4: Supporting Routines Trusted Platform Module Library
Family "2.0" TCG Published Page xi
Level 00 Revision 01.16 Copyright TCG 2006-2014 October 30, 2014
9.6.3 Functions ......................................................................................................... 230
9.6.3.1 EntityGetLoadStatus() ................................................................................ 230 9.6.3.2 EntityGetAuthValue() .................................................................................. 232 9.6.3.3 EntityGetAuthPolicy() ................................................................................. 233 9.6.3.4 EntityGetName() ......................................................................................... 234 9.6.3.5 EntityGetHierarchy() ................................................................................... 235
9.7 Global.c................................................................................................................... 236
9.7.1 Description ....................................................................................................... 236 9.7.2 Includes and Defines ........................................................................................ 236 9.7.3 Global Data Values .......................................................................................... 236 9.7.4 Private Values .................................................................................................. 237
9.7.4.1 SessionProcess.c ....................................................................................... 237 9.7.4.2 DA.c ........................................................................................................... 237 9.7.4.3 NV.c ........................................................................................................... 237 9.7.4.4 Object.c ...................................................................................................... 238 9.7.4.5 PCR.c ......................................................................................................... 238 9.7.4.6 Session.c .................................................................................................... 238 9.7.4.7 Manufacture.c ............................................................................................. 238 9.7.4.8 Power.c ...................................................................................................... 238 9.7.4.9 MemoryLib.c ............................................................................................... 238 9.7.4.10 SelfTest.c ................................................................................................... 238 9.7.4.11 TpmFail.c ................................................................................................... 238
9.8 Handle.c .................................................................................................................. 239
9.8.1 Description ....................................................................................................... 239 9.8.2 Includes ........................................................................................................... 239 9.8.3 Functions ......................................................................................................... 239
9.8.3.1 HandleGetType() ........................................................................................ 239 9.8.3.2 NextPermanentHandle() ............................................................................. 239 9.8.3.3 PermanentCapGetHandles() ....................................................................... 240
9.9 Locality.c ................................................................................................................. 241
9.9.1 Includes ........................................................................................................... 241 9.9.2 LocalityGetAttributes() ...................................................................................... 241
9.10 Manufacture.c ......................................................................................................... 241
9.10.1 Description ....................................................................................................... 241 9.10.2 Includes and Data Definitions ........................................................................... 241 9.10.3 Functions ......................................................................................................... 242
9.10.3.1 TPM_Manufacture() .................................................................................... 242 9.10.3.2 TPM_TearDown() ....................................................................................... 243
9.11 Marshal.c ................................................................................................................ 244
9.11.1 Introduction ...................................................................................................... 244 9.11.2 Unmarshal and Marshal a Value ....................................................................... 244 9.11.3 Unmarshal and Marshal a Union ....................................................................... 245 9.11.4 Unmarshal and Marshal a Structure .................................................................. 247 9.11.5 Unmarshal and Marshal an Array ..................................................................... 249 9.11.6 TPM2B Handling .............................................................................................. 251
9.12 MemoryLib.c............................................................................................................ 252
9.12.1 Description ....................................................................................................... 252 9.12.2 Includes and Data Definitions ........................................................................... 252 9.12.3 Functions on BYTE Arrays................................................................................ 252
-
Trusted Platform Module Library Part 4: Supporting Routines
Page xii TCG Published Family "2.0"
October 30, 2014 Copyright TCG 2006-2014 Level 00 Revision 01.16
9.12.3.1 MemoryMove()............................................................................................ 252 9.12.3.2 MemoryCopy() ............................................................................................ 253 9.12.3.3 MemoryEqual() ........................................................................................... 253 9.12.3.4 MemoryCopy2B() ........................................................................................ 253 9.12.3.5 MemoryConcat2B() ..................................................................................... 254 9.12.3.6 Memory2BEqual() ....................................................................................... 254 9.12.3.7 MemorySet() ............................................................................................... 255 9.12.3.8 MemoryGetActionInputBuffer().................................................................... 255 9.12.3.9 MemoryGetActionOutputBuffer() ................................................................. 255 9.12.3.10 MemoryGetResponseBuffer() ...................................................................... 256 9.12.3.11 MemoryRemoveTrailingZeros() ................................................................... 256
9.13 Power.c ................................................................................................................... 256
9.13.1 Description ....................................................................................................... 256 9.13.2 Includes and Data Definitions ........................................................................... 256 9.13.3 Functions ......................................................................................................... 257
9.13.3.1 TPMInit() .................................................................................................... 257 9.13.3.2 TPMRegisterStartup() ................................................................................. 257 9.13.3.3 TPMIsStarted() ........................................................................................... 257
9.14 PropertyCap.c ......................................................................................................... 257
9.14.1 Description ....................................................................................................... 257 9.14.2 Includes ........................................................................................................... 258 9.14.3 Functions ......................................................................................................... 258
9.14.3.1 PCRGetProperty() ...................................................................................... 258 9.14.3.2 TPMCapGetProperties() ............................................................................. 264
9.15 TpmFail.c ................................................................................................................ 265
9.15.1 Includes, Defines, and Types ........................................................................... 265 9.15.2 Typedefs .......................................................................................................... 265 9.15.3 Local Functions ................................................................................................ 266
9.15.3.1 MarshalUint16() .......................................................................................... 266 9.15.3.2 MarshalUint32() .......................................................................................... 266 9.15.3.3 UnmarshalHeader() .................................................................................... 267
9.15.4 Public Functions ............................................................................................... 267
9.15.4.1 SetForceFailureMode() ............................................................................... 267 9.15.4.2 TpmFail() .................................................................................................... 267
9.15.5 TpmFailureMode .............................................................................................. 268
10 Cryptographic Functions ................................................................................................... 272
10.1 Introduction ............................................................................................................. 272 10.2 CryptUtil.c ............................................................................................................... 272
10.2.1 Includes ........................................................................................................... 272 10.2.2 TranslateCryptErrors() ...................................................................................... 272 10.2.3 Random Number Generation Functions ............................................................ 273
10.2.3.1 CryptDrbgGetPutState() .............................................................................. 273 10.2.3.2 CryptStirRandom() ...................................................................................... 273 10.2.3.3 CryptGenerateRandom() ............................................................................. 273
10.2.4 Hash/HMAC Functions ..................................................................................... 274
10.2.4.1 CryptGetContextAlg() ................................................................................. 274 10.2.4.2 CryptStartHash()......................................................................................... 274 10.2.4.3 CryptStartHashSequence() ......................................................................... 275 10.2.4.4 CryptStartHMAC() ....................................................................................... 275
-
Part 4: Supporting Routines Trusted Platform Module Library
Family "2.0" TCG Published Page xiii
Level 00 Revision 01.16 Copyright TCG 2006-2014 October 30, 2014
10.2.4.5 CryptStartHMACSequence() ....................................................................... 276 10.2.4.6 CryptStartHMAC2B() .................................................................................. 276 10.2.4.7 CryptStartHMACSequence2B() ................................................................... 277 10.2.4.8 CryptUpdateDigest() ................................................................................... 277 10.2.4.9 CryptUpdateDigest2B() ............................................................................... 278 10.2.4.10 CryptUpdateDigestInt() ............................................................................... 278 10.2.4.11 CryptCompleteHash() ................................................................................. 279 10.2.4.12 CryptCompleteHash2B() ............................................................................. 279 10.2.4.13 CryptHashBlock() ....................................................................................... 280 10.2.4.14 CryptCompleteHMAC() ............................................................................... 280 10.2.4.15 CryptCompleteHMAC2B() ........................................................................... 281 10.2.4.16 CryptHashStateImportExport() .................................................................... 281 10.2.4.17 CryptGetHashDigestSize() .......................................................................... 281 10.2.4.18 CryptGetHashBlockSize() ........................................................................... 282 10.2.4.19 CryptGetHashAlgByIndex() ......................................................................... 282 10.2.4.20 CryptSignHMAC() ....................................................................................... 282 10.2.4.21 CryptHMACVerifySignature() ...................................................................... 283 10.2.4.22 CryptGenerateKeyedHash() ........................................................................ 283 10.2.4.23 CryptKDFa() ............................................................................................... 285 10.2.4.24 CryptKDFaOnce() ....................................................................................... 285 10.2.4.25 KDFa() ....................................................................................................... 285 10.2.4.26 CryptKDFe() ............................................................................................... 286
10.2.5 RSA Functions ................................................................................................. 286
10.2.5.1 BuildRSA() ................................................................................................. 286 10.2.5.2 CryptTestKeyRSA() .................................................................................... 286 10.2.5.3 CryptGenerateKeyRSA() ............................................................................. 287 10.2.5.4 CryptLoadPrivateRSA() .............................................................................. 288 10.2.5.5 CryptSelectRSAScheme() ........................................................................... 288 10.2.5.6 CryptDecryptRSA() ..................................................................................... 289 10.2.5.7 CryptEncryptRSA() ..................................................................................... 291 10.2.5.8 CryptSignRSA() .......................................................................................... 292 10.2.5.9 CryptRSAVerifySignature() ......................................................................... 293
10.2.6 ECC Functions ................................................................................................. 294
10.2.6.1 CryptEccGetCurveDataPointer() ................................................................. 294 10.2.6.2 CryptEccGetKeySizeInBits() ....................................................................... 294 10.2.6.3 CryptEccGetKeySizeBytes() ....................................................................... 294 10.2.6.4 CryptEccGetParameter()............................................................................. 294 10.2.6.5 CryptGetCurveSignScheme() ...................................................................... 295 10.2.6.6 CryptEccIsPointOnCurve() .......................................................................... 295 10.2.6.7 CryptNewEccKey() ..................................................................................... 296 10.2.6.8 CryptEccPointMultiply() .............................................................................. 296 10.2.6.9 CryptGenerateKeyECC() ............................................................................ 297 10.2.6.10 CryptSignECC() .......................................................................................... 297 10.2.6.11 CryptECCVerifySignature() ......................................................................... 298 10.2.6.12 CryptGenerateR() ....................................................................................... 299 10.2.6.13 CryptCommit() ............................................................................................ 301 10.2.6.14 CryptEndCommit() ...................................................................................... 301 10.2.6.15 CryptCommitCompute() .............................................................................. 301 10.2.6.16 CryptEccGetParameters() ........................................................................... 302 10.2.6.17 CryptIsSchemeAnonymous() ....................................................................... 303
10.2.7 Symmetric Functions ........................................................................................ 303
10.2.7.1 ParmDecryptSym() ..................................................................................... 303 10.2.7.2 ParmEncryptSym() ..................................................................................... 304 10.2.7.3 CryptGenerateNewSymmetric() .................................................................. 305 10.2.7.4 CryptGenerateKeySymmetric() ................................................................... 306
-
Trusted Platform Module Library Part 4: Supporting Routines
Page xiv TCG Published Family "2.0"
October 30, 2014 Copyright TCG 2006-2014 Level 00 Revision 01.16
10.2.7.5 CryptXORObfuscation() .............................................................................. 307
10.2.8 Initialization and shut down .............................................................................. 307
10.2.8.1 CryptInitUnits() ........................................................................................... 307 10.2.8.2 CryptStopUnits() ......................................................................................... 308 10.2.8.3 CryptUtilStartup()........................................................................................ 308
10.2.9 Algorithm-Independent Functions ..................................................................... 309
10.2.9.1 Introduction ................................................................................................ 309 10.2.9.2 CryptIsAsymAlgorithm() .............................................................................. 309 10.2.9.3 CryptGetSymmetricBlockSize() ................................................................... 309 10.2.9.4 CryptSymmetricEncrypt() ............................................................................ 310 10.2.9.5 CryptSymmetricDecrypt() ............................................................................ 311 10.2.9.6 CryptSecretEncrypt() .................................................................................. 313 10.2.9.7 CryptSecretDecrypt() .................................................................................. 315 10.2.9.8 CryptParameterEncryption() ....................................................................... 318 10.2.9.9 CryptParameterDecryption() ....................................................................... 319 10.2.9.10 CryptComputeSymmetricUnique() ............................................................... 320 10.2.9.11 CryptComputeSymValue() .......................................................................... 321 10.2.9.12 CryptCreateObject() ................................................................................... 321 10.2.9.13 CryptObjectIsPublicConsistent() ................................................................. 324 10.2.9.14 CryptObjectPublicPrivateMatch() ................................................................ 325 10.2.9.15 CryptGetSignHashAlg() .............................................................................. 326 10.2.9.16 CryptIsSplitSign() ....................................................................................... 327 10.2.9.17 CryptIsSignScheme() .................................................................................. 327 10.2.9.18 CryptIsDecryptScheme() ............................................................................. 328 10.2.9.19 CryptSelectSignScheme() ........................................................................... 328 10.2.9.20 CryptSign() ................................................................................................. 330 10.2.9.21 CryptVerifySignature() ................................................................................ 331
10.2.10 Math functions .................................................................................................. 332
10.2.10.1 CryptDivide() .............................................................................................. 332 10.2.10.2 CryptCompare() .......................................................................................... 333 10.2.10.3 CryptCompareSigned() ............................................................................... 333 10.2.10.4 CryptGetTestResult .................................................................................... 333
10.2.11 Capability Support ............................................................................................ 334
10.2.11.1 CryptCapGetECCCurve() ............................................................................ 334 10.2.11.2 CryptCapGetEccCurveNumber() ................................................................. 335 10.2.11.3 CryptAreKeySizesConsistent() .................................................................... 335 10.2.11.4 CryptAlgSetImplemented() .......................................................................... 336
10.3 Ticket.c ................................................................................................................... 336
10.3.1 Introduction ...................................................................................................... 336 10.3.2 Includes ........................................................................................................... 336 10.3.3 Functions ......................................................................................................... 336
10.3.3.1 TicketIsSafe() ............................................................................................. 336 10.3.3.2 TicketComputeVerified() ............................................................................. 337 10.3.3.3 TicketComputeAuth() .................................................................................. 337 10.3.3.4 TicketComputeHashCheck() ....................................................................... 338 10.3.3.5 TicketComputeCreation() ............................................................................ 339
10.4 CryptSelfTest.c ....................................................................................................... 339
10.4.1 Introduction ...................................................................................................... 339 10.4.2 Functions ......................................................................................................... 340
10.4.2.1 RunSelfTest() ............................................................................................. 340 10.4.2.2 CryptSelfTest() ........................................................................................... 340
-
Part 4: Supporting Routines Trusted Platform Module Library
Family "2.0" TCG Published Page xv
Level 00 Revision 01.16 Copyright TCG 2006-2014 October 30, 2014
10.4.2.3 CryptIncrementalSelfTest() ......................................................................... 341 10.4.2.4 CryptInitializeToTest() ................................................................................ 342 10.4.2.5 CryptTestAlgorithm() .................................................................................. 342
Annex A (informative) Implementation Dependent .................................................................. 344
A.1 Introduction ............................................................................................................. 344 A.2 Implementation.h ..................................................................................................... 344
Annex B (informative) Cryptographic Library Interface ............................................................ 359
B.1 Introduction ............................................................................................................. 359 B.2 Integer Format ........................................................................................................ 359 B.3 CryptoEngine.h ....................................................................................................... 359
B.3.1. Introduction ...................................................................................................... 359 B.3.2. General Purpose Macros .................................................................................. 360 B.3.3. Self-test ........................................................................................................... 360 B.3.4. Hash-related Structures .................................................................................... 360 B.3.5. Asymmetric Structures and Values ................................................................... 362
B.3.5.1. ECC-related Structures ............................................................................... 362 B.3.5.2. RSA-related Structures ............................................................................... 362
B.3.6. Miscelaneous ................................................................................................... 362
B.4 OsslCryptoEngine.h ................................................................................................ 364
B.4.1. Introduction ...................................................................................................... 364 B.4.2. Defines ............................................................................................................. 364
B.5 MathFunctions.c ...................................................................................................... 365
B.5.1. Introduction ...................................................................................................... 365 B.5.2. Externally Accessible Functions ....................................................................... 365
B.5.2.1. _math__Normalize2B() ............................................................................... 365 B.5.2.2. _math__Denormalize2B() ........................................................................... 366 B.5.2.3. _math__sub() ............................................................................................. 366 B.5.2.4. _math__Inc() .............................................................................................. 367 B.5.2.5. _math__Dec() ............................................................................................. 368 B.5.2.6. _math__Mul() ............................................................................................. 368 B.5.2.7. _math__Div() .............................................................................................. 369 B.5.2.8. _math__uComp() ........................................................................................ 370 B.5.2.9. _math__Comp() .......................................................................................... 371 B.5.2.10. _math__ModExp ......................................................................................... 372 B.5.2.11. _math__IsPrime() ....................................................................................... 373
B.6 CpriCryptPri.c .......................................................................................................... 375
B.6.1. Introduction ...................................................................................................... 375 B.6.2. Includes and Locals .......................................................................................... 375 B.6.3. Functions ......................................................................................................... 375
B.6.3.1. TpmFail() .................................................................................................... 375 B.6.3.2. FAILURE_TRAP() ....................................................................................... 375 B.6.3.3. _cpri__InitCryptoUnits() .............................................................................. 375 B.6.3.4. _cpri__StopCryptoUnits()............................................................................ 376 B.6.3.5. _cpri__Startup() .......................................................................................... 376
B.7 CpriRNG.c ............................................................................................................... 377
B.7.1. Introduction ...................................................................................................... 377 B.7.2. Includes ........................................................................................................... 377 B.7.3. Functions ......................................................................................................... 377
B.7.3.1. _cpri__RngStartup() ................................................................................... 377
-
Trusted Platform Module Library Part 4: Supporting Routines
Page xvi TCG Published Family "2.0"
October 30, 2014 Copyright TCG 2006-2014 Level 00 Revision 01.16
B.7.3.2. _cpri__DrbgGetPutState() .......................................................................... 377 B.7.3.3. _cpri__StirRandom() ................................................................................... 378 B.7.3.4. _cpri__GenerateRandom().......................................................................... 378
B.7.3.4.1. _cpri__GenerateSeededRandom() .............................................................. 379
B.8 CpriHash.c .............................................................................................................. 380
B.8.1. Description ....................................................................................................... 380 B.8.2. Includes, Defines, and Types ........................................................................... 380 B.8.3. Static Functions................................................................................................ 380
B.8.3.1. GetHashServer() ........................................................................................ 380 B.8.3.2. MarshalHashState() .................................................................................... 381 B.8.3.3. GetHashState()........................................................................................... 381 B.8.3.4. GetHashInfoPointer() .................................................................................. 382
B.8.4. Hash Functions ................................................................................................ 382
B.8.4.1. _cpri__HashStartup() .................................................................................. 382 B.8.4.2. _cpri__GetHashAlgByIndex() ...................................................................... 382 B.8.4.3. _cpri__GetHashBlockSize() ........................................................................ 383 B.8.4.4. _cpri__GetHashDER .................................................................................. 383 B.8.4.5. _cpri__GetDigestSize() ............................................................................... 383 B.8.4.6. _cpri__GetContextAlg() .............................................................................. 384 B.8.4.7. _cpri__CopyHashState ............................................................................... 384 B.8.4.8. _cpri__StartHash() ..................................................................................... 384 B.8.4.9. _cpri__UpdateHash() .................................................................................. 385 B.8.4.10. _cpri__CompleteHash() .............................................................................. 386 B.8.4.11. _cpri__ImportExportHashState() ................................................................. 387 B.8.4.12. _cpri__HashBlock() .................................................................................... 388
B.8.5. HMAC Functions .............................................................................................. 389
B.8.5.1. _cpri__StartHMAC ...................................................................................... 389 B.8.5.2. _cpri_CompleteHMAC() .............................................................................. 390
B.8.6. Mask and Key Generation Functions ................................................................ 390
B.8.6.1. _crypi_MGF1() ............................................................................................ 390 B.8.6.2. _cpri_KDFa() .............................................................................................. 392 B.8.6.3. _c