tpm12.h

来自「EFI BIOS是Intel提出的下一代的BIOS标准。这里上传的Edk源代码是」· C头文件 代码 · 共 1,398 行 · 第 1/5 页

H
1,398
字号
//
// Part 2, section 7.1: TPM_PERMANENT_FLAGS
//
typedef struct tdTPM_PERMANENT_FLAGS{
  TPM_STRUCTURE_TAG                 tag;
  BOOLEAN                           disable;
  BOOLEAN                           ownership;
  BOOLEAN                           deactivated;
  BOOLEAN                           readPubek;
  BOOLEAN                           disableOwnerClear;
  BOOLEAN                           allowMaintenance;
  BOOLEAN                           physicalPresenceLifetimeLock;
  BOOLEAN                           physicalPresenceHWEnable;
  BOOLEAN                           physicalPresenceCMDEnable;
  BOOLEAN                           CEKPUsed;
  BOOLEAN                           TPMpost;
  BOOLEAN                           TPMpostLock;
  BOOLEAN                           FIPS;
  BOOLEAN                           operator;
  BOOLEAN                           enableRevokeEK;
  BOOLEAN                           nvLocked;
  BOOLEAN                           readSRKPub;
  BOOLEAN                           tpmEstablished;
  BOOLEAN                           maintenanceDone;
} TPM_PERMANENT_FLAGS;

//
// Part 2, section 7.1.1: PERMANENT_FLAGS Subcap for SetCapability
//
#define TPM_PF_DISABLE                      ((TPM_CAPABILITY_AREA) 1)
#define TPM_PF_OWNERSHIP                    ((TPM_CAPABILITY_AREA) 2)
#define TPM_PF_DEACTIVATED                  ((TPM_CAPABILITY_AREA) 3)
#define TPM_PF_READPUBEK                    ((TPM_CAPABILITY_AREA) 4)
#define TPM_PF_DISABLEOWNERCLEAR            ((TPM_CAPABILITY_AREA) 5)
#define TPM_PF_ALLOWMAINTENANCE             ((TPM_CAPABILITY_AREA) 6)
#define TPM_PF_PHYSICALPRESENCELIFETIMELOCK ((TPM_CAPABILITY_AREA) 7)
#define TPM_PF_PHYSICALPRESENCEHWENABLE     ((TPM_CAPABILITY_AREA) 8)
#define TPM_PF_PHYSICALPRESENCECMDENABLE    ((TPM_CAPABILITY_AREA) 9)
#define TPM_PF_CEKPUSED                     ((TPM_CAPABILITY_AREA) 10)
#define TPM_PF_TPMPOST                      ((TPM_CAPABILITY_AREA) 11)
#define TPM_PF_TPMPOSTLOCK                  ((TPM_CAPABILITY_AREA) 12)
#define TPM_PF_FIPS                         ((TPM_CAPABILITY_AREA) 13)
#define TPM_PF_OPERATOR                     ((TPM_CAPABILITY_AREA) 14)
#define TPM_PF_ENABLEREVOKEEK               ((TPM_CAPABILITY_AREA) 15)
#define TPM_PF_NV_LOCKED                    ((TPM_CAPABILITY_AREA) 16)
#define TPM_PF_READSRKPUB                   ((TPM_CAPABILITY_AREA) 17)
#define TPM_PF_TPMESTABLISHED               ((TPM_CAPABILITY_AREA) 18)
#define TPM_PF_MAINTENANCEDONE              ((TPM_CAPABILITY_AREA) 19)

//
// Part 2, section 7.2: TPM_STCLEAR_FLAGS
//
typedef struct tdTPM_STCLEAR_FLAGS{
  TPM_STRUCTURE_TAG                 tag;
  BOOLEAN                           deactivated;
  BOOLEAN                           disableForceClear;
  BOOLEAN                           physicalPresence;
  BOOLEAN                           physicalPresenceLock;
  BOOLEAN                           bGlobalLock;
} TPM_STCLEAR_FLAGS;

//
// Part 2, section 7.2.1: STCLEAR_FLAGS Subcap for SetCapability
//
#define TPM_SF_DEACTIVATED          ((TPM_CAPABILITY_AREA) 1)
#define TPM_SF_DISABLEFORCECLEAR    ((TPM_CAPABILITY_AREA) 2)
#define TPM_SF_PHYSICALPRESENCE     ((TPM_CAPABILITY_AREA) 3)
#define TPM_SF_PHYSICALPRESENCELOCK ((TPM_CAPABILITY_AREA) 4)
#define TPM_SF_BGLOBALLOCK          ((TPM_CAPABILITY_AREA) 5)

//
// Part 2, section 7.3: TPM_STANY_FLAGS
//
typedef struct tdTPM_STANY_FLAGS{
  TPM_STRUCTURE_TAG                 tag;
  BOOLEAN                           postInitialise;
  TPM_MODIFIER_INDICATOR            localityModifier;
  BOOLEAN                           transportExclusive;
  BOOLEAN                           TOSPresent;
} TPM_STANY_FLAGS;

