]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Include/Library/Tpm12CommandLib.h
SecurityPkg/TPM2: Extract GetSupportedAndActivePcrs to Tpm2CommandLib
[mirror_edk2.git] / SecurityPkg / Include / Library / Tpm12CommandLib.h
index 1dbc7d50c335d9d5669d72f185a2b0f9faa5a22a..f7c098f28341f6d52aaa7d0fb6c54076dbf0ebd7 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   This library is used by other modules to send TPM12 command.\r
 \r
-Copyright (c) 2013, Intel Corporation. All rights reserved. <BR>\r
+Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved. <BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -55,4 +55,171 @@ Tpm12ForceClear (
   VOID\r
   );\r
 \r
+#pragma pack(1)\r
+\r
+typedef struct {\r
+  UINT16                            sizeOfSelect;\r
+  UINT8                             pcrSelect[3];\r
+} TPM12_PCR_SELECTION;\r
+\r
+typedef struct {\r
+  TPM12_PCR_SELECTION               pcrSelection;\r
+  TPM_LOCALITY_SELECTION            localityAtRelease;\r
+  TPM_COMPOSITE_HASH                digestAtRelease;\r
+} TPM12_PCR_INFO_SHORT;\r
+\r
+typedef struct {\r
+  TPM_STRUCTURE_TAG               tag;\r
+  TPM_NV_INDEX                    nvIndex;\r
+  TPM12_PCR_INFO_SHORT            pcrInfoRead;\r
+  TPM12_PCR_INFO_SHORT            pcrInfoWrite;\r
+  TPM_NV_ATTRIBUTES               permission;\r
+  BOOLEAN                         bReadSTClear;\r
+  BOOLEAN                         bWriteSTClear;\r
+  BOOLEAN                         bWriteDefine;\r
+  UINT32                          dataSize;\r
+} TPM12_NV_DATA_PUBLIC;\r
+\r
+#pragma pack()\r
+\r
+/**\r
+  Send NV DefineSpace command to TPM1.2.\r
+  \r
+  @param PubInfo           The public parameters of the NV area.\r
+  @param EncAuth           The encrypted AuthData, only valid if the attributes require subsequent authorization.\r
+\r
+  @retval EFI_SUCCESS      Operation completed successfully.\r
+  @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tpm12NvDefineSpace (\r
+  IN TPM12_NV_DATA_PUBLIC  *PubInfo,\r
+  IN TPM_ENCAUTH           *EncAuth\r
+  );\r
+\r
+/**\r
+  Send NV ReadValue command to TPM1.2.\r
+  \r
+  @param NvIndex           The index of the area to set.\r
+  @param Offset            The offset into the area.\r
+  @param DataSize          The size of the data area.\r
+  @param Data              The data to set the area to.\r
+\r
+  @retval EFI_SUCCESS      Operation completed successfully.\r
+  @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tpm12NvReadValue (\r
+  IN TPM_NV_INDEX   NvIndex,\r
+  IN UINT32         Offset,\r
+  IN OUT UINT32     *DataSize,\r
+  OUT UINT8         *Data\r
+  );\r
+\r
+/**\r
+  Send NV WriteValue command to TPM1.2.\r
+  \r
+  @param NvIndex           The index of the area to set.\r
+  @param Offset            The offset into the NV Area.\r
+  @param DataSize          The size of the data parameter.\r
+  @param Data              The data to set the area to.\r
+\r
+  @retval EFI_SUCCESS      Operation completed successfully.\r
+  @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tpm12NvWriteValue (\r
+  IN TPM_NV_INDEX   NvIndex,\r
+  IN UINT32         Offset,\r
+  IN UINT32         DataSize,\r
+  IN UINT8          *Data\r
+  );\r
+\r
+/**\r
+Extend a TPM PCR.\r
+\r
+@param[in]  DigestToExtend    The 160 bit value representing the event to be recorded.\r
+@param[in]  PcrIndex          The PCR to be updated.\r
+@param[out] NewPcrValue       New PCR value after extend.\r
+\r
+@retval EFI_SUCCESS           Operation completed successfully.\r
+@retval EFI_TIMEOUT           The register can't run into the expected status in time.\r
+@retval EFI_BUFFER_TOO_SMALL  Response data buffer is too small.\r
+@retval EFI_DEVICE_ERROR      Unexpected device behavior.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tpm12Extend (\r
+  IN  TPM_DIGEST    *DigestToExtend,\r
+  IN  TPM_PCRINDEX  PcrIndex,\r
+  OUT TPM_DIGEST    *NewPcrValue\r
+  );\r
+\r
+/**\r
+Send TSC_PhysicalPresence command to TPM.\r
+\r
+@param[in] PhysicalPresence   The state to set the TPMs Physical Presence flags.\r
+\r
+@retval EFI_SUCCESS           Operation completed successfully.\r
+@retval EFI_TIMEOUT           The register can't run into the expected status in time.\r
+@retval EFI_BUFFER_TOO_SMALL  Response data buffer is too small.\r
+@retval EFI_DEVICE_ERROR      Unexpected device behavior.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tpm12PhysicalPresence (\r
+  IN      TPM_PHYSICAL_PRESENCE     PhysicalPresence\r
+  );\r
+\r
+/**\r
+Send TPM_ContinueSelfTest command to TPM.\r
+\r
+@retval EFI_SUCCESS           Operation completed successfully.\r
+@retval EFI_TIMEOUT           The register can't run into the expected status in time.\r
+@retval EFI_BUFFER_TOO_SMALL  Response data buffer is too small.\r
+@retval EFI_DEVICE_ERROR      Unexpected device behavior.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tpm12ContinueSelfTest (\r
+  VOID\r
+  );\r
+\r
+/**\r
+Get TPM capability permanent flags.\r
+\r
+@param[out] TpmPermanentFlags   Pointer to the buffer for returned flag structure.\r
+\r
+@retval EFI_SUCCESS           Operation completed successfully.\r
+@retval EFI_TIMEOUT           The register can't run into the expected status in time.\r
+@retval EFI_BUFFER_TOO_SMALL  Response data buffer is too small.\r
+@retval EFI_DEVICE_ERROR      Unexpected device behavior.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tpm12GetCapabilityFlagPermanent (\r
+  OUT TPM_PERMANENT_FLAGS  *TpmPermanentFlags\r
+  );\r
+\r
+/**\r
+Get TPM capability volatile flags.\r
+\r
+@param[out] VolatileFlags   Pointer to the buffer for returned flag structure.\r
+\r
+@retval EFI_SUCCESS      Operation completed successfully.\r
+@retval EFI_DEVICE_ERROR The command was unsuccessful.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Tpm12GetCapabilityFlagVolatile (\r
+  OUT TPM_STCLEAR_FLAGS                 *VolatileFlags\r
+  );\r
 #endif\r