Tpm12.h revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
/** @file
TPM Specification data structures (TCG TPM Specification Version 1.2 Revision 103)
See http://trustedcomputinggroup.org for latest specification updates
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
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
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef _TPM12_H_
#define _TPM12_H_
///
/// The start of TPM return codes
///
#define TPM_BASE 0
//
// 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
///
///
/// 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;
//
// Part 2, section 2.2.4: Vendor specific
// The following defines allow for the quick specification of a
// vendor specific item.
//
//
// Part 2, section 3.1: TPM_STRUCTURE_TAG
//
//
// Part 2, section 4: TPM Types
//
//
// Part 2, section 4.1: TPM_RESOURCE_TYPE
//
#define TPM_RT_KEY ((TPM_RESOURCE_TYPE) 0x00000001) ///< The handle is a key handle and is the result of a LoadKey type operation
#define TPM_RT_AUTH ((TPM_RESOURCE_TYPE) 0x00000002) ///< The handle is an authorization handle. Auth handles come from TPM_OIAP, TPM_OSAP and TPM_DSAP
#define TPM_RT_TRANS ((TPM_RESOURCE_TYPE) 0x00000004) ///< The handle is for a transport session. Transport handles come from TPM_EstablishTransport
#define TPM_RT_CONTEXT ((TPM_RESOURCE_TYPE) 0x00000005) ///< Resource wrapped and held outside the TPM using the context save/restore commands
#define TPM_RT_DELEGATE ((TPM_RESOURCE_TYPE) 0x00000007) ///< The handle is for a delegate row. These are the internal rows held in NV storage by the TPM
//
// Part 2, section 4.2: TPM_PAYLOAD_TYPE
//
#define TPM_PT_MIGRATE_RESTRICTED ((TPM_PAYLOAD_TYPE) 0x06) ///< The entity is a restricted-migration asymmetric key
#define TPM_PT_MIGRATE_EXTERNAL ((TPM_PAYLOAD_TYPE) 0x07) ///< The entity is a external migratable key
//
// Part 2, section 4.3: TPM_ENTITY_TYPE
//
#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
//
//
// Part 2, section 4.4.1: Reserved Key Handles
//
#define TPM_KH_TRANSPORT ((TPM_KEY_HANDLE) 0x40000003) ///< The handle points to the EstablishTransport static authorization
#define TPM_KH_ADMIN ((TPM_KEY_HANDLE) 0x40000005) ///< The handle points to the delegation administration auth
#define TPM_KH_EK ((TPM_KEY_HANDLE) 0x40000006) ///< The handle points to the PUBEK, only usable with TPM_OwnerReadInternalPub
//
// Part 2, section 4.5: TPM_STARTUP_TYPE
//
#define TPM_ST_DEACTIVATED ((TPM_STARTUP_TYPE) 0x0003) ///< The TPM is to startup and set the deactivated flag to TRUE
//
// Part 2, section 4.6: TPM_STATUP_EFFECTS
// The table makeup is still an open issue.
//
//
// Part 2, section 4.7: TPM_PROTOCOL_ID
//
//
// Part 2, section 4.8: TPM_ALGORITHM_ID
// The TPM MUST support the algorithms TPM_ALG_RSA, TPM_ALG_SHA, TPM_ALG_HMAC,
// TPM_ALG_MGF1
//
#define TPM_ALG_MGF1 ((TPM_ALGORITHM_ID) 0x00000007) ///< The XOR algorithm using MGF1 to create a string the size of the encrypted block
//
// Part 2, section 4.9: TPM_PHYSICAL_PRESENCE
//
#define TPM_PHYSICAL_PRESENCE_HW_DISABLE ((TPM_PHYSICAL_PRESENCE) 0x0200) ///< Sets the physicalPresenceHWEnable to FALSE
#define TPM_PHYSICAL_PRESENCE_CMD_DISABLE ((TPM_PHYSICAL_PRESENCE) 0x0100) ///< Sets the physicalPresenceCMDEnable to FALSE
#define TPM_PHYSICAL_PRESENCE_LIFETIME_LOCK ((TPM_PHYSICAL_PRESENCE) 0x0080) ///< Sets the physicalPresenceLifetimeLock to TRUE
#define TPM_PHYSICAL_PRESENCE_HW_ENABLE ((TPM_PHYSICAL_PRESENCE) 0x0040) ///< Sets the physicalPresenceHWEnable to TRUE
#define TPM_PHYSICAL_PRESENCE_CMD_ENABLE ((TPM_PHYSICAL_PRESENCE) 0x0020) ///< Sets the physicalPresenceCMDEnable to TRUE
#define TPM_PHYSICAL_PRESENCE_NOTPRESENT ((TPM_PHYSICAL_PRESENCE) 0x0010) ///< Sets PhysicalPresence = FALSE
#define TPM_PHYSICAL_PRESENCE_PRESENT ((TPM_PHYSICAL_PRESENCE) 0x0008) ///< Sets PhysicalPresence = TRUE
#define TPM_PHYSICAL_PRESENCE_LOCK ((TPM_PHYSICAL_PRESENCE) 0x0004) ///< Sets PhysicalPresenceLock = TRUE
//
// Part 2, section 4.10: TPM_MIGRATE_SCHEME
//
#define TPM_MS_MIGRATE ((TPM_MIGRATE_SCHEME) 0x0001) ///< A public key that can be used with all TPM migration commands other than 'ReWrap' mode.
#define TPM_MS_REWRAP ((TPM_MIGRATE_SCHEME) 0x0002) ///< A public key that can be used for the ReWrap mode of TPM_CreateMigrationBlob.
#define TPM_MS_MAINT ((TPM_MIGRATE_SCHEME) 0x0003) ///< A public key that can be used for the Maintenance commands
#define TPM_MS_RESTRICT_MIGRATE ((TPM_MIGRATE_SCHEME) 0x0004) ///< The key is to be migrated to a Migration Authority.
#define TPM_MS_RESTRICT_APPROVE_DOUBLE ((TPM_MIGRATE_SCHEME) 0x0005) ///< The key is to be migrated to an entity approved by a Migration Authority using double wrapping
//
// Part 2, section 4.11: TPM_EK_TYPE
//
//
// Part 2, section 4.12: TPM_PLATFORM_SPECIFIC
//
//
// Part 2, section 5: Basic Structures
//
///
/// Part 2, section 5.1: TPM_STRUCT_VER
///
typedef struct tdTPM_STRUCT_VER {
///
/// Part 2, section 5.3: TPM_VERSION
///
typedef struct tdTPM_VERSION {
} TPM_VERSION;
#define TPM_SHA1_160_HASH_LEN 0x14
///
/// Part 2, section 5.4: TPM_DIGEST
///
typedef struct tdTPM_DIGEST{
} 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;
///
/// Part 2, section 5.5: TPM_NONCE
///
typedef struct tdTPM_NONCE{
} 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 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)
///
typedef struct tdTPM_KEY_HANDLE_LIST {
//
// Part 2, section 5.8: TPM_KEY_USAGE values
//
///
/// TPM_KEY_SIGNING SHALL indicate a signing key. The [private] key SHALL be
/// used for signing operations, only. This means that it MUST be a leaf of the
/// Protected Storage key hierarchy.
///
///
/// TPM_KEY_STORAGE SHALL indicate a storage key. The key SHALL be used to wrap
/// and unwrap other keys in the Protected Storage hierarchy
///
///
/// TPM_KEY_IDENTITY SHALL indicate an identity key. The key SHALL be used for
/// operations that require a TPM identity, only.
///
///
/// TPM_KEY_AUTHCHANGE SHALL indicate an ephemeral key that is in use during
/// the ChangeAuthAsym process, only.
///
///
/// TPM_KEY_BIND SHALL indicate a key that can be used for TPM_Bind and
/// TPM_Unbind operations only.
///
///
/// TPM_KEY_LEGACY SHALL indicate a key that can perform signing and binding
/// operations. The key MAY be used for both signing and binding operations.
/// The TPM_KEY_LEGACY key type is to allow for use by applications where both
/// signing and encryption operations occur with the same key. The use of this
/// key type is not recommended TPM_KEY_MIGRATE 0x0016 This SHALL indicate a
/// key in use for TPM_MigrateKey
///
///
/// TPM_KEY_MIGRAGE SHALL indicate a key in use for TPM_MigrateKey
///
//
// Part 2, section 5.8.1: Mandatory Key Usage Schemes
//
//
// Part 2, section 5.9: TPM_AUTH_DATA_USAGE values
//
///
/// Part 2, section 5.10: TPM_KEY_FLAGS
///
typedef enum tdTPM_KEY_FLAGS {
redirection = 0x00000001,
migratable = 0x00000002,
isVolatile = 0x00000004,
pcrIgnoredOnRead = 0x00000008,
migrateAuthority = 0x00000010
///
/// Part 2, section 5.11: TPM_CHANGEAUTH_VALIDATE
///
typedef struct tdTPM_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;
///
typedef struct tdTPM_KEY_PARMS {
///
/// Part 2, section 10.4: TPM_STORE_PUBKEY
///
typedef struct tdTPM_STORE_PUBKEY {
///
/// Part 2, section 10.5: TPM_PUBKEY
///
typedef struct tdTPM_PUBKEY{
} TPM_PUBKEY;
///
/// Part 2, section 5.12: TPM_MIGRATIONKEYAUTH
///
typedef struct tdTPM_MIGRATIONKEYAUTH{
///
/// Part 2, section 5.13: TPM_COUNTER_VALUE
///
typedef struct tdTPM_COUNTER_VALUE{
///
/// Part 2, section 5.14: TPM_SIGN_INFO
/// Size of data indicated by dataLen
///
typedef struct tdTPM_SIGN_INFO {
///
/// Part 2, section 5.15: TPM_MSA_COMPOSITE
/// Number of migAuthDigest indicated by MSAlist
///
typedef struct tdTPM_MSA_COMPOSITE {
///
/// Part 2, section 5.16: TPM_CMK_AUTH
///
typedef struct tdTPM_CMK_AUTH{
} TPM_CMK_AUTH;
//
// Part 2, section 5.17: TPM_CMK_DELEGATE
//
///
/// Part 2, section 5.18: TPM_SELECT_SIZE
///
typedef struct tdTPM_SELECT_SIZE {
///
/// Part 2, section 5,19: TPM_CMK_MIGAUTH
///
typedef struct tdTPM_CMK_MIGAUTH{
///
/// Part 2, section 5.20: TPM_CMK_SIGTICKET
///
typedef struct tdTPM_CMK_SIGTICKET{
///
/// Part 2, section 5.21: TPM_CMK_MA_APPROVAL
///
typedef struct tdTPM_CMK_MA_APPROVAL{
//
// Part 2, section 6: Command Tags
//
///
/// Part 2, section 7.1: TPM_PERMANENT_FLAGS
///
typedef struct tdTPM_PERMANENT_FLAGS{
//
// Part 2, section 7.1.1: Flag Restrictions (of TPM_PERMANENT_FLAGS)
//
///
/// Part 2, section 7.2: TPM_STCLEAR_FLAGS
///
typedef struct tdTPM_STCLEAR_FLAGS{
//
// Part 2, section 7.2.1: Flag Restrictions (of TPM_STCLEAR_FLAGS)
//
///
/// Part 2, section 7.3: TPM_STANY_FLAGS
///
typedef struct tdTPM_STANY_FLAGS{
//
// Part 2, section 7.3.1: Flag Restrictions (of TPM_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_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
//
///
/// Part 2, section 7.5: TPM_STCLEAR_DATA
/// available inside TPM only
///
typedef struct tdTPM_STCLEAR_DATA{
//
// Part 2, section 7.5.1: STCLEAR_DATA Subcap for SetCapability
//
//
// Part 2, section 7.6.1: STANY_DATA Subcap for SetCapability
//
//
// 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 {
///
/// Part 2, section 8.2: TPM_PCR_COMPOSITE
/// Size of pcrValue[] indicated by valueSize
///
typedef struct tdTPM_PCR_COMPOSITE {
///
/// Part 2, section 8.3: TPM_PCR_INFO
///
typedef struct tdTPM_PCR_INFO {
} TPM_PCR_INFO;
///
/// Part 2, section 8.6: TPM_LOCALITY_SELECTION
///
typedef UINT8 TPM_LOCALITY_SELECTION;
///
/// Part 2, section 8.4: TPM_PCR_INFO_LONG
///
typedef struct tdTPM_PCR_INFO_LONG {
///
/// Part 2, section 8.5: TPM_PCR_INFO_SHORT
///
typedef struct tdTPM_PCR_INFO_SHORT{
///
/// Part 2, section 8.8: TPM_PCR_ATTRIBUTES
///
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;
///
typedef struct tdTPM_STORED_DATA {
///
/// Part 2, section 9.2: TPM_STORED_DATA12
/// [size_is(sealInfoSize)] BYTE* sealInfo;
/// [size_is(encDataSize)] BYTE* encData;
///
typedef struct tdTPM_STORED_DATA12 {
///
/// Part 2, section 9.3: TPM_SEALED_DATA
/// [size_is(dataSize)] BYTE* data;
///
typedef struct tdTPM_SEALED_DATA {
///
/// Part 2, section 9.4: TPM_SYMMETRIC_KEY
/// [size_is(size)] BYTE* data;
///
typedef struct tdTPM_SYMMETRIC_KEY {
///
/// Part 2, section 9.5: TPM_BOUND_DATA
///
typedef struct tdTPM_BOUND_DATA {
//
// Part 2 section 10: TPM_KEY complex
//
//
// Section 10.1, 10.4, and 10.5 have been defined previously
//
///
/// Part 2, section 10.2: TPM_KEY
/// [size_is(encDataSize)] BYTE* encData;
///
typedef struct tdTPM_KEY{
} TPM_KEY;
///
/// Part 2, section 10.3: TPM_KEY12
/// [size_is(encDataSize)] BYTE* encData;
///
typedef struct tdTPM_KEY12{
} TPM_KEY12;
///
/// Part 2, section 10.7: TPM_STORE_PRIVKEY
/// [size_is(keyLength)] BYTE* key;
///
typedef struct tdTPM_STORE_PRIVKEY {
///
/// Part 2, section 10.6: TPM_STORE_ASYMKEY
///
typedef struct tdTPM_STORE_ASYMKEY { // pos len total
///
/// Part 2, section 10.8: TPM_MIGRATE_ASYMKEY
/// [size_is(partPrivKeyLen)] BYTE* partPrivKey;
///
typedef struct tdTPM_MIGRATE_ASYMKEY { // pos len total
///
/// Part 2, section 10.9: TPM_KEY_CONTROL
///
//
// Part 2, section 11: Signed Structures
//
///
/// Part 2, section 11.1: TPM_CERTIFY_INFO Structure
///
typedef struct tdTPM_CERTIFY_INFO {
///
/// Part 2, section 11.2: TPM_CERTIFY_INFO2 Structure
///
typedef struct tdTPM_CERTIFY_INFO2 {
///
/// Part 2, section 11.3 TPM_QUOTE_INFO Structure
///
typedef struct tdTPM_QUOTE_INFO {
///
/// Part 2, section 11.4 TPM_QUOTE_INFO2 Structure
///
typedef struct tdTPM_QUOTE_INFO2 {
//
// Part 2, section 12: Identity Structures
//
///
/// Part 2, section 12.1 TPM_EK_BLOB
///
typedef struct tdTPM_EK_BLOB {
} TPM_EK_BLOB;
///
/// Part 2, section 12.2 TPM_EK_BLOB_ACTIVATE
///
typedef struct tdTPM_EK_BLOB_ACTIVATE {
///
/// Part 2, section 12.3 TPM_EK_BLOB_AUTH
///
typedef struct tdTPM_EK_BLOB_AUTH {
///
/// Part 2, section 12.5 TPM_IDENTITY_CONTENTS
///
typedef struct tdTPM_IDENTITY_CONTENTS {
///
/// Part 2, section 12.6 TPM_IDENTITY_REQ
///
typedef struct tdTPM_IDENTITY_REQ {
///
/// Part 2, section 12.7 TPM_IDENTITY_PROOF
///
typedef struct tdTPM_IDENTITY_PROOF {
///
/// Part 2, section 12.8 TPM_ASYM_CA_CONTENTS
///
typedef struct tdTPM_ASYM_CA_CONTENTS {
///
/// Part 2, section 12.9 TPM_SYM_CA_ATTESTATION
///
typedef struct tdTPM_SYM_CA_ATTESTATION {
///
/// Part 2, section 15: Tick Structures
/// Placed here out of order because definitions are used in section 13.
///
typedef struct tdTPM_CURRENT_TICKS {
///
/// Part 2, section 13: Transport structures
///
///
/// Part 2, section 13.1: TPM _TRANSPORT_PUBLIC
///
typedef struct tdTPM_TRANSPORT_PUBLIC {
//
// Part 2, section 13.1.1 TPM_TRANSPORT_ATTRIBUTES Definitions
//
///
/// Part 2, section 13.2 TPM_TRANSPORT_INTERNAL
///
typedef struct tdTPM_TRANSPORT_INTERNAL {
///
/// Part 2, section 13.3 TPM_TRANSPORT_LOG_IN structure
///
typedef struct tdTPM_TRANSPORT_LOG_IN {
///
/// Part 2, section 13.4 TPM_TRANSPORT_LOG_OUT structure
///
typedef struct tdTPM_TRANSPORT_LOG_OUT {
///
/// Part 2, section 13.5 TPM_TRANSPORT_AUTH structure
///
typedef struct tdTPM_TRANSPORT_AUTH {
//
// Part 2, section 14: Audit Structures
//
///
/// Part 2, section 14.1 TPM_AUDIT_EVENT_IN structure
///
typedef struct tdTPM_AUDIT_EVENT_IN {
///
/// Part 2, section 14.2 TPM_AUDIT_EVENT_OUT structure
///
typedef struct tdTPM_AUDIT_EVENT_OUT {
//
// Part 2, section 16: Return Codes
//
#define TPM_NON_FATAL 0x00000800
//
// Part 2, section 17: Ordinals
//
// Ordinals are 32 bit values. The upper byte contains values that serve as
// flag indicators, the next byte contains values indicating what committee
// designated the ordinal, and the final two bytes contain the Command
// Ordinal Index.
// 3 2 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// |P|C|V| Reserved| Purview | Command Ordinal Index |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
//
// Where:
//
// * P is Protected/Unprotected command. When 0 the command is a Protected
// command, when 1 the command is an Unprotected command.
//
// * C is Non-Connection/Connection related command. When 0 this command
// passes through to either the protected (TPM) or unprotected (TSS)
// components.
//
// command is vendor defined.
//
// * All reserved area bits are set to 0.
//
//
// Part 2, section 18: Context structures
//
///
/// Part 2, section 18.1: TPM_CONTEXT_BLOB
///
typedef struct tdTPM_CONTEXT_BLOB {
///
/// Part 2, section 18.2 TPM_CONTEXT_SENSITIVE
///
typedef struct tdTPM_CONTEXT_SENSITIVE {
//
// Part 2, section 19: NV Structures
//
//
// Part 2, section 19.1.1: Required TPM_NV_INDEX values
//
//
// Part 2, section 19.1.2: Reserved Index values
//
///
/// Part 2, section 19.2: TPM_NV_ATTRIBUTES
///
typedef struct tdTPM_NV_ATTRIBUTES {
#define TPM_NV_PER_READ_STCLEAR (BIT31)
#define TPM_NV_PER_AUTHREAD (BIT18)
#define TPM_NV_PER_OWNERREAD (BIT17)
#define TPM_NV_PER_PPREAD (BIT16)
#define TPM_NV_PER_GLOBALLOCK (BIT15)
#define TPM_NV_PER_WRITE_STCLEAR (BIT14)
#define TPM_NV_PER_WRITEDEFINE (BIT13)
#define TPM_NV_PER_WRITEALL (BIT12)
#define TPM_NV_PER_AUTHWRITE (BIT2)
#define TPM_NV_PER_OWNERWRITE (BIT1)
#define TPM_NV_PER_PPWRITE (BIT0)
///
/// Part 2, section 19.3: TPM_NV_DATA_PUBLIC
///
typedef struct tdTPM_NV_DATA_PUBLIC {
//
// Part 2, section 20: Delegate Structures
//
///
/// Part 2, section 20.2: Delegate Definitions
///
typedef struct tdTPM_DELEGATIONS {
//
// Part 2, section 20.2.1: Owner Permission Settings
//
#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_DAA_Join (BIT23)
#define TPM_DELEGATE_AuthorizeMigrationKey (BIT22)
#define TPM_DELEGATE_CreateMaintenanceArchive (BIT21)
#define TPM_DELEGATE_LoadMaintenanceArchive (BIT20)
#define TPM_DELEGATE_KillMaintenanceFeature (BIT19)
#define TPM_DELEGATE_OwnerReadInteralPub (BIT18)
#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)
#define TPM_DELEGATE_ActivateIdentity (BIT10)
#define TPM_DELEGATE_OwnerReadPubek (BIT9)
#define TPM_DELEGATE_DisablePubekRead (BIT8)
#define TPM_DELEGATE_SetRedirection (BIT7)
#define TPM_DELEGATE_FieldUpgrade (BIT6)
#define TPM_DELEGATE_Delegate_UpdateVerification (BIT5)
#define TPM_DELEGATE_CreateCounter (BIT4)
#define TPM_DELEGATE_ReleaseCounterOwner (BIT3)
#define TPM_DELEGATE_DelegateManage (BIT2)
#define TPM_DELEGATE_DAA_Sign (BIT0)
//
// Part 2, section 20.2.3: Key Permission settings
//
#define TPM_KEY_DELEGATE_CMK_ConvertMigration (BIT28)
#define TPM_KEY_DELEGATE_TickStampBlob (BIT27)
#define TPM_KEY_DELEGATE_ChangeAuthAsymStart (BIT26)
#define TPM_KEY_DELEGATE_ChangeAuthAsymFinish (BIT25)
#define TPM_KEY_DELEGATE_CMK_CreateKey (BIT24)
#define TPM_KEY_DELEGATE_MigrateKey (BIT23)
#define TPM_KEY_DELEGATE_LoadKey2 (BIT22)
#define TPM_KEY_DELEGATE_EstablishTransport (BIT21)
#define TPM_KEY_DELEGATE_ReleaseTransportSigned (BIT20)
#define TPM_KEY_DELEGATE_Quote2 (BIT19)
#define TPM_KEY_DELEGATE_Sealx (BIT18)
#define TPM_KEY_DELEGATE_MakeIdentity (BIT17)
#define TPM_KEY_DELEGATE_ActivateIdentity (BIT16)
#define TPM_KEY_DELEGATE_GetAuditDigestSigned (BIT15)
#define TPM_KEY_DELEGATE_Sign (BIT14)
#define TPM_KEY_DELEGATE_CertifyKey2 (BIT13)
#define TPM_KEY_DELEGATE_CertifyKey (BIT12)
#define TPM_KEY_DELEGATE_CreateWrapKey (BIT11)
#define TPM_KEY_DELEGATE_CMK_CreateBlob (BIT10)
#define TPM_KEY_DELEGATE_CreateMigrationBlob (BIT9)
#define TPM_KEY_DELEGATE_ConvertMigrationBlob (BIT8)
#define TPM_KEY_DELEGATE_CreateKeyDelegation (BIT7)
#define TPM_KEY_DELEGATE_ChangeAuth (BIT6)
#define TPM_KEY_DELEGATE_GetPubKey (BIT5)
#define TPM_KEY_DELEGATE_UnBind (BIT4)
#define TPM_KEY_DELEGATE_Quote (BIT3)
#define TPM_KEY_DELEGATE_Unseal (BIT2)
#define TPM_KEY_DELEGATE_Seal (BIT1)
#define TPM_KEY_DELEGATE_LoadKey (BIT0)
//
// Part 2, section 20.3: TPM_FAMILY_FLAGS
//
#define TPM_DELEGATE_ADMIN_LOCK (BIT1)
#define TPM_FAMFLAG_ENABLE (BIT0)
///
/// Part 2, section 20.4: TPM_FAMILY_LABEL
///
typedef struct tdTPM_FAMILY_LABEL {
///
/// Part 2, section 20.5: TPM_FAMILY_TABLE_ENTRY
///
typedef struct tdTPM_FAMILY_TABLE_ENTRY {
//
// Part 2, section 20.6: TPM_FAMILY_TABLE
//
#define TPM_NUM_FAMILY_TABLE_ENTRY_MIN 8
typedef struct tdTPM_FAMILY_TABLE{
///
/// Part 2, section 20.7: TPM_DELEGATE_LABEL
///
typedef struct tdTPM_DELEGATE_LABEL {
///
/// Part 2, section 20.8: TPM_DELEGATE_PUBLIC
///
typedef struct tdTPM_DELEGATE_PUBLIC {
///
/// Part 2, section 20.9: TPM_DELEGATE_TABLE_ROW
///
typedef struct tdTPM_DELEGATE_TABLE_ROW {
//
// Part 2, section 20.10: TPM_DELEGATE_TABLE
//
#define TPM_NUM_DELEGATE_TABLE_ENTRY_MIN 2
typedef struct tdTPM_DELEGATE_TABLE{
///
/// Part 2, section 20.11: TPM_DELEGATE_SENSITIVE
///
typedef struct tdTPM_DELEGATE_SENSITIVE {
///
/// Part 2, section 20.12: TPM_DELEGATE_OWNER_BLOB
///
typedef struct tdTPM_DELEGATE_OWNER_BLOB {
///
/// Part 2, section 20.13: TTPM_DELEGATE_KEY_BLOB
///
typedef struct tdTPM_DELEGATE_KEY_BLOB {
//
// Part 2, section 20.14: TPM_FAMILY_OPERATION Values
//
//
// Part 2, section 21.1: TPM_CAPABILITY_AREA for GetCapability
//
//
// Part 2, section 21.2: CAP_PROPERTY Subcap values for GetCapability
//
//
// Part 2, section 21.4: TPM_CAPABILITY_AREA for SetCapability
//
///
/// Part 2, section 21.6: TPM_CAP_VERSION_INFO
/// [size_is(vendorSpecificSize)] BYTE* vendorSpecific;
///
typedef struct tdTPM_CAP_VERSION_INFO {
///
/// Part 2, section 21.10: TPM_DA_ACTION_TYPE
///
typedef struct tdTPM_DA_ACTION_TYPE {
///
/// Part 2, section 21.7: TPM_DA_INFO
///
typedef struct tdTPM_DA_INFO {
} TPM_DA_INFO;
///
/// Part 2, section 21.8: TPM_DA_INFO_LIMITED
///
typedef struct tdTPM_DA_INFO_LIMITED {
//
// Part 2, section 21.9: CAP_PROPERTY Subcap values for GetCapability
//
//
// Part 2, section 22: DAA Structures
//
//
// Part 2, section 22.1: Size definitions
//
#define TPM_DAA_SIZE_r0 (43)
#define TPM_DAA_SIZE_r1 (43)
#define TPM_DAA_SIZE_r2 (128)
#define TPM_DAA_SIZE_r3 (168)
#define TPM_DAA_SIZE_r4 (219)
#define TPM_DAA_SIZE_NT (20)
#define TPM_DAA_SIZE_v0 (128)
#define TPM_DAA_SIZE_v1 (192)
#define TPM_DAA_SIZE_NE (256)
#define TPM_DAA_SIZE_w (256)
#define TPM_DAA_SIZE_issuerModulus (256)
//
// Part 2, section 22.2: Constant definitions
//
#define TPM_DAA_power0 (104)
#define TPM_DAA_power1 (1024)
///
/// Part 2, section 22.3: TPM_DAA_ISSUER
///
typedef struct tdTPM_DAA_ISSUER {
///
/// Part 2, section 22.4: TPM_DAA_TPM
///
typedef struct tdTPM_DAA_TPM {
} TPM_DAA_TPM;
///
/// Part 2, section 22.5: TPM_DAA_CONTEXT
///
typedef struct tdTPM_DAA_CONTEXT {
///
/// Part 2, section 22.6: TPM_DAA_JOINDATA
///
typedef struct tdTPM_DAA_JOINDATA {
///
/// Part 2, section 22.8: TPM_DAA_BLOB
///
typedef struct tdTPM_DAA_BLOB {
} TPM_DAA_BLOB;
///
/// Part 2, section 22.9: TPM_DAA_SENSITIVE
///
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.
///
#define TPM_REDIR_GPIO (0x00000001)
///
/// TPM Command Headers defined in Part 3
///
typedef struct tdTPM_RQU_COMMAND_HDR {
///
/// TPM Response Headers defined in Part 3
///
typedef struct tdTPM_RSP_COMMAND_HDR {
#pragma pack ()
#endif