//
// Part 2, section 7.3.1: STANY_FLAGS Subcap for SetCapability
//
#define TPM_AF_POSTINITIALISE       ((TPM_CAPABILITY_AREA) 1)
#define TPM_AF_LOCALITYMODIFIER     ((TPM_CAPABILITY_AREA) 2)
#define TPM_AF_TRANSPORTEXCLUSIVE   ((TPM_CAPABILITY_AREA) 3)
#define TPM_AF_TOSPRESENT           ((TPM_CAPABILITY_AREA) 4)

//
// All those structures (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
//typedef struct tdTPM_PERMANENT_DATA
//{
//    TPM_STRUCTURE_TAG               tag;
//    UINT8                           revMajor;
//    UINT8                           revMinor;
//    TPM_NONCE                       tpmProof;
//    TPM_NONCE                       ekReset;
//    TPM_SECRET                      ownerAuth;
//    TPM_SECRET                      operatorAuth;
//    TPM_DIRVALUE                    authDIR[1];
//    TPM_PUBKEY                      manuMaintPub;
//    TPM_KEY                         endorsementKey;
//    TPM_KEY                         srk;
//    TPM_KEY                         contextKey;
//    TPM_KEY                         delegateKey;
//    TPM_COUNTER_VALUE               auditMonotonicCounter;
//    TPM_COUNTER_VALUE               monitonicCounter[TPM_MIN_COUNTERS];
//    TPM_PCR_ATTRIBUTES              pcrAttrib[TPM_NUM_PCR];
//    UINT8                           ordinalAuditStatus[];
//    UINT8                           *rngState;
//    TPM_FAMILY_TABLE                familyTable;
//    TPM_DELEGATE_TABLE              delegateTable;
//    UINT32                          maxNVBufSize;
//    UINT32                          lastFamilyID;
//    UINT32                          noOwnerNVWrite;
//    TPM_CMK_DELEGATE                restrictDelegate;
//    TPM_DAA_TPM_SEED                tpmDAASeed;
//} TPM_PERMANENT_DATA;

//
// 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_STCLEAR_DATA;

//
// Part 2, section 7.6: TPM_STANY_DATA
//   available inside TPM only
//
//typedef struct tdTPM_STANY_DATA
//{
//    TPM_STRUCTURE_TAG               tag;
//    TPM_NONCE                       contextNonceSession;
//    TPM_DIGEST                      auditDigest;
//    TPM_CURRENT_TICKS               currentTicks;
//    UINT32                          contextCount;
//    UINT32                          contextList[TPM_MIN_SESSION_LIST];
//    TPM_SESSION_DATA                sessions[TPM_MIN_SESSIONS];
//} TPM_STANY_DATA;

//
// 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
//
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
//
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
//
typedef UINT8                       TPM_LOCALITY_SELECTION;

#define TPM_LOC_FOUR                ((UINT8) 0x10)
#define TPM_LOC_THREE               ((UINT8) 0x08)
#define TPM_LOC_TWO                 ((UINT8) 0x04)
#define TPM_LOC_ONE                 ((UINT8) 0x02)
#define TPM_LOC_ZERO                ((UINT8) 0x01)

//
// Part 2, section 8.4: TPM_PCR_INFO_LONG
//
typedef struct tdTPM_PCR_INFO_LONG {
  TPM_STRUCTURE_TAG                 tag;
  TPM_LOCALITY_SELECTION            localityAtCreation;
  TPM_LOCALITY_SELECTION            localityAtRelease;
  TPM_PCR_SELECTION                 creationPCRSelection;
  TPM_PCR_SELECTION                 releasePCRSelection;
  TPM_COMPOSITE_HASH                digestAtCreation;
  TPM_COMPOSITE_HASH                digestAtRelease;
} TPM_PCR_INFO_LONG;

//
// 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
//
typedef struct tdTPM_PCR_ATTRIBUTES{
  BOOLEAN                           pcrReset;
  TPM_LOCALITY_SELECTION            pcrExtendLocal;
  TPM_LOCALITY_SELECTION            pcrResetLocal;
} TPM_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 {
  TPM_STRUCT_VER                    ver;
  UINT32                            sealInfoSize;
  UINT8                             *sealInfo;
  UINT32                            encDataSize;
  UINT8                             *encData;
} TPM_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 {
  TPM_STRUCTURE_TAG                 tag;
  TPM_ENTITY_TYPE                   et;
  UINT32                            sealInfoSize;
  UINT8                             *sealInfo;
  UINT32                            encDataSize;
  UINT8                             *encData;
} TPM_STORED_DATA12;

//
// 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;
  TPM_NONCE                         tpmProof;
  TPM_DIGEST                        storedDigest;
  UINT32                            dataSize;
  UINT8                             *data;
} TPM_SEALED_DATA;

//
// Part 2, section 9.4: TPM_SYMMETRIC_KEY
//   [size_is(size)] BYTE* data;
//
typedef struct tdTPM_SYMMETRIC_KEY {
  TPM_ALGORITHM_ID                  algId;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?