+++ /dev/null
-/** @file\r
- This library is TPM2 TREE protocol lib.\r
-\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
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include <Library/BaseLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/Tpm2DeviceLib.h>\r
-#include <Protocol/TrEEProtocol.h>\r
-#include <IndustryStandard/Tpm20.h>\r
-\r
-EFI_TREE_PROTOCOL *mTreeProtocol = NULL; \r
-\r
-/**\r
- This service enables the sending of commands to the TPM2.\r
-\r
- @param[in] InputParameterBlockSize Size of the TPM2 input parameter block.\r
- @param[in] InputParameterBlock Pointer to the TPM2 input parameter block.\r
- @param[in,out] OutputParameterBlockSize Size of the TPM2 output parameter block.\r
- @param[in] OutputParameterBlock Pointer to the TPM2 output parameter block.\r
-\r
- @retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received.\r
- @retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device.\r
- @retval EFI_BUFFER_TOO_SMALL The output parameter block is too small. \r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-Tpm2SubmitCommand (\r
- IN UINT32 InputParameterBlockSize,\r
- IN UINT8 *InputParameterBlock,\r
- IN OUT UINT32 *OutputParameterBlockSize,\r
- IN UINT8 *OutputParameterBlock\r
- )\r
-{\r
- EFI_STATUS Status;\r
- TPM2_RESPONSE_HEADER *Header;\r
-\r
- if (mTreeProtocol == NULL) {\r
- Status = gBS->LocateProtocol (&gEfiTrEEProtocolGuid, NULL, (VOID **) &mTreeProtocol);\r
- if (EFI_ERROR (Status)) {\r
- //\r
- // TrEE protocol is not installed. So, TPM2 is not present.\r
- //\r
- DEBUG ((EFI_D_ERROR, "Tpm2SubmitCommand - TrEE - %r\n", Status));\r
- return EFI_NOT_FOUND;\r
- }\r
- }\r
- //\r
- // Assume when TrEE Protocol is ready, RequestUseTpm already done.\r
- //\r
- Status = mTreeProtocol->SubmitCommand (\r
- mTreeProtocol,\r
- InputParameterBlockSize,\r
- InputParameterBlock,\r
- *OutputParameterBlockSize,\r
- OutputParameterBlock\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
- Header = (TPM2_RESPONSE_HEADER *)OutputParameterBlock;\r
- *OutputParameterBlockSize = SwapBytes32 (Header->paramSize);\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
- This service requests use TPM2.\r
-\r
- @retval EFI_SUCCESS Get the control of TPM2 chip.\r
- @retval EFI_NOT_FOUND TPM2 not found.\r
- @retval EFI_DEVICE_ERROR Unexpected device behavior.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-Tpm2RequestUseTpm (\r
- VOID\r
- )\r
-{\r
- EFI_STATUS Status;\r
-\r
- if (mTreeProtocol == NULL) {\r
- Status = gBS->LocateProtocol (&gEfiTrEEProtocolGuid, NULL, (VOID **) &mTreeProtocol);\r
- if (EFI_ERROR (Status)) {\r
- //\r
- // TrEE protocol is not installed. So, TPM2 is not present.\r
- //\r
- DEBUG ((EFI_D_ERROR, "Tpm2RequestUseTpm - TrEE - %r\n", Status));\r
- return EFI_NOT_FOUND;\r
- }\r
- }\r
- //\r
- // Assume when TrEE Protocol is ready, RequestUseTpm already done.\r
- //\r
- return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
- This service register TPM2 device.\r
-\r
- @param Tpm2Device TPM2 device\r
-\r
- @retval EFI_SUCCESS This TPM2 device is registered successfully.\r
- @retval EFI_UNSUPPORTED System does not support register this TPM2 device.\r
- @retval EFI_ALREADY_STARTED System already register this TPM2 device.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-Tpm2RegisterTpm2DeviceLib (\r
- IN TPM2_DEVICE_INTERFACE *Tpm2Device\r
- )\r
-{\r
- return EFI_UNSUPPORTED;\r
-}\r
+++ /dev/null
-## @file\r
-# Provides function interfaces to communicate with TPM 2.0 device\r
-#\r
-# This library helps to use TPM 2.0 device in library function API\r
-# based on TrEE protocol.\r
-#\r
-# Copyright (c) 2013 - 2014, 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
-# http://opensource.org/licenses/bsd-license.php\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-##\r
-\r
-[Defines]\r
- INF_VERSION = 0x00010005\r
- BASE_NAME = Tpm2DeviceLibTrEE\r
- MODULE_UNI_FILE = Tpm2DeviceLibTrEE.uni\r
- FILE_GUID = BBCB6F85-303C-4eb9-8182-AF98D4B3020C\r
- MODULE_TYPE = DXE_DRIVER\r
- VERSION_STRING = 1.0\r
- LIBRARY_CLASS = Tpm2DeviceLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER \r
-\r
-#\r
-# The following information is for reference only and not required by the build tools.\r
-#\r
-# VALID_ARCHITECTURES = IA32 X64 IPF\r
-#\r
-\r
-[Sources]\r
- Tpm2DeviceLibTrEE.c\r
-\r
-[Packages]\r
- MdePkg/MdePkg.dec\r
- SecurityPkg/SecurityPkg.dec\r
-\r
-[LibraryClasses]\r
- BaseLib\r
- BaseMemoryLib\r
- DebugLib\r
- UefiBootServicesTableLib\r
-\r
-[Protocols]\r
- gEfiTrEEProtocolGuid ## CONSUMES\r
+++ /dev/null
-// /** @file\r
-// Provides function interfaces to communicate with TPM 2.0 device\r
-//\r
-// This library helps to use TPM 2.0 device in library function API\r
-// based on TrEE protocol.\r
-//\r
-// Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>\r
-//\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
-// http://opensource.org/licenses/bsd-license.php\r
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-//\r
-// **/\r
-\r
-\r
-#string STR_MODULE_ABSTRACT #language en-US "Provides function interfaces to communicate with TPM 2.0 device"\r
-\r
-#string STR_MODULE_DESCRIPTION #language en-US "This library helps to use TPM 2.0 device in library function API based on TrEE protocol."\r
-\r