X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdePkg%2FInclude%2FIndustryStandard%2FTpm12.h;h=5bcc16ca7e3cef3b28d008860104a17346ceb8af;hb=4994588211f03b41031b21fd8c6570191b5e53f7;hp=a0fc4562aab20d36d8704ac7b1e525d53b76e647;hpb=54569f0f8fa7cb0f11a6cbfb6d73e2a14014c6c9;p=mirror_edk2.git diff --git a/MdePkg/Include/IndustryStandard/Tpm12.h b/MdePkg/Include/IndustryStandard/Tpm12.h index a0fc4562aa..5bcc16ca7e 100644 --- a/MdePkg/Include/IndustryStandard/Tpm12.h +++ b/MdePkg/Include/IndustryStandard/Tpm12.h @@ -1,9 +1,9 @@ /** @file - TPM Specification data structures (TCG TPM Specification Version 1.2 Revision 94) + TPM Specification data structures (TCG TPM Specification Version 1.2 Revision 103) See http://trustedcomputinggroup.org for latest specification updates - Copyright (c) 2006 - 2008, Intel Corporation - All rights reserved. This program and the accompanying materials + Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+ This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -19,57 +19,190 @@ /// /// The start of TPM return codes /// -#define TPM_BASE (EFI_MAX_BIT + (EFI_MAX_BIT >> 1)) +#define TPM_BASE 0 // -// Structures are all packed on 1-byte alignment +// All structures MUST be packed on a byte boundary. // + #pragma pack (1) // // Part 2, section 2.2.3: Helper redefinitions // +/// +/// Indicates the conditions where it is required that authorization be presented +/// typedef UINT8 TPM_AUTH_DATA_USAGE; +/// +/// The information as to what the payload is in an encrypted structure +/// typedef UINT8 TPM_PAYLOAD_TYPE; +/// +/// The version info breakdown +/// typedef UINT8 TPM_VERSION_BYTE; +/// +/// The state of the dictionary attack mitigation logic +/// +typedef UINT8 TPM_DA_STATE; +/// +/// The request or response authorization type +/// typedef UINT16 TPM_TAG; +/// +/// The protocol in use +/// typedef UINT16 TPM_PROTOCOL_ID; +/// +/// Indicates the start state +/// typedef UINT16 TPM_STARTUP_TYPE; +/// +/// The definition of the encryption scheme +/// typedef UINT16 TPM_ENC_SCHEME; +/// +/// The definition of the signature scheme +/// typedef UINT16 TPM_SIG_SCHEME; +/// +/// The definition of the migration scheme +/// typedef UINT16 TPM_MIGRATE_SCHEME; +/// +/// Sets the state of the physical presence mechanism +/// typedef UINT16 TPM_PHYSICAL_PRESENCE; +/// +/// Indicates the types of entity that are supported by the TPM +/// typedef UINT16 TPM_ENTITY_TYPE; +/// +/// Indicates the permitted usage of the key +/// typedef UINT16 TPM_KEY_USAGE; +/// +/// The type of asymmetric encrypted structure in use by the endorsement key +/// typedef UINT16 TPM_EK_TYPE; +/// +/// The tag for the structure +/// typedef UINT16 TPM_STRUCTURE_TAG; +/// +/// The platform specific spec to which the information relates to +/// typedef UINT16 TPM_PLATFORM_SPECIFIC; +/// +/// The command ordinal +/// typedef UINT32 TPM_COMMAND_CODE; +/// +/// Identifies a TPM capability area +/// typedef UINT32 TPM_CAPABILITY_AREA; +/// +/// Indicates information regarding a key +/// typedef UINT32 TPM_KEY_FLAGS; +/// +/// Indicates the type of algorithm +/// typedef UINT32 TPM_ALGORITHM_ID; +/// +/// The locality modifier +/// typedef UINT32 TPM_MODIFIER_INDICATOR; +/// +/// The actual number of a counter +/// typedef UINT32 TPM_ACTUAL_COUNT; +/// +/// Attributes that define what options are in use for a transport session +/// typedef UINT32 TPM_TRANSPORT_ATTRIBUTES; +/// +/// Handle to an authorization session +/// typedef UINT32 TPM_AUTHHANDLE; +/// +/// Index to a DIR register +/// typedef UINT32 TPM_DIRINDEX; +/// +/// The area where a key is held assigned by the TPM +/// typedef UINT32 TPM_KEY_HANDLE; +/// +/// Index to a PCR register +/// typedef UINT32 TPM_PCRINDEX; +/// +/// The return code from a function +/// typedef UINT32 TPM_RESULT; +/// +/// The types of resources that a TPM may have using internal resources +/// typedef UINT32 TPM_RESOURCE_TYPE; +/// +/// Allows for controlling of the key when loaded and how to handle TPM_Startup issues +/// typedef UINT32 TPM_KEY_CONTROL; +/// +/// The index into the NV storage area +/// typedef UINT32 TPM_NV_INDEX; +/// +/// The family ID. Family IDs are automatically assigned a sequence number by the TPM. +/// A trusted process can set the FamilyID value in an individual row to NULL, which +/// invalidates that row. The family ID resets to NULL on each change of TPM Owner. +/// typedef UINT32 TPM_FAMILY_ID; +/// +/// IA value used as a label for the most recent verification of this family. Set to zero when not in use. +/// typedef UINT32 TPM_FAMILY_VERIFICATION; +/// +/// How the TPM handles var +/// typedef UINT32 TPM_STARTUP_EFFECTS; +/// +/// The mode of a symmetric encryption +/// typedef UINT32 TPM_SYM_MODE; +/// +/// The family flags +/// typedef UINT32 TPM_FAMILY_FLAGS; +/// +/// The index value for the delegate NV table +/// typedef UINT32 TPM_DELEGATE_INDEX; +/// +/// The restrictions placed on delegation of CMK commands +/// typedef UINT32 TPM_CMK_DELEGATE; +/// +/// The ID value of a monotonic counter +/// typedef UINT32 TPM_COUNT_ID; +/// +/// A command to execute +/// typedef UINT32 TPM_REDIT_COMMAND; +/// +/// A transport session handle +/// typedef UINT32 TPM_TRANSHANDLE; +/// +/// A generic handle could be key, transport etc +/// typedef UINT32 TPM_HANDLE; +/// +/// What operation is happening +/// typedef UINT32 TPM_FAMILY_OPERATION; // @@ -137,6 +270,9 @@ typedef UINT32 TPM_FAMILY_OPERATION; #define TPM_TAG_CMK_SIGTICKET ((TPM_STRUCTURE_TAG) 0x0034) #define TPM_TAG_CMK_MA_APPROVAL ((TPM_STRUCTURE_TAG) 0x0035) #define TPM_TAG_QUOTE_INFO2 ((TPM_STRUCTURE_TAG) 0x0036) +#define TPM_TAG_DA_INFO ((TPM_STRUCTURE_TAG) 0x0037) +#define TPM_TAG_DA_LIMITED ((TPM_STRUCTURE_TAG) 0x0038) +#define TPM_TAG_DA_ACTION_TYPE ((TPM_STRUCTURE_TAG) 0x0039) // // Part 2, section 4: TPM Types @@ -183,6 +319,7 @@ typedef UINT32 TPM_FAMILY_OPERATION; #define TPM_ET_DEL_KEY_BLOB ((UINT16) 0x0009) ///< The entity is a delegate key blob #define TPM_ET_COUNTER ((UINT16) 0x000A) ///< The entity is a counter #define TPM_ET_NV ((UINT16) 0x000B) ///< The entity is a NV index +#define TPM_ET_OPERATOR ((UINT16) 0x000C) ///< The entity is the operator #define TPM_ET_RESERVED_HANDLE ((UINT16) 0x0040) ///< Reserved. This value avoids collisions with the handle MSB setting. // // TPM_ENTITY_TYPE MSB Values: The MSB is used to indicate the ADIP encryption sheme when applicable @@ -280,9 +417,9 @@ typedef UINT32 TPM_FAMILY_OPERATION; // Part 2, section 5: Basic Structures // -// -// Part 2, section 5.1: TPM_STRUCT_VER -// +/// +/// Part 2, section 5.1: TPM_STRUCT_VER +/// typedef struct tdTPM_STRUCT_VER { UINT8 major; UINT8 minor; @@ -290,9 +427,9 @@ typedef struct tdTPM_STRUCT_VER { UINT8 revMinor; } TPM_STRUCT_VER; -// -// Part 2, section 5.3: TPM_VERSION -// +/// +/// Part 2, section 5.3: TPM_VERSION +/// typedef struct tdTPM_VERSION { TPM_VERSION_BYTE major; TPM_VERSION_BYTE minor; @@ -300,44 +437,80 @@ typedef struct tdTPM_VERSION { UINT8 revMinor; } TPM_VERSION; -// -// Part 2, section 5.4: TPM_DIGEST -// + #define TPM_SHA1_160_HASH_LEN 0x14 #define TPM_SHA1BASED_NONCE_LEN TPM_SHA1_160_HASH_LEN +/// +/// Part 2, section 5.4: TPM_DIGEST +/// typedef struct tdTPM_DIGEST{ UINT8 digest[TPM_SHA1_160_HASH_LEN]; } TPM_DIGEST; +/// +/// This SHALL be the digest of the chosen identityLabel and privacyCA for a new TPM identity +/// typedef TPM_DIGEST TPM_CHOSENID_HASH; +/// +/// This SHALL be the hash of a list of PCR indexes and PCR values that a key or data is bound to +/// typedef TPM_DIGEST TPM_COMPOSITE_HASH; +/// +/// This SHALL be the value of a DIR register +/// typedef TPM_DIGEST TPM_DIRVALUE; + typedef TPM_DIGEST TPM_HMAC; +/// +/// The value inside of the PCR +/// typedef TPM_DIGEST TPM_PCRVALUE; +/// +/// This SHALL be the value of the current internal audit state +/// typedef TPM_DIGEST TPM_AUDITDIGEST; -typedef TPM_DIGEST TPM_DAA_TPM_SEED; -typedef TPM_DIGEST TPM_DAA_CONTEXT_SEED; -// -// Part 2, section 5.5: TPM_NONCE -// +/// +/// Part 2, section 5.5: TPM_NONCE +/// typedef struct tdTPM_NONCE{ UINT8 nonce[20]; } TPM_NONCE; +/// +/// This SHALL be a random value generated by a TPM immediately after the EK is installed +/// in that TPM, whenever an EK is installed in that TPM +/// +typedef TPM_NONCE TPM_DAA_TPM_SEED; +/// +/// This SHALL be a random value +/// +typedef TPM_NONCE TPM_DAA_CONTEXT_SEED; + // // Part 2, section 5.6: TPM_AUTHDATA // +/// +/// The AuthData data is the information that is saved or passed to provide proof of ownership +/// 296 of an entity +/// typedef UINT8 tdTPM_AUTHDATA[20]; + typedef tdTPM_AUTHDATA TPM_AUTHDATA; +/// +/// A secret plaintext value used in the authorization process +/// typedef TPM_AUTHDATA TPM_SECRET; +/// +/// A ciphertext (encrypted) version of AuthData data. The encryption mechanism depends on the context +/// typedef TPM_AUTHDATA TPM_ENCAUTH; -// -// Part 2, section 5.7: TPM_KEY_HANDLE_LIST -// Size of handle is loaded * sizeof(TPM_KEY_HANDLE) -// +/// +/// Part 2, section 5.7: TPM_KEY_HANDLE_LIST +/// Size of handle is loaded * sizeof(TPM_KEY_HANDLE) +/// typedef struct tdTPM_KEY_HANDLE_LIST { UINT16 loaded; TPM_KEY_HANDLE handle[1]; @@ -393,7 +566,8 @@ typedef struct tdTPM_KEY_HANDLE_LIST { #define TPM_ES_NONE ((TPM_ENC_SCHEME) 0x0001) #define TPM_ES_RSAESPKCSv15 ((TPM_ENC_SCHEME) 0x0002) #define TPM_ES_RSAESOAEP_SHA1_MGF1 ((TPM_ENC_SCHEME) 0x0003) -#define TPM_ES_SYM_CNT ((TPM_ENC_SCHEME) 0x0004) +#define TPM_ES_SYM_CNT ((TPM_ENC_SCHEME) 0x0004) ///< rev94 defined +#define TPM_ES_SYM_CTR ((TPM_ENC_SCHEME) 0x0004) #define TPM_ES_SYM_OFB ((TPM_ENC_SCHEME) 0x0005) #define TPM_SS_NONE ((TPM_SIG_SCHEME) 0x0001) @@ -408,9 +582,9 @@ typedef struct tdTPM_KEY_HANDLE_LIST { #define TPM_AUTH_ALWAYS ((TPM_AUTH_DATA_USAGE) 0x01) #define TPM_AUTH_PRIV_USE_ONLY ((TPM_AUTH_DATA_USAGE) 0x03) -// -// Part 2, section 5.10: TPM_KEY_FLAGS -// +/// +/// Part 2, section 5.10: TPM_KEY_FLAGS +/// typedef enum tdTPM_KEY_FLAGS { redirection = 0x00000001, migratable = 0x00000002, @@ -419,21 +593,21 @@ typedef enum tdTPM_KEY_FLAGS { migrateAuthority = 0x00000010 } TPM_KEY_FLAGS_BITS; -// -// Part 2, section 5.11: TPM_CHANGEAUTH_VALIDATE -// +/// +/// Part 2, section 5.11: TPM_CHANGEAUTH_VALIDATE +/// typedef struct tdTPM_CHANGEAUTH_VALIDATE { TPM_SECRET newAuthSecret; TPM_NONCE n1; } TPM_CHANGEAUTH_VALIDATE; -// -// Part 2, section 5.12: TPM_MIGRATIONKEYAUTH -// decalared after section 10 to catch declaration of TPM_PUBKEY -// -// Part 2 section 10.1: TPM_KEY_PARMS -// [size_is(parmSize)] BYTE* parms; -// +/// +/// Part 2, section 5.12: TPM_MIGRATIONKEYAUTH +/// decalared after section 10 to catch declaration of TPM_PUBKEY +/// +/// Part 2 section 10.1: TPM_KEY_PARMS +/// [size_is(parmSize)] BYTE* parms; +/// typedef struct tdTPM_KEY_PARMS { TPM_ALGORITHM_ID algorithmID; TPM_ENC_SCHEME encScheme; @@ -442,44 +616,44 @@ typedef struct tdTPM_KEY_PARMS { UINT8 *parms; } TPM_KEY_PARMS; -// -// Part 2, section 10.4: TPM_STORE_PUBKEY -// +/// +/// Part 2, section 10.4: TPM_STORE_PUBKEY +/// typedef struct tdTPM_STORE_PUBKEY { UINT32 keyLength; UINT8 key[1]; } TPM_STORE_PUBKEY; -// -// Part 2, section 10.5: TPM_PUBKEY -// +/// +/// Part 2, section 10.5: TPM_PUBKEY +/// typedef struct tdTPM_PUBKEY{ TPM_KEY_PARMS algorithmParms; TPM_STORE_PUBKEY pubKey; } TPM_PUBKEY; -// -// Part 2, section 5.12: TPM_MIGRATIONKEYAUTH -// +/// +/// Part 2, section 5.12: TPM_MIGRATIONKEYAUTH +/// typedef struct tdTPM_MIGRATIONKEYAUTH{ TPM_PUBKEY migrationKey; TPM_MIGRATE_SCHEME migrationScheme; TPM_DIGEST digest; } TPM_MIGRATIONKEYAUTH; -// -// Part 2, section 5.13: TPM_COUNTER_VALUE -// +/// +/// Part 2, section 5.13: TPM_COUNTER_VALUE +/// typedef struct tdTPM_COUNTER_VALUE{ TPM_STRUCTURE_TAG tag; UINT8 label[4]; TPM_ACTUAL_COUNT counter; } TPM_COUNTER_VALUE; -// -// Part 2, section 5.14: TPM_SIGN_INFO -// Size of data indicated by dataLen -// +/// +/// Part 2, section 5.14: TPM_SIGN_INFO +/// Size of data indicated by dataLen +/// typedef struct tdTPM_SIGN_INFO { TPM_STRUCTURE_TAG tag; UINT8 fixed[4]; @@ -488,18 +662,18 @@ typedef struct tdTPM_SIGN_INFO { UINT8 *data; } TPM_SIGN_INFO; -// -// Part 2, section 5.15: TPM_MSA_COMPOSITE -// Number of migAuthDigest indicated by MSAlist -// +/// +/// Part 2, section 5.15: TPM_MSA_COMPOSITE +/// Number of migAuthDigest indicated by MSAlist +/// typedef struct tdTPM_MSA_COMPOSITE { UINT32 MSAlist; TPM_DIGEST migAuthDigest[1]; } TPM_MSA_COMPOSITE; -// -// Part 2, section 5.16: TPM_CMK_AUTH -// +/// +/// Part 2, section 5.16: TPM_CMK_AUTH +/// typedef struct tdTPM_CMK_AUTH{ TPM_DIGEST migrationAuthorityDigest; TPM_DIGEST destinationKeyDigest; @@ -515,36 +689,36 @@ typedef struct tdTPM_CMK_AUTH{ #define TPM_CMK_DELEGATE_LEGACY ((TPM_CMK_DELEGATE) BIT28) #define TPM_CMK_DELEGATE_MIGRATE ((TPM_CMK_DELEGATE) BIT27) -// -// Part 2, section 5.18: TPM_SELECT_SIZE -// +/// +/// Part 2, section 5.18: TPM_SELECT_SIZE +/// typedef struct tdTPM_SELECT_SIZE { UINT8 major; UINT8 minor; UINT16 reqSize; } TPM_SELECT_SIZE; -// -// Part 2, section 5,19: TPM_CMK_MIGAUTH -// +/// +/// Part 2, section 5,19: TPM_CMK_MIGAUTH +/// typedef struct tdTPM_CMK_MIGAUTH{ TPM_STRUCTURE_TAG tag; TPM_DIGEST msaDigest; TPM_DIGEST pubKeyDigest; } TPM_CMK_MIGAUTH; -// -// Part 2, section 5.20: TPM_CMK_SIGTICKET -// +/// +/// Part 2, section 5.20: TPM_CMK_SIGTICKET +/// typedef struct tdTPM_CMK_SIGTICKET{ TPM_STRUCTURE_TAG tag; TPM_DIGEST verKeyDigest; TPM_DIGEST signedData; } TPM_CMK_SIGTICKET; -// -// Part 2, section 5.21: TPM_CMK_MA_APPROVAL -// +/// +/// Part 2, section 5.21: TPM_CMK_MA_APPROVAL +/// typedef struct tdTPM_CMK_MA_APPROVAL{ TPM_STRUCTURE_TAG tag; TPM_DIGEST migrationAuthorityDigest; @@ -560,9 +734,9 @@ typedef struct tdTPM_CMK_MA_APPROVAL{ #define TPM_TAG_RSP_AUTH1_COMMAND ((TPM_STRUCTURE_TAG) 0x00C5) #define TPM_TAG_RSP_AUTH2_COMMAND ((TPM_STRUCTURE_TAG) 0x00C6) -// -// Part 2, section 7.1: TPM_PERMANENT_FLAGS -// +/// +/// Part 2, section 7.1: TPM_PERMANENT_FLAGS +/// typedef struct tdTPM_PERMANENT_FLAGS{ TPM_STRUCTURE_TAG tag; BOOLEAN disable; @@ -584,6 +758,7 @@ typedef struct tdTPM_PERMANENT_FLAGS{ BOOLEAN readSRKPub; BOOLEAN tpmEstablished; BOOLEAN maintenanceDone; + BOOLEAN disableFullDALogicInfo; } TPM_PERMANENT_FLAGS; // @@ -608,10 +783,11 @@ typedef struct tdTPM_PERMANENT_FLAGS{ #define TPM_PF_READSRKPUB ((TPM_CAPABILITY_AREA) 17) #define TPM_PF_TPMESTABLISHED ((TPM_CAPABILITY_AREA) 18) #define TPM_PF_MAINTENANCEDONE ((TPM_CAPABILITY_AREA) 19) +#define TPM_PF_DISABLEFULLDALOGICINFO ((TPM_CAPABILITY_AREA) 20) -// -// Part 2, section 7.2: TPM_STCLEAR_FLAGS -// +/// +/// Part 2, section 7.2: TPM_STCLEAR_FLAGS +/// typedef struct tdTPM_STCLEAR_FLAGS{ TPM_STRUCTURE_TAG tag; BOOLEAN deactivated; @@ -630,9 +806,9 @@ typedef struct tdTPM_STCLEAR_FLAGS{ #define TPM_SF_PHYSICALPRESENCELOCK ((TPM_CAPABILITY_AREA) 4) #define TPM_SF_BGLOBALLOCK ((TPM_CAPABILITY_AREA) 5) -// -// Part 2, section 7.3: TPM_STANY_FLAGS -// +/// +/// Part 2, section 7.3: TPM_STANY_FLAGS +/// typedef struct tdTPM_STANY_FLAGS{ TPM_STRUCTURE_TAG tag; BOOLEAN postInitialise; @@ -653,42 +829,111 @@ typedef struct tdTPM_STANY_FLAGS{ // All those structures defined in section 7.4, 7.5, 7.6 are not normative and // thus no definitions here // +// Part 2, section 7.4: TPM_PERMANENT_DATA +// +#define TPM_MIN_COUNTERS 4 ///< the minimum number of counters is 4 +#define TPM_DELEGATE_KEY TPM_KEY +#define TPM_NUM_PCR 16 +#define TPM_MAX_NV_WRITE_NOOWNER 64 + +// +// Part 2, section 7.4.1: PERMANENT_DATA Subcap for SetCapability +// +#define TPM_PD_REVMAJOR ((TPM_CAPABILITY_AREA) 1) +#define TPM_PD_REVMINOR ((TPM_CAPABILITY_AREA) 2) +#define TPM_PD_TPMPROOF ((TPM_CAPABILITY_AREA) 3) +#define TPM_PD_OWNERAUTH ((TPM_CAPABILITY_AREA) 4) +#define TPM_PD_OPERATORAUTH ((TPM_CAPABILITY_AREA) 5) +#define TPM_PD_MANUMAINTPUB ((TPM_CAPABILITY_AREA) 6) +#define TPM_PD_ENDORSEMENTKEY ((TPM_CAPABILITY_AREA) 7) +#define TPM_PD_SRK ((TPM_CAPABILITY_AREA) 8) +#define TPM_PD_DELEGATEKEY ((TPM_CAPABILITY_AREA) 9) +#define TPM_PD_CONTEXTKEY ((TPM_CAPABILITY_AREA) 10) +#define TPM_PD_AUDITMONOTONICCOUNTER ((TPM_CAPABILITY_AREA) 11) +#define TPM_PD_MONOTONICCOUNTER ((TPM_CAPABILITY_AREA) 12) +#define TPM_PD_PCRATTRIB ((TPM_CAPABILITY_AREA) 13) +#define TPM_PD_ORDINALAUDITSTATUS ((TPM_CAPABILITY_AREA) 14) +#define TPM_PD_AUTHDIR ((TPM_CAPABILITY_AREA) 15) +#define TPM_PD_RNGSTATE ((TPM_CAPABILITY_AREA) 16) +#define TPM_PD_FAMILYTABLE ((TPM_CAPABILITY_AREA) 17) +#define TPM_DELEGATETABLE ((TPM_CAPABILITY_AREA) 18) +#define TPM_PD_EKRESET ((TPM_CAPABILITY_AREA) 19) +#define TPM_PD_MAXNVBUFSIZE ((TPM_CAPABILITY_AREA) 20) +#define TPM_PD_LASTFAMILYID ((TPM_CAPABILITY_AREA) 21) +#define TPM_PD_NOOWNERNVWRITE ((TPM_CAPABILITY_AREA) 22) +#define TPM_PD_RESTRICTDELEGATE ((TPM_CAPABILITY_AREA) 23) +#define TPM_PD_TPMDAASEED ((TPM_CAPABILITY_AREA) 24) +#define TPM_PD_DAAPROOF ((TPM_CAPABILITY_AREA) 25) + +/// +/// Part 2, section 7.5: TPM_STCLEAR_DATA +/// available inside TPM only +/// + typedef struct tdTPM_STCLEAR_DATA{ + TPM_STRUCTURE_TAG tag; + TPM_NONCE contextNonceKey; + TPM_COUNT_ID countID; + UINT32 ownerReference; + BOOLEAN disableResetLock; + TPM_PCRVALUE PCR[TPM_NUM_PCR]; + UINT32 deferredPhysicalPresence; + }TPM_STCLEAR_DATA; // -// Part 2, section 8: PCR Structures -// +// Part 2, section 7.5.1: STCLEAR_DATA Subcap for SetCapability +// +#define TPM_SD_CONTEXTNONCEKEY ((TPM_CAPABILITY_AREA)0x00000001) +#define TPM_SD_COUNTID ((TPM_CAPABILITY_AREA)0x00000002) +#define TPM_SD_OWNERREFERENCE ((TPM_CAPABILITY_AREA)0x00000003) +#define TPM_SD_DISABLERESETLOCK ((TPM_CAPABILITY_AREA)0x00000004) +#define TPM_SD_PCR ((TPM_CAPABILITY_AREA)0x00000005) +#define TPM_SD_DEFERREDPHYSICALPRESENCE ((TPM_CAPABILITY_AREA)0x00000006) // -// Part 2, section 8.1: TPM_PCR_SELECTION -// Size of pcrSelect[] indicated by sizeOfSelect +// Part 2, section 7.6.1: STANY_DATA Subcap for SetCapability // +#define TPM_AD_CONTEXTNONCESESSION ((TPM_CAPABILITY_AREA) 1) +#define TPM_AD_AUDITDIGEST ((TPM_CAPABILITY_AREA) 2) +#define TPM_AD_CURRENTTICKS ((TPM_CAPABILITY_AREA) 3) +#define TPM_AD_CONTEXTCOUNT ((TPM_CAPABILITY_AREA) 4) +#define TPM_AD_CONTEXTLIST ((TPM_CAPABILITY_AREA) 5) +#define TPM_AD_SESSIONS ((TPM_CAPABILITY_AREA) 6) + +// +// Part 2, section 8: PCR Structures +// + +/// +/// Part 2, section 8.1: TPM_PCR_SELECTION +/// Size of pcrSelect[] indicated by sizeOfSelect +/// typedef struct tdTPM_PCR_SELECTION { UINT16 sizeOfSelect; UINT8 pcrSelect[1]; } TPM_PCR_SELECTION; -// -// Part 2, section 8.2: TPM_PCR_COMPOSITE -// Size of pcrValue[] indicated by valueSize -// +/// +/// Part 2, section 8.2: TPM_PCR_COMPOSITE +/// Size of pcrValue[] indicated by valueSize +/// typedef struct tdTPM_PCR_COMPOSITE { TPM_PCR_SELECTION select; UINT32 valueSize; TPM_PCRVALUE pcrValue[1]; } TPM_PCR_COMPOSITE; -// -// Part 2, section 8.3: TPM_PCR_INFO -// +/// +/// Part 2, section 8.3: TPM_PCR_INFO +/// typedef struct tdTPM_PCR_INFO { TPM_PCR_SELECTION pcrSelection; TPM_COMPOSITE_HASH digestAtRelease; TPM_COMPOSITE_HASH digestAtCreation; } TPM_PCR_INFO; -// -// Part 2, section 8.6: TPM_LOCALITY_SELECTION -// +/// +/// Part 2, section 8.6: TPM_LOCALITY_SELECTION +/// typedef UINT8 TPM_LOCALITY_SELECTION; #define TPM_LOC_FOUR ((UINT8) 0x10) @@ -697,9 +942,9 @@ typedef UINT8 TPM_LOCALITY_SELECTION; #define TPM_LOC_ONE ((UINT8) 0x02) #define TPM_LOC_ZERO ((UINT8) 0x01) -// -// Part 2, section 8.4: TPM_PCR_INFO_LONG -// +/// +/// Part 2, section 8.4: TPM_PCR_INFO_LONG +/// typedef struct tdTPM_PCR_INFO_LONG { TPM_STRUCTURE_TAG tag; TPM_LOCALITY_SELECTION localityAtCreation; @@ -710,18 +955,18 @@ typedef struct tdTPM_PCR_INFO_LONG { TPM_COMPOSITE_HASH digestAtRelease; } TPM_PCR_INFO_LONG; -// -// Part 2, section 8.5: TPM_PCR_INFO_SHORT -// +/// +/// Part 2, section 8.5: TPM_PCR_INFO_SHORT +/// typedef struct tdTPM_PCR_INFO_SHORT{ TPM_PCR_SELECTION pcrSelection; TPM_LOCALITY_SELECTION localityAtRelease; TPM_COMPOSITE_HASH digestAtRelease; } TPM_PCR_INFO_SHORT; -// -// Part 2, section 8.8: TPM_PCR_ATTRIBUTES -// +/// +/// Part 2, section 8.8: TPM_PCR_ATTRIBUTES +/// typedef struct tdTPM_PCR_ATTRIBUTES{ BOOLEAN pcrReset; TPM_LOCALITY_SELECTION pcrExtendLocal; @@ -732,11 +977,11 @@ typedef struct tdTPM_PCR_ATTRIBUTES{ // Part 2, section 9: Storage Structures // -// -// Part 2, section 9.1: TPM_STORED_DATA -// [size_is(sealInfoSize)] BYTE* sealInfo; -// [size_is(encDataSize)] BYTE* encData; -// +/// +/// Part 2, section 9.1: TPM_STORED_DATA +/// [size_is(sealInfoSize)] BYTE* sealInfo; +/// [size_is(encDataSize)] BYTE* encData; +/// typedef struct tdTPM_STORED_DATA { TPM_STRUCT_VER ver; UINT32 sealInfoSize; @@ -745,11 +990,11 @@ typedef struct tdTPM_STORED_DATA { UINT8 *encData; } TPM_STORED_DATA; -// -// Part 2, section 9.2: TPM_STORED_DATA12 -// [size_is(sealInfoSize)] BYTE* sealInfo; -// [size_is(encDataSize)] BYTE* encData; -// +/// +/// Part 2, section 9.2: TPM_STORED_DATA12 +/// [size_is(sealInfoSize)] BYTE* sealInfo; +/// [size_is(encDataSize)] BYTE* encData; +/// typedef struct tdTPM_STORED_DATA12 { TPM_STRUCTURE_TAG tag; TPM_ENTITY_TYPE et; @@ -759,10 +1004,10 @@ typedef struct tdTPM_STORED_DATA12 { UINT8 *encData; } TPM_STORED_DATA12; -// -// Part 2, section 9.3: TPM_SEALED_DATA -// [size_is(dataSize)] BYTE* data; -// +/// +/// Part 2, section 9.3: TPM_SEALED_DATA +/// [size_is(dataSize)] BYTE* data; +/// typedef struct tdTPM_SEALED_DATA { TPM_PAYLOAD_TYPE payload; TPM_SECRET authData; @@ -772,10 +1017,10 @@ typedef struct tdTPM_SEALED_DATA { UINT8 *data; } TPM_SEALED_DATA; -// -// Part 2, section 9.4: TPM_SYMMETRIC_KEY -// [size_is(size)] BYTE* data; -// +/// +/// Part 2, section 9.4: TPM_SYMMETRIC_KEY +/// [size_is(size)] BYTE* data; +/// typedef struct tdTPM_SYMMETRIC_KEY { TPM_ALGORITHM_ID algId; TPM_ENC_SCHEME encScheme; @@ -783,9 +1028,9 @@ typedef struct tdTPM_SYMMETRIC_KEY { UINT8 *data; } TPM_SYMMETRIC_KEY; -// -// Part 2, section 9.5: TPM_BOUND_DATA -// +/// +/// Part 2, section 9.5: TPM_BOUND_DATA +/// typedef struct tdTPM_BOUND_DATA { TPM_STRUCT_VER ver; TPM_PAYLOAD_TYPE payload; @@ -800,10 +1045,10 @@ typedef struct tdTPM_BOUND_DATA { // Section 10.1, 10.4, and 10.5 have been defined previously // -// -// Part 2, section 10.2: TPM_KEY -// [size_is(encDataSize)] BYTE* encData; -// +/// +/// Part 2, section 10.2: TPM_KEY +/// [size_is(encDataSize)] BYTE* encData; +/// typedef struct tdTPM_KEY{ TPM_STRUCT_VER ver; TPM_KEY_USAGE keyUsage; @@ -817,10 +1062,10 @@ typedef struct tdTPM_KEY{ UINT8 *encData; } TPM_KEY; -// -// Part 2, section 10.3: TPM_KEY12 -// [size_is(encDataSize)] BYTE* encData; -// +/// +/// Part 2, section 10.3: TPM_KEY12 +/// [size_is(encDataSize)] BYTE* encData; +/// typedef struct tdTPM_KEY12{ TPM_STRUCTURE_TAG tag; UINT16 fill; @@ -835,18 +1080,18 @@ typedef struct tdTPM_KEY12{ UINT8 *encData; } TPM_KEY12; -// -// Part 2, section 10.7: TPM_STORE_PRIVKEY -// [size_is(keyLength)] BYTE* key; -// +/// +/// Part 2, section 10.7: TPM_STORE_PRIVKEY +/// [size_is(keyLength)] BYTE* key; +/// typedef struct tdTPM_STORE_PRIVKEY { UINT32 keyLength; UINT8 *key; } TPM_STORE_PRIVKEY; -// -// Part 2, section 10.6: TPM_STORE_ASYMKEY -// +/// +/// Part 2, section 10.6: TPM_STORE_ASYMKEY +/// typedef struct tdTPM_STORE_ASYMKEY { // pos len total TPM_PAYLOAD_TYPE payload; // 0 1 1 TPM_SECRET usageAuth; // 1 20 21 @@ -855,10 +1100,10 @@ typedef struct tdTPM_STORE_ASYMKEY { // pos len total TPM_STORE_PRIVKEY privKey; // 61 132-151 193-214 } TPM_STORE_ASYMKEY; -// -// Part 2, section 10.8: TPM_MIGRATE_ASYMKEY -// [size_is(partPrivKeyLen)] BYTE* partPrivKey; -// +/// +/// Part 2, section 10.8: TPM_MIGRATE_ASYMKEY +/// [size_is(partPrivKeyLen)] BYTE* partPrivKey; +/// typedef struct tdTPM_MIGRATE_ASYMKEY { // pos len total TPM_PAYLOAD_TYPE payload; // 0 1 1 TPM_SECRET usageAuth; // 1 20 21 @@ -867,18 +1112,18 @@ typedef struct tdTPM_MIGRATE_ASYMKEY { // pos len total UINT8 *partPrivKey; // 45 112-127 157-172 } TPM_MIGRATE_ASYMKEY; -// -// Part 2, section 10.9: TPM_KEY_CONTROL -// +/// +/// Part 2, section 10.9: TPM_KEY_CONTROL +/// #define TPM_KEY_CONTROL_OWNER_EVICT ((UINT32) 0x00000001) // // Part 2, section 11: Signed Structures // -// -// Part 2, section 11.1: TPM_CERTIFY_INFO Structure -// +/// +/// Part 2, section 11.1: TPM_CERTIFY_INFO Structure +/// typedef struct tdTPM_CERTIFY_INFO { TPM_STRUCT_VER version; TPM_KEY_USAGE keyUsage; @@ -892,9 +1137,9 @@ typedef struct tdTPM_CERTIFY_INFO { UINT8 *PCRInfo; } TPM_CERTIFY_INFO; -// -// Part 2, section 11.2: TPM_CERTIFY_INFO2 Structure -// +/// +/// Part 2, section 11.2: TPM_CERTIFY_INFO2 Structure +/// typedef struct tdTPM_CERTIFY_INFO2 { TPM_STRUCTURE_TAG tag; UINT8 fill; @@ -912,9 +1157,9 @@ typedef struct tdTPM_CERTIFY_INFO2 { UINT8 *migrationAuthority; } TPM_CERTIFY_INFO2; -// -// Part 2, section 11.3 TPM_QUOTE_INFO Structure -// +/// +/// Part 2, section 11.3 TPM_QUOTE_INFO Structure +/// typedef struct tdTPM_QUOTE_INFO { TPM_STRUCT_VER version; UINT8 fixed[4]; @@ -922,9 +1167,9 @@ typedef struct tdTPM_QUOTE_INFO { TPM_NONCE externalData; } TPM_QUOTE_INFO; -// -// Part 2, section 11.4 TPM_QUOTE_INFO2 Structure -// +/// +/// Part 2, section 11.4 TPM_QUOTE_INFO2 Structure +/// typedef struct tdTPM_QUOTE_INFO2 { TPM_STRUCTURE_TAG tag; UINT8 fixed[4]; @@ -936,9 +1181,9 @@ typedef struct tdTPM_QUOTE_INFO2 { // Part 2, section 12: Identity Structures // -// -// Part 2, section 12.1 TPM_EK_BLOB -// +/// +/// Part 2, section 12.1 TPM_EK_BLOB +/// typedef struct tdTPM_EK_BLOB { TPM_STRUCTURE_TAG tag; TPM_EK_TYPE ekType; @@ -946,9 +1191,9 @@ typedef struct tdTPM_EK_BLOB { UINT8 *blob; } TPM_EK_BLOB; -// -// Part 2, section 12.2 TPM_EK_BLOB_ACTIVATE -// +/// +/// Part 2, section 12.2 TPM_EK_BLOB_ACTIVATE +/// typedef struct tdTPM_EK_BLOB_ACTIVATE { TPM_STRUCTURE_TAG tag; TPM_SYMMETRIC_KEY sessionKey; @@ -956,18 +1201,18 @@ typedef struct tdTPM_EK_BLOB_ACTIVATE { TPM_PCR_INFO_SHORT pcrInfo; } TPM_EK_BLOB_ACTIVATE; -// -// Part 2, section 12.3 TPM_EK_BLOB_AUTH -// +/// +/// Part 2, section 12.3 TPM_EK_BLOB_AUTH +/// typedef struct tdTPM_EK_BLOB_AUTH { TPM_STRUCTURE_TAG tag; TPM_SECRET authValue; } TPM_EK_BLOB_AUTH; -// -// Part 2, section 12.5 TPM_IDENTITY_CONTENTS -// +/// +/// Part 2, section 12.5 TPM_IDENTITY_CONTENTS +/// typedef struct tdTPM_IDENTITY_CONTENTS { TPM_STRUCT_VER ver; UINT32 ordinal; @@ -975,9 +1220,9 @@ typedef struct tdTPM_IDENTITY_CONTENTS { TPM_PUBKEY identityPubKey; } TPM_IDENTITY_CONTENTS; -// -// Part 2, section 12.6 TPM_IDENTITY_REQ -// +/// +/// Part 2, section 12.6 TPM_IDENTITY_REQ +/// typedef struct tdTPM_IDENTITY_REQ { UINT32 asymSize; UINT32 symSize; @@ -987,9 +1232,9 @@ typedef struct tdTPM_IDENTITY_REQ { UINT8 *symBlob; } TPM_IDENTITY_REQ; -// -// Part 2, section 12.7 TPM_IDENTITY_PROOF -// +/// +/// Part 2, section 12.7 TPM_IDENTITY_PROOF +/// typedef struct tdTPM_IDENTITY_PROOF { TPM_STRUCT_VER ver; UINT32 labelSize; @@ -1005,27 +1250,27 @@ typedef struct tdTPM_IDENTITY_PROOF { UINT8 *conformanceCredential; } TPM_IDENTITY_PROOF; -// -// Part 2, section 12.8 TPM_ASYM_CA_CONTENTS -// +/// +/// Part 2, section 12.8 TPM_ASYM_CA_CONTENTS +/// typedef struct tdTPM_ASYM_CA_CONTENTS { TPM_SYMMETRIC_KEY sessionKey; TPM_DIGEST idDigest; } TPM_ASYM_CA_CONTENTS; -// -// Part 2, section 12.9 TPM_SYM_CA_ATTESTATION -// +/// +/// Part 2, section 12.9 TPM_SYM_CA_ATTESTATION +/// typedef struct tdTPM_SYM_CA_ATTESTATION { UINT32 credSize; TPM_KEY_PARMS algorithm; UINT8 *credential; } TPM_SYM_CA_ATTESTATION; -// -// Part 2, section 15: Tick Structures -// Placed here out of order because definitions are used in section 13. -// +/// +/// Part 2, section 15: Tick Structures +/// Placed here out of order because definitions are used in section 13. +/// typedef struct tdTPM_CURRENT_TICKS { TPM_STRUCTURE_TAG tag; UINT64 currentTicks; @@ -1033,13 +1278,13 @@ typedef struct tdTPM_CURRENT_TICKS { TPM_NONCE tickNonce; } TPM_CURRENT_TICKS; -// -// Part 2, section 13: Transport structures -// +/// +/// Part 2, section 13: Transport structures +/// -// -// Part 2, section 13.1: TPM _TRANSPORT_PUBLIC -// +/// +/// Part 2, section 13.1: TPM _TRANSPORT_PUBLIC +/// typedef struct tdTPM_TRANSPORT_PUBLIC { TPM_STRUCTURE_TAG tag; TPM_TRANSPORT_ATTRIBUTES transAttributes; @@ -1050,13 +1295,13 @@ typedef struct tdTPM_TRANSPORT_PUBLIC { // // Part 2, section 13.1.1 TPM_TRANSPORT_ATTRIBUTES Definitions // -#define TPM_TRANSPORT_ENCRYPT ((UINT32)0x00000001) -#define TPM_TRANSPORT_LOG ((UINT32)0x00000002) -#define TPM_TRANSPORT_EXCLUSIVE ((UINT32)0x00000004) +#define TPM_TRANSPORT_ENCRYPT ((UINT32)BIT0) +#define TPM_TRANSPORT_LOG ((UINT32)BIT1) +#define TPM_TRANSPORT_EXCLUSIVE ((UINT32)BIT2) -// -// Part 2, section 13.2 TPM_TRANSPORT_INTERNAL -// +/// +/// Part 2, section 13.2 TPM_TRANSPORT_INTERNAL +/// typedef struct tdTPM_TRANSPORT_INTERNAL { TPM_STRUCTURE_TAG tag; TPM_AUTHDATA authData; @@ -1066,18 +1311,18 @@ typedef struct tdTPM_TRANSPORT_INTERNAL { TPM_DIGEST transDigest; } TPM_TRANSPORT_INTERNAL; -// -// Part 2, section 13.3 TPM_TRANSPORT_LOG_IN structure -// +/// +/// Part 2, section 13.3 TPM_TRANSPORT_LOG_IN structure +/// typedef struct tdTPM_TRANSPORT_LOG_IN { TPM_STRUCTURE_TAG tag; TPM_DIGEST parameters; TPM_DIGEST pubKeyHash; } TPM_TRANSPORT_LOG_IN; -// -// Part 2, section 13.4 TPM_TRANSPORT_LOG_OUT structure -// +/// +/// Part 2, section 13.4 TPM_TRANSPORT_LOG_OUT structure +/// typedef struct tdTPM_TRANSPORT_LOG_OUT { TPM_STRUCTURE_TAG tag; TPM_CURRENT_TICKS currentTicks; @@ -1085,9 +1330,9 @@ typedef struct tdTPM_TRANSPORT_LOG_OUT { TPM_MODIFIER_INDICATOR locality; } TPM_TRANSPORT_LOG_OUT; -// -// Part 2, section 13.5 TPM_TRANSPORT_AUTH structure -// +/// +/// Part 2, section 13.5 TPM_TRANSPORT_AUTH structure +/// typedef struct tdTPM_TRANSPORT_AUTH { TPM_STRUCTURE_TAG tag; TPM_AUTHDATA authData; @@ -1097,18 +1342,18 @@ typedef struct tdTPM_TRANSPORT_AUTH { // Part 2, section 14: Audit Structures // -// -// Part 2, section 14.1 TPM_AUDIT_EVENT_IN structure -// +/// +/// Part 2, section 14.1 TPM_AUDIT_EVENT_IN structure +/// typedef struct tdTPM_AUDIT_EVENT_IN { TPM_STRUCTURE_TAG tag; TPM_DIGEST inputParms; TPM_COUNTER_VALUE auditCount; } TPM_AUDIT_EVENT_IN; -// -// Part 2, section 14.2 TPM_AUDIT_EVENT_OUT structure -// +/// +/// Part 2, section 14.2 TPM_AUDIT_EVENT_OUT structure +/// typedef struct tdTPM_AUDIT_EVENT_OUT { TPM_STRUCTURE_TAG tag; TPM_COMMAND_CODE ordinal; @@ -1387,9 +1632,9 @@ typedef struct tdTPM_AUDIT_EVENT_OUT { // Part 2, section 18: Context structures // -// -// Part 2, section 18.1: TPM_CONTEXT_BLOB -// +/// +/// Part 2, section 18.1: TPM_CONTEXT_BLOB +/// typedef struct tdTPM_CONTEXT_BLOB { TPM_STRUCTURE_TAG tag; TPM_RESOURCE_TYPE resourceType; @@ -1403,9 +1648,9 @@ typedef struct tdTPM_CONTEXT_BLOB { UINT8 *sensitiveData; } TPM_CONTEXT_BLOB; -// -// Part 2, section 18.2 TPM_CONTEXT_SENSITIVE -// +/// +/// Part 2, section 18.2 TPM_CONTEXT_SENSITIVE +/// typedef struct tdTPM_CONTEXT_SENSITIVE { TPM_STRUCTURE_TAG tag; TPM_NONCE contextNonce; @@ -1437,15 +1682,14 @@ typedef struct tdTPM_CONTEXT_SENSITIVE { #define TPM_NV_INDEX_PERIPHERAL_BASE ((UINT32)0x00011500) #define TPM_NV_INDEX_GROUP_RESV_BASE ((UINT32)0x00010000) -// -// The typedefs TPM_NV_PER_ATTRIBUTES (not present in TPM 1.2 Spec. have been added -// and structure fields that were to hold the following values -// -typedef UINT32 TPM_NV_PER_ATTRIBUTES; +/// +/// Part 2, section 19.2: TPM_NV_ATTRIBUTES +/// +typedef struct tdTPM_NV_ATTRIBUTES { + TPM_STRUCTURE_TAG tag; + UINT32 attributes; +} TPM_NV_ATTRIBUTES; -// -// Part 2, section 19.2: TPM_NV_ATTRIBUTES -// #define TPM_NV_PER_READ_STCLEAR (BIT31) #define TPM_NV_PER_AUTHREAD (BIT18) #define TPM_NV_PER_OWNERREAD (BIT17) @@ -1458,14 +1702,9 @@ typedef UINT32 TPM_NV_PER_ATTRIBUTES; #define TPM_NV_PER_OWNERWRITE (BIT1) #define TPM_NV_PER_PPWRITE (BIT0) -typedef struct tdTPM_NV_ATTRIBUTES { - TPM_STRUCTURE_TAG tag; - TPM_NV_PER_ATTRIBUTES attributes; -} TPM_NV_ATTRIBUTES; - -// -// Part 2, section 19.3: TPM_NV_DATA_PUBLIC -// +/// +/// Part 2, section 19.3: TPM_NV_DATA_PUBLIC +/// typedef struct tdTPM_NV_DATA_PUBLIC { TPM_STRUCTURE_TAG tag; TPM_NV_INDEX nvIndex; @@ -1482,12 +1721,11 @@ typedef struct tdTPM_NV_DATA_PUBLIC { // Part 2, section 20: Delegate Structures // -// -// Part 2, section 20.2: Delegate Definitions -// #define TPM_DEL_OWNER_BITS ((UINT32)0x00000001) #define TPM_DEL_KEY_BITS ((UINT32)0x00000002) - +/// +/// Part 2, section 20.2: Delegate Definitions +/// typedef struct tdTPM_DELEGATIONS { TPM_STRUCTURE_TAG tag; UINT32 delegateType; @@ -1501,7 +1739,9 @@ typedef struct tdTPM_DELEGATIONS { #define TPM_DELEGATE_SetOrdinalAuditStatus (BIT30) #define TPM_DELEGATE_DirWriteAuth (BIT29) #define TPM_DELEGATE_CMK_ApproveMA (BIT28) +#define TPM_DELEGATE_NV_WriteValue (BIT27) #define TPM_DELEGATE_CMK_CreateTicket (BIT26) +#define TPM_DELEGATE_NV_ReadValue (BIT25) #define TPM_DELEGATE_Delegate_LoadOwnerDelegation (BIT24) #define TPM_DELEGATE_DAA_Join (BIT23) #define TPM_DELEGATE_AuthorizeMigrationKey (BIT22) @@ -1512,6 +1752,7 @@ typedef struct tdTPM_DELEGATIONS { #define TPM_DELEGATE_ResetLockValue (BIT17) #define TPM_DELEGATE_OwnerClear (BIT16) #define TPM_DELEGATE_DisableOwnerClear (BIT15) +#define TPM_DELEGATE_NV_DefineSpace (BIT14) #define TPM_DELEGATE_OwnerSetDisable (BIT13) #define TPM_DELEGATE_SetCapability (BIT12) #define TPM_DELEGATE_MakeIdentity (BIT11) @@ -1566,16 +1807,16 @@ typedef struct tdTPM_DELEGATIONS { #define TPM_DELEGATE_ADMIN_LOCK (BIT1) #define TPM_FAMFLAG_ENABLE (BIT0) -// -// Part 2, section 20.4: TPM_FAMILY_LABEL -// +/// +/// Part 2, section 20.4: TPM_FAMILY_LABEL +/// typedef struct tdTPM_FAMILY_LABEL { UINT8 label; } TPM_FAMILY_LABEL; -// -// Part 2, section 20.5: TPM_FAMILY_TABLE_ENTRY -// +/// +/// Part 2, section 20.5: TPM_FAMILY_TABLE_ENTRY +/// typedef struct tdTPM_FAMILY_TABLE_ENTRY { TPM_STRUCTURE_TAG tag; TPM_FAMILY_LABEL label; @@ -1593,16 +1834,16 @@ typedef struct tdTPM_FAMILY_TABLE{ TPM_FAMILY_TABLE_ENTRY famTableRow[TPM_NUM_FAMILY_TABLE_ENTRY_MIN]; } TPM_FAMILY_TABLE; -// -// Part 2, section 20.7: TPM_DELEGATE_LABEL -// +/// +/// Part 2, section 20.7: TPM_DELEGATE_LABEL +/// typedef struct tdTPM_DELEGATE_LABEL { UINT8 label; } TPM_DELEGATE_LABEL; -// -// Part 2, section 20.8: TPM_DELEGATE_PUBLIC -// +/// +/// Part 2, section 20.8: TPM_DELEGATE_PUBLIC +/// typedef struct tdTPM_DELEGATE_PUBLIC { TPM_STRUCTURE_TAG tag; TPM_DELEGATE_LABEL label; @@ -1612,9 +1853,9 @@ typedef struct tdTPM_DELEGATE_PUBLIC { TPM_FAMILY_VERIFICATION verificationCount; } TPM_DELEGATE_PUBLIC; -// -// Part 2, section 20.9: TPM_DELEGATE_TABLE_ROW -// +/// +/// Part 2, section 20.9: TPM_DELEGATE_TABLE_ROW +/// typedef struct tdTPM_DELEGATE_TABLE_ROW { TPM_STRUCTURE_TAG tag; TPM_DELEGATE_PUBLIC pub; @@ -1630,17 +1871,17 @@ typedef struct tdTPM_DELEGATE_TABLE{ TPM_DELEGATE_TABLE_ROW delRow[TPM_NUM_DELEGATE_TABLE_ENTRY_MIN]; } TPM_DELEGATE_TABLE; -// -// Part 2, section 20.11: TPM_DELEGATE_SENSITIVE -// +/// +/// Part 2, section 20.11: TPM_DELEGATE_SENSITIVE +/// typedef struct tdTPM_DELEGATE_SENSITIVE { TPM_STRUCTURE_TAG tag; TPM_SECRET authValue; } TPM_DELEGATE_SENSITIVE; -// -// Part 2, section 20.12: TPM_DELEGATE_OWNER_BLOB -// +/// +/// Part 2, section 20.12: TPM_DELEGATE_OWNER_BLOB +/// typedef struct tdTPM_DELEGATE_OWNER_BLOB { TPM_STRUCTURE_TAG tag; TPM_DELEGATE_PUBLIC pub; @@ -1651,9 +1892,9 @@ typedef struct tdTPM_DELEGATE_OWNER_BLOB { UINT8 *sensitiveArea; } TPM_DELEGATE_OWNER_BLOB; -// -// Part 2, section 20.13: TTPM_DELEGATE_KEY_BLOB -// +/// +/// Part 2, section 20.13: TTPM_DELEGATE_KEY_BLOB +/// typedef struct tdTPM_DELEGATE_KEY_BLOB { TPM_STRUCTURE_TAG tag; TPM_DELEGATE_PUBLIC pub; @@ -1734,9 +1975,19 @@ typedef struct tdTPM_DELEGATE_KEY_BLOB { #define TPM_CAP_PROP_INPUT_BUFFER ((TPM_CAPABILITY_AREA) 0x00000124) // -// Part 2, section 21.6: TPM_CAP_VERSION_INFO -// [size_is(vendorSpecificSize)] BYTE* vendorSpecific; +// Part 2, section 21.4: TPM_CAPABILITY_AREA for SetCapability // +#define TPM_SET_PERM_FLAGS ((TPM_CAPABILITY_AREA) 0x00000001) +#define TPM_SET_PERM_DATA ((TPM_CAPABILITY_AREA) 0x00000002) +#define TPM_SET_STCLEAR_FLAGS ((TPM_CAPABILITY_AREA) 0x00000003) +#define TPM_SET_STCLEAR_DATA ((TPM_CAPABILITY_AREA) 0x00000004) +#define TPM_SET_STANY_FLAGS ((TPM_CAPABILITY_AREA) 0x00000005) +#define TPM_SET_STANY_DATA ((TPM_CAPABILITY_AREA) 0x00000006) + +/// +/// Part 2, section 21.6: TPM_CAP_VERSION_INFO +/// [size_is(vendorSpecificSize)] BYTE* vendorSpecific; +/// typedef struct tdTPM_CAP_VERSION_INFO { TPM_STRUCTURE_TAG tag; TPM_VERSION version; @@ -1747,6 +1998,50 @@ typedef struct tdTPM_CAP_VERSION_INFO { UINT8 *vendorSpecific; } TPM_CAP_VERSION_INFO; +/// +/// Part 2, section 21.10: TPM_DA_ACTION_TYPE +/// +typedef struct tdTPM_DA_ACTION_TYPE { + TPM_STRUCTURE_TAG tag; + UINT32 actions; +} TPM_DA_ACTION_TYPE; + +#define TPM_DA_ACTION_FAILURE_MODE (((UINT32)1)<<3) +#define TPM_DA_ACTION_DEACTIVATE (((UINT32)1)<<2) +#define TPM_DA_ACTION_DISABLE (((UINT32)1)<<1) +#define TPM_DA_ACTION_TIMEOUT (((UINT32)1)<<0) + +/// +/// Part 2, section 21.7: TPM_DA_INFO +/// +typedef struct tdTPM_DA_INFO { + TPM_STRUCTURE_TAG tag; + TPM_DA_STATE state; + UINT16 currentCount; + UINT16 thresholdCount; + TPM_DA_ACTION_TYPE actionAtThreshold; + UINT32 actionDependValue; + UINT32 vendorDataSize; + UINT8 *vendorData; +} TPM_DA_INFO; + +/// +/// Part 2, section 21.8: TPM_DA_INFO_LIMITED +/// +typedef struct tdTPM_DA_INFO_LIMITED { + TPM_STRUCTURE_TAG tag; + TPM_DA_STATE state; + TPM_DA_ACTION_TYPE actionAtThreshold; + UINT32 vendorDataSize; + UINT8 *vendorData; +} TPM_DA_INFO_LIMITED; + +// +// Part 2, section 21.9: CAP_PROPERTY Subcap values for GetCapability +// +#define TPM_DA_STATE_INACTIVE ((UINT8)0x00) +#define TPM_DA_STATE_ACTIVE ((UINT8)0x01) + // // Part 2, section 22: DAA Structures // @@ -1771,9 +2066,9 @@ typedef struct tdTPM_CAP_VERSION_INFO { #define TPM_DAA_power0 (104) #define TPM_DAA_power1 (1024) -// -// Part 2, section 22.3: TPM_DAA_ISSUER -// +/// +/// Part 2, section 22.3: TPM_DAA_ISSUER +/// typedef struct tdTPM_DAA_ISSUER { TPM_STRUCTURE_TAG tag; TPM_DIGEST DAA_digest_R0; @@ -1785,9 +2080,9 @@ typedef struct tdTPM_DAA_ISSUER { UINT8 DAA_generic_q[26]; } TPM_DAA_ISSUER; -// -// Part 2, section 22.4: TPM_DAA_TPM -// +/// +/// Part 2, section 22.4: TPM_DAA_TPM +/// typedef struct tdTPM_DAA_TPM { TPM_STRUCTURE_TAG tag; TPM_DIGEST DAA_digestIssuer; @@ -1797,9 +2092,9 @@ typedef struct tdTPM_DAA_TPM { UINT32 DAA_count; } TPM_DAA_TPM; -// -// Part 2, section 22.5: TPM_DAA_CONTEXT -// +/// +/// Part 2, section 22.5: TPM_DAA_CONTEXT +/// typedef struct tdTPM_DAA_CONTEXT { TPM_STRUCTURE_TAG tag; TPM_DIGEST DAA_digestContext; @@ -1809,18 +2104,18 @@ typedef struct tdTPM_DAA_CONTEXT { UINT8 DAA_stage; } TPM_DAA_CONTEXT; -// -// Part 2, section 22.6: TPM_DAA_JOINDATA -// +/// +/// Part 2, section 22.6: TPM_DAA_JOINDATA +/// typedef struct tdTPM_DAA_JOINDATA { UINT8 DAA_join_u0[128]; UINT8 DAA_join_u1[138]; TPM_DIGEST DAA_digest_n0; } TPM_DAA_JOINDATA; -// -// Part 2, section 22.8: TPM_DAA_BLOB -// +/// +/// Part 2, section 22.8: TPM_DAA_BLOB +/// typedef struct tdTPM_DAA_BLOB { TPM_STRUCTURE_TAG tag; TPM_RESOURCE_TYPE resourceType; @@ -1832,9 +2127,9 @@ typedef struct tdTPM_DAA_BLOB { UINT8 *sensitiveData; } TPM_DAA_BLOB; -// -// Part 2, section 22.9: TPM_DAA_SENSITIVE -// +/// +/// Part 2, section 22.9: TPM_DAA_SENSITIVE +/// typedef struct tdTPM_DAA_SENSITIVE { TPM_STRUCTURE_TAG tag; UINT32 internalSize; @@ -1846,24 +2141,27 @@ typedef struct tdTPM_DAA_SENSITIVE { // Part 2, section 23: Redirection // -// -// Part 2 section 23.1: TPM_REDIR_COMMAND -// This section defines exactly one value but does not -// give it a name. The definition of TPM_SetRedirection in Part3 -// refers to exactly one name but does not give its value. We join -// them here. -// +/// +/// Part 2 section 23.1: TPM_REDIR_COMMAND +/// This section defines exactly one value but does not +/// give it a name. The definition of TPM_SetRedirection in Part3 +/// refers to exactly one name but does not give its value. We join +/// them here. +/// #define TPM_REDIR_GPIO (0x00000001) -// -// TPM Command & Response Headers defined in Part 3 -// +/// +/// TPM Command Headers defined in Part 3 +/// typedef struct tdTPM_RQU_COMMAND_HDR { TPM_STRUCTURE_TAG tag; UINT32 paramSize; TPM_COMMAND_CODE ordinal; } TPM_RQU_COMMAND_HDR; +/// +/// TPM Response Headers defined in Part 3 +/// typedef struct tdTPM_RSP_COMMAND_HDR { TPM_STRUCTURE_TAG tag; UINT32 paramSize;