///\r
/// The start of TPM return codes\r
///\r
-#define TPM_BASE (EFI_MAX_BIT + (EFI_MAX_BIT >> 1))\r
+#define TPM_BASE (MAX_BIT + (MAX_BIT >> 1))\r
\r
//\r
// All structures MUST be packed on a byte boundary.\r
//\r
// Part 2, section 2.2.3: Helper redefinitions\r
//\r
+///\r
+/// Indicates the conditions where it is required that authorization be presented\r
+///\r
typedef UINT8 TPM_AUTH_DATA_USAGE;\r
+///\r
+/// The information as to what the payload is in an encrypted structure\r
+///\r
typedef UINT8 TPM_PAYLOAD_TYPE;\r
+///\r
+/// The version info breakdown\r
+///\r
typedef UINT8 TPM_VERSION_BYTE;\r
+///\r
+/// The request or response authorization type\r
+///\r
typedef UINT16 TPM_TAG;\r
+///\r
+/// The protocol in use\r
+///\r
typedef UINT16 TPM_PROTOCOL_ID;\r
+///\r
+/// Indicates the start state\r
+///\r
typedef UINT16 TPM_STARTUP_TYPE;\r
+///\r
+/// The definition of the encryption scheme\r
+///\r
typedef UINT16 TPM_ENC_SCHEME;\r
+///\r
+/// The definition of the signature scheme\r
+///\r
typedef UINT16 TPM_SIG_SCHEME;\r
+///\r
+/// The definition of the migration scheme\r
+///\r
typedef UINT16 TPM_MIGRATE_SCHEME;\r
+///\r
+/// Sets the state of the physical presence mechanism\r
+///\r
typedef UINT16 TPM_PHYSICAL_PRESENCE;\r
+///\r
+/// Indicates the types of entity that are supported by the TPM\r
+///\r
typedef UINT16 TPM_ENTITY_TYPE;\r
+///\r
+/// Indicates the permitted usage of the key\r
+///\r
typedef UINT16 TPM_KEY_USAGE;\r
+///\r
+/// The type of asymmetric encrypted structure in use by the endorsement key\r
+///\r
typedef UINT16 TPM_EK_TYPE;\r
+///\r
+/// The tag for the structure\r
+///\r
typedef UINT16 TPM_STRUCTURE_TAG;\r
+///\r
+/// The platform specific spec to which the information relates to\r
+///\r
typedef UINT16 TPM_PLATFORM_SPECIFIC;\r
+///\r
+/// The command ordinal\r
+///\r
typedef UINT32 TPM_COMMAND_CODE;\r
+///\r
+/// Identifies a TPM capability area\r
+///\r
typedef UINT32 TPM_CAPABILITY_AREA;\r
+///\r
+/// Indicates information regarding a key\r
+///\r
typedef UINT32 TPM_KEY_FLAGS;\r
+///\r
+/// Indicates the type of algorithm\r
+///\r
typedef UINT32 TPM_ALGORITHM_ID;\r
+///\r
+/// The locality modifier\r
+///\r
typedef UINT32 TPM_MODIFIER_INDICATOR;\r
+///\r
+/// The actual number of a counter\r
+///\r
typedef UINT32 TPM_ACTUAL_COUNT;\r
+///\r
+/// Attributes that define what options are in use for a transport session\r
+///\r
typedef UINT32 TPM_TRANSPORT_ATTRIBUTES;\r
+///\r
+/// Handle to an authorization session\r
+///\r
typedef UINT32 TPM_AUTHHANDLE;\r
+///\r
+/// Index to a DIR register\r
+///\r
typedef UINT32 TPM_DIRINDEX;\r
+///\r
+/// The area where a key is held assigned by the TPM\r
+///\r
typedef UINT32 TPM_KEY_HANDLE;\r
+///\r
+/// Index to a PCR register\r
+///\r
typedef UINT32 TPM_PCRINDEX;\r
+///\r
+/// The return code from a function\r
+///\r
typedef UINT32 TPM_RESULT;\r
+///\r
+/// The types of resources that a TPM may have using internal resources\r
+///\r
typedef UINT32 TPM_RESOURCE_TYPE;\r
+///\r
+/// Allows for controlling of the key when loaded and how to handle TPM_Startup issues\r
+///\r
typedef UINT32 TPM_KEY_CONTROL;\r
+///\r
+/// The index into the NV storage area\r
+///\r
typedef UINT32 TPM_NV_INDEX;\r
+///\r
+/// The family ID. Families ID's are automatically assigned a sequence number by the TPM. \r
+/// A trusted process can set the FamilyID value in an individual row to NULL, which \r
+/// invalidates that row. The family ID resets to NULL on each change of TPM Owner.\r
+///\r
typedef UINT32 TPM_FAMILY_ID;\r
+///\r
+/// IA value used as a label for the most recent verification of this family. Set to zero when not in use.\r
+///\r
typedef UINT32 TPM_FAMILY_VERIFICATION;\r
+///\r
+/// How the TPM handles var\r
+///\r
typedef UINT32 TPM_STARTUP_EFFECTS;\r
+///\r
+/// The mode of a symmetric encryption\r
+///\r
typedef UINT32 TPM_SYM_MODE;\r
+///\r
+/// The family flags\r
+///\r
typedef UINT32 TPM_FAMILY_FLAGS;\r
+///\r
+/// The index value for the delegate NV table\r
+///\r
typedef UINT32 TPM_DELEGATE_INDEX;\r
+///\r
+/// The restrictions placed on delegation of CMK commands\r
+///\r
typedef UINT32 TPM_CMK_DELEGATE;\r
+///\r
+/// The ID value of a monotonic counter\r
+///\r
typedef UINT32 TPM_COUNT_ID;\r
+///\r
+/// A command to execute\r
+///\r
typedef UINT32 TPM_REDIT_COMMAND;\r
+///\r
+/// A transport session handle\r
+///\r
typedef UINT32 TPM_TRANSHANDLE;\r
+///\r
+/// A generic handle could be key, transport etc\r
+///\r
typedef UINT32 TPM_HANDLE;\r
+///\r
+/// What operation is happening\r
+///\r
typedef UINT32 TPM_FAMILY_OPERATION;\r
\r
//\r
} TPM_VERSION;\r
\r
\r
+#define TPM_SHA1_160_HASH_LEN 0x14\r
+#define TPM_SHA1BASED_NONCE_LEN TPM_SHA1_160_HASH_LEN\r
+\r
///\r
/// Part 2, section 5.4: TPM_DIGEST\r
///\r
UINT8 digest[TPM_SHA1_160_HASH_LEN];\r
} TPM_DIGEST;\r
\r
-#define TPM_SHA1_160_HASH_LEN 0x14\r
-#define TPM_SHA1BASED_NONCE_LEN TPM_SHA1_160_HASH_LEN\r
-\r
+///\r
+/// This SHALL be the digest of the chosen identityLabel and privacyCA for a new TPM identity\r
+///\r
typedef TPM_DIGEST TPM_CHOSENID_HASH;\r
+///\r
+/// This SHALL be the hash of a list of PCR indexes and PCR values that a key or data is bound to\r
+///\r
typedef TPM_DIGEST TPM_COMPOSITE_HASH;\r
+///\r
+/// This SHALL be the value of a DIR register\r
+///\r
typedef TPM_DIGEST TPM_DIRVALUE;\r
+\r
typedef TPM_DIGEST TPM_HMAC;\r
+///\r
+/// The value inside of the PCR\r
+///\r
typedef TPM_DIGEST TPM_PCRVALUE;\r
+///\r
+/// This SHALL be the value of the current internal audit state\r
+///\r
typedef TPM_DIGEST TPM_AUDITDIGEST;\r
+///\r
+/// This SHALL be a random value generated by a TPM immediately after the EK is installed\r
+/// in that TPM, whenever an EK is installed in that TPM\r
+///\r
typedef TPM_DIGEST TPM_DAA_TPM_SEED;\r
+///\r
+/// This SHALL be a random value\r
+///\r
typedef TPM_DIGEST TPM_DAA_CONTEXT_SEED;\r
\r
///\r
//\r
// Part 2, section 5.6: TPM_AUTHDATA\r
//\r
+///\r
+/// The AuthData data is the information that is saved or passed to provide proof of ownership\r
+/// 296 of an entity\r
+///\r
typedef UINT8 tdTPM_AUTHDATA[20];\r
+\r
typedef tdTPM_AUTHDATA TPM_AUTHDATA;\r
+///\r
+/// A secret plaintext value used in the authorization process\r
+///\r
typedef TPM_AUTHDATA TPM_SECRET;\r
+///\r
+/// A ciphertext (encrypted) version of AuthData data. The encryption mechanism depends on the context\r
+///\r
typedef TPM_AUTHDATA TPM_ENCAUTH;\r
\r
///\r
//\r
// Part 2, section 13.1.1 TPM_TRANSPORT_ATTRIBUTES Definitions\r
//\r
-#define TPM_TRANSPORT_ENCRYPT ((UINT32)0x00000001)\r
-#define TPM_TRANSPORT_LOG ((UINT32)0x00000002)\r
-#define TPM_TRANSPORT_EXCLUSIVE ((UINT32)0x00000004)\r
+#define TPM_TRANSPORT_ENCRYPT ((UINT32)BIT0)\r
+#define TPM_TRANSPORT_LOG ((UINT32)BIT1)\r
+#define TPM_TRANSPORT_EXCLUSIVE ((UINT32)BIT2)\r
\r
///\r
/// Part 2, section 13.2 TPM_TRANSPORT_INTERNAL\r
// Part 2, section 20: Delegate Structures\r
//\r
\r
-//\r
-// Part 2, section 20.2: Delegate Definitions\r
-//\r
#define TPM_DEL_OWNER_BITS ((UINT32)0x00000001)\r
#define TPM_DEL_KEY_BITS ((UINT32)0x00000002)\r
-\r
+///\r
+/// Part 2, section 20.2: Delegate Definitions\r
+///\r
typedef struct tdTPM_DELEGATIONS {\r
TPM_STRUCTURE_TAG tag;\r
UINT32 delegateType;\r
#define TPM_REDIR_GPIO (0x00000001)\r
\r
///\r
-/// TPM Command & Response Headers defined in Part 3\r
+/// TPM Command Headers defined in Part 3\r
///\r
typedef struct tdTPM_RQU_COMMAND_HDR {\r
TPM_STRUCTURE_TAG tag;\r
TPM_COMMAND_CODE ordinal;\r
} TPM_RQU_COMMAND_HDR;\r
\r
+///\r
+/// TPM Response Headers defined in Part 3\r
+///\r
typedef struct tdTPM_RSP_COMMAND_HDR {\r
TPM_STRUCTURE_TAG tag;\r
UINT32 paramSize;\r