Add TPM2 implementation.
signed off by: jiewen.yao@intel.com reviewed by: guo.dong@intel.com git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14687 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
38
SecurityPkg/Include/Guid/TpmInstance.h
Normal file
38
SecurityPkg/Include/Guid/TpmInstance.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/** @file
|
||||
TPM instance guid, used for PcdTpmInstanceGuid.
|
||||
|
||||
Copyright (c) 2013, 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
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 __TPM_INSTANCE_GUID_H__
|
||||
#define __TPM_INSTANCE_GUID_H__
|
||||
|
||||
#define TPM_DEVICE_INTERFACE_NONE \
|
||||
{ 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
|
||||
|
||||
#define TPM_DEVICE_INTERFACE_TPM12 \
|
||||
{ 0x8b01e5b6, 0x4f19, 0x46e8, { 0xab, 0x93, 0x1c, 0x53, 0x67, 0x1b, 0x90, 0xcc } }
|
||||
|
||||
#define TPM_DEVICE_INTERFACE_TPM20_DTPM \
|
||||
{ 0x286bf25a, 0xc2c3, 0x408c, { 0xb3, 0xb4, 0x25, 0xe6, 0x75, 0x8b, 0x73, 0x17 } }
|
||||
|
||||
extern EFI_GUID gEfiTpmDeviceInstanceNoneGuid;
|
||||
extern EFI_GUID gEfiTpmDeviceInstanceTpm12Guid;
|
||||
extern EFI_GUID gEfiTpmDeviceInstanceTpm20DtpmGuid;
|
||||
|
||||
|
||||
#define TPM_DEVICE_SELECTED_GUID \
|
||||
{ 0x7f4158d3, 0x74d, 0x456d, { 0x8c, 0xb2, 0x1, 0xf9, 0xc8, 0xf7, 0x9d, 0xaa } }
|
||||
|
||||
extern EFI_GUID gEfiTpmDeviceSelectedGuid;
|
||||
|
||||
#endif
|
||||
|
25
SecurityPkg/Include/Guid/TrEEConfigHii.h
Normal file
25
SecurityPkg/Include/Guid/TrEEConfigHii.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/** @file
|
||||
GUIDs used as HII FormSet and HII Package list GUID in TrEEConfig driver.
|
||||
|
||||
Copyright (c) 2013, 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 that accompanies this distribution.
|
||||
The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
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 __TREE_CONFIG_HII_GUID_H__
|
||||
#define __TREE_CONFIG_HII_GUID_H__
|
||||
|
||||
#define TREE_CONFIG_FORM_SET_GUID \
|
||||
{ \
|
||||
0xc54b425f, 0xaa79, 0x48b4, { 0x98, 0x1f, 0x99, 0x8b, 0x3c, 0x4b, 0x64, 0x1c } \
|
||||
}
|
||||
|
||||
extern EFI_GUID gTrEEConfigFormSetGuid;
|
||||
|
||||
#endif
|
62
SecurityPkg/Include/Guid/TrEEPhysicalPresenceData.h
Normal file
62
SecurityPkg/Include/Guid/TrEEPhysicalPresenceData.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/** @file
|
||||
Define the variable data structures used for TrEE physical presence.
|
||||
The TPM2 request from firmware or OS is saved to variable. And it is
|
||||
cleared after it is processed in the next boot cycle. The TPM2 response
|
||||
is saved to variable.
|
||||
|
||||
Copyright (c) 2013, 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
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 __TREE_PHYSICAL_PRESENCE_DATA_GUID_H__
|
||||
#define __TREE_PHYSICAL_PRESENCE_DATA_GUID_H__
|
||||
|
||||
#define EFI_TREE_PHYSICAL_PRESENCE_DATA_GUID \
|
||||
{ \
|
||||
0xf24643c2, 0xc622, 0x494e, { 0x8a, 0xd, 0x46, 0x32, 0x57, 0x9c, 0x2d, 0x5b }\
|
||||
}
|
||||
|
||||
#define TREE_PHYSICAL_PRESENCE_VARIABLE L"TrEEPhysicalPresence"
|
||||
|
||||
typedef struct {
|
||||
UINT8 PPRequest; ///< Physical Presence request command.
|
||||
UINT8 LastPPRequest;
|
||||
UINT32 PPResponse;
|
||||
} EFI_TREE_PHYSICAL_PRESENCE;
|
||||
|
||||
//
|
||||
// The definition bit of the flags
|
||||
//
|
||||
#define TREE_FLAG_NO_PPI_CLEAR BIT1
|
||||
#define TREE_FLAG_RESET_TRACK BIT3
|
||||
|
||||
//
|
||||
// This variable is used to save TPM Management Flags and corresponding operations.
|
||||
// It should be protected from malicious software (e.g. Set it as read-only variable).
|
||||
//
|
||||
#define TREE_PHYSICAL_PRESENCE_FLAGS_VARIABLE L"TrEEPhysicalPresenceFlags"
|
||||
|
||||
//
|
||||
// The definition of physical presence operation actions
|
||||
//
|
||||
#define TREE_PHYSICAL_PRESENCE_NO_ACTION 0
|
||||
#define TREE_PHYSICAL_PRESENCE_CLEAR_CONTROL_CLEAR 5
|
||||
#define TREE_PHYSICAL_PRESENCE_CLEAR_CONTROL_CLEAR_2 14
|
||||
#define TREE_PHYSICAL_PRESENCE_SET_NO_PPI_CLEAR_FALSE 17
|
||||
#define TREE_PHYSICAL_PRESENCE_SET_NO_PPI_CLEAR_TRUE 18
|
||||
#define TREE_PHYSICAL_PRESENCE_CLEAR_CONTROL_CLEAR_3 21
|
||||
#define TREE_PHYSICAL_PRESENCE_CLEAR_CONTROL_CLEAR_4 22
|
||||
|
||||
#define TREE_PHYSICAL_PRESENCE_NO_ACTION_MAX 22
|
||||
|
||||
extern EFI_GUID gEfiTrEEPhysicalPresenceGuid;
|
||||
|
||||
#endif
|
||||
|
169
SecurityPkg/Include/Library/HashLib.h
Normal file
169
SecurityPkg/Include/Library/HashLib.h
Normal file
@@ -0,0 +1,169 @@
|
||||
/** @file
|
||||
Ihis library abstract TPM2 hash calculation.
|
||||
The platform can choose multiply hash, while caller just need invoke these API.
|
||||
Then all hash value will be returned and/or extended.
|
||||
|
||||
Copyright (c) 2013, 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
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 _HASH_LIB_H_
|
||||
#define _HASH_LIB_H_
|
||||
|
||||
#include <Uefi.h>
|
||||
#include <Protocol/Hash.h>
|
||||
|
||||
typedef UINTN HASH_HANDLE;
|
||||
|
||||
/**
|
||||
Start hash sequence.
|
||||
|
||||
@param HashHandle Hash handle.
|
||||
|
||||
@retval EFI_SUCCESS Hash sequence start and HandleHandle returned.
|
||||
@retval EFI_OUT_OF_RESOURCES No enough resource to start hash.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HashStart (
|
||||
OUT HASH_HANDLE *HashHandle
|
||||
);
|
||||
|
||||
/**
|
||||
Update hash sequence data.
|
||||
|
||||
@param HashHandle Hash handle.
|
||||
@param DataToHash Data to be hashed.
|
||||
@param DataToHashLen Data size.
|
||||
|
||||
@retval EFI_SUCCESS Hash sequence updated.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HashUpdate (
|
||||
IN HASH_HANDLE HashHandle,
|
||||
IN VOID *DataToHash,
|
||||
IN UINTN DataToHashLen
|
||||
);
|
||||
|
||||
/**
|
||||
Hash sequence complete and extend to PCR.
|
||||
|
||||
@param HashHandle Hash handle.
|
||||
@param PcrIndex PCR to be extended.
|
||||
@param DataToHash Data to be hashed.
|
||||
@param DataToHashLen Data size.
|
||||
@param DigestList Digest list.
|
||||
|
||||
@retval EFI_SUCCESS Hash sequence complete and DigestList is returned.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HashCompleteAndExtend (
|
||||
IN HASH_HANDLE HashHandle,
|
||||
IN TPMI_DH_PCR PcrIndex,
|
||||
IN VOID *DataToHash,
|
||||
IN UINTN DataToHashLen,
|
||||
OUT TPML_DIGEST_VALUES *DigestList
|
||||
);
|
||||
|
||||
/**
|
||||
Hash data and extend to PCR.
|
||||
|
||||
@param PcrIndex PCR to be extended.
|
||||
@param DataToHash Data to be hashed.
|
||||
@param DataToHashLen Data size.
|
||||
@param DigestList Digest list.
|
||||
|
||||
@retval EFI_SUCCESS Hash data and DigestList is returned.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HashAndExtend (
|
||||
IN TPMI_DH_PCR PcrIndex,
|
||||
IN VOID *DataToHash,
|
||||
IN UINTN DataToHashLen,
|
||||
OUT TPML_DIGEST_VALUES *DigestList
|
||||
);
|
||||
|
||||
/**
|
||||
Start hash sequence.
|
||||
|
||||
@param HashHandle Hash handle.
|
||||
|
||||
@retval EFI_SUCCESS Hash sequence start and HandleHandle returned.
|
||||
@retval EFI_OUT_OF_RESOURCES No enough resource to start hash.
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *HASH_INIT) (
|
||||
OUT HASH_HANDLE *HashHandle
|
||||
);
|
||||
|
||||
/**
|
||||
Update hash sequence data.
|
||||
|
||||
@param HashHandle Hash handle.
|
||||
@param DataToHash Data to be hashed.
|
||||
@param DataToHashLen Data size.
|
||||
|
||||
@retval EFI_SUCCESS Hash sequence updated.
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *HASH_UPDATE) (
|
||||
IN HASH_HANDLE HashHandle,
|
||||
IN VOID *DataToHash,
|
||||
IN UINTN DataToHashLen
|
||||
);
|
||||
|
||||
/**
|
||||
Complete hash sequence complete.
|
||||
|
||||
@param HashHandle Hash handle.
|
||||
@param DigestList Digest list.
|
||||
|
||||
@retval EFI_SUCCESS Hash sequence complete and DigestList is returned.
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *HASH_FINAL) (
|
||||
IN HASH_HANDLE HashHandle,
|
||||
OUT TPML_DIGEST_VALUES *DigestList
|
||||
);
|
||||
|
||||
#define HASH_ALGORITHM_SHA1_GUID EFI_HASH_ALGORITHM_SHA1_GUID
|
||||
#define HASH_ALGORITHM_SHA256_GUID EFI_HASH_ALGORITHM_SHA256_GUID
|
||||
#define HASH_ALGORITHM_SHA384_GUID EFI_HASH_ALGORITHM_SHA384_GUID
|
||||
#define HASH_ALGORITHM_SHA512_GUID EFI_HASH_ALGORITHM_SHA512_GUID
|
||||
|
||||
typedef struct {
|
||||
EFI_GUID HashGuid;
|
||||
HASH_INIT HashInit;
|
||||
HASH_UPDATE HashUpdate;
|
||||
HASH_FINAL HashFinal;
|
||||
} HASH_INTERFACE;
|
||||
|
||||
/**
|
||||
This service register Hash.
|
||||
|
||||
@param HashInterface Hash interface
|
||||
|
||||
@retval EFI_SUCCESS This hash interface is registered successfully.
|
||||
@retval EFI_UNSUPPORTED System does not support register this interface.
|
||||
@retval EFI_ALREADY_STARTED System already register this interface.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
RegisterHashInterfaceLib (
|
||||
IN HASH_INTERFACE *HashInterface
|
||||
);
|
||||
|
||||
#endif
|
46
SecurityPkg/Include/Library/Tpm12CommandLib.h
Normal file
46
SecurityPkg/Include/Library/Tpm12CommandLib.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/** @file
|
||||
This library is used by other modules to send TPM12 command.
|
||||
|
||||
Copyright (c) 2013, 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
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_COMMAND_LIB_H_
|
||||
#define _TPM12_COMMAND_LIB_H_
|
||||
|
||||
#include <IndustryStandard/Tpm12.h>
|
||||
|
||||
/**
|
||||
Send Startup command to TPM1.2.
|
||||
|
||||
@param TpmSt Startup Type.
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm12Startup (
|
||||
IN TPM_STARTUP_TYPE TpmSt
|
||||
);
|
||||
|
||||
/**
|
||||
Send ForceClear command to TPM1.2.
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm12ForceClear (
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif
|
54
SecurityPkg/Include/Library/Tpm12DeviceLib.h
Normal file
54
SecurityPkg/Include/Library/Tpm12DeviceLib.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/** @file
|
||||
This library abstract how to access TPM12 hardware device.
|
||||
|
||||
Copyright (c) 2013, 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
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_DEVICE_LIB_H_
|
||||
#define _TPM12_DEVICE_LIB_H_
|
||||
|
||||
#include <IndustryStandard/Tpm12.h>
|
||||
|
||||
/**
|
||||
This service enables the sending of commands to the TPM12.
|
||||
|
||||
@param[in] InputParameterBlockSize Size of the TPM12 input parameter block.
|
||||
@param[in] InputParameterBlock Pointer to the TPM12 input parameter block.
|
||||
@param[in,out] OutputParameterBlockSize Size of the TPM12 output parameter block.
|
||||
@param[in] OutputParameterBlock Pointer to the TPM12 output parameter block.
|
||||
|
||||
@retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received.
|
||||
@retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device.
|
||||
@retval EFI_BUFFER_TOO_SMALL The output parameter block is too small.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm12SubmitCommand (
|
||||
IN UINT32 InputParameterBlockSize,
|
||||
IN UINT8 *InputParameterBlock,
|
||||
IN OUT UINT32 *OutputParameterBlockSize,
|
||||
IN UINT8 *OutputParameterBlock
|
||||
);
|
||||
|
||||
/**
|
||||
This service requests use TPM12.
|
||||
|
||||
@retval EFI_SUCCESS Get the control of TPM12 chip.
|
||||
@retval EFI_NOT_FOUND TPM12 not found.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm12RequestUseTpm (
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif
|
824
SecurityPkg/Include/Library/Tpm2CommandLib.h
Normal file
824
SecurityPkg/Include/Library/Tpm2CommandLib.h
Normal file
@@ -0,0 +1,824 @@
|
||||
/** @file
|
||||
This library is used by other modules to send TPM2 command.
|
||||
|
||||
Copyright (c) 2013, 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
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 _TPM2_COMMAND_LIB_H_
|
||||
#define _TPM2_COMMAND_LIB_H_
|
||||
|
||||
#include <IndustryStandard/Tpm20.h>
|
||||
|
||||
/**
|
||||
This command starts a hash or an Event sequence.
|
||||
If hashAlg is an implemented hash, then a hash sequence is started.
|
||||
If hashAlg is TPM_ALG_NULL, then an Event sequence is started.
|
||||
|
||||
@param[in] HashAlg The hash algorithm to use for the hash sequence
|
||||
An Event sequence starts if this is TPM_ALG_NULL.
|
||||
@param[out] SequenceHandle A handle to reference the sequence
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2HashSequenceStart (
|
||||
IN TPMI_ALG_HASH HashAlg,
|
||||
OUT TPMI_DH_OBJECT *SequenceHandle
|
||||
);
|
||||
|
||||
/**
|
||||
This command is used to add data to a hash or HMAC sequence.
|
||||
The amount of data in buffer may be any size up to the limits of the TPM.
|
||||
NOTE: In all TPM, a buffer size of 1,024 octets is allowed.
|
||||
|
||||
@param[in] SequenceHandle Handle for the sequence object
|
||||
@param[in] Buffer Data to be added to hash
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2SequenceUpdate (
|
||||
IN TPMI_DH_OBJECT SequenceHandle,
|
||||
IN TPM2B_MAX_BUFFER *Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
This command adds the last part of data, if any, to an Event sequence and returns the result in a digest list.
|
||||
If pcrHandle references a PCR and not TPM_RH_NULL, then the returned digest list is processed in
|
||||
the same manner as the digest list input parameter to TPM2_PCR_Extend() with the pcrHandle in each
|
||||
bank extended with the associated digest value.
|
||||
|
||||
@param[in] PcrHandle PCR to be extended with the Event data
|
||||
@param[in] SequenceHandle Authorization for the sequence
|
||||
@param[in] Buffer Data to be added to the Event
|
||||
@param[out] Results List of digests computed for the PCR
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2EventSequenceComplete (
|
||||
IN TPMI_DH_PCR PcrHandle,
|
||||
IN TPMI_DH_OBJECT SequenceHandle,
|
||||
IN TPM2B_MAX_BUFFER *Buffer,
|
||||
OUT TPML_DIGEST_VALUES *Results
|
||||
);
|
||||
|
||||
/**
|
||||
This command adds the last part of data, if any, to a hash/HMAC sequence and returns the result.
|
||||
|
||||
@param[in] SequenceHandle Authorization for the sequence
|
||||
@param[in] Buffer Data to be added to the hash/HMAC
|
||||
@param[out] Result The returned HMAC or digest in a sized buffer
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2SequenceComplete (
|
||||
IN TPMI_DH_OBJECT SequenceHandle,
|
||||
IN TPM2B_MAX_BUFFER *Buffer,
|
||||
OUT TPM2B_DIGEST *Result
|
||||
);
|
||||
|
||||
/**
|
||||
Send Startup command to TPM2.
|
||||
|
||||
@param[in] StartupType TPM_SU_CLEAR or TPM_SU_STATE
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2Startup (
|
||||
IN TPM_SU StartupType
|
||||
);
|
||||
|
||||
/**
|
||||
Send Shutdown command to TPM2.
|
||||
|
||||
@param[in] ShutdownType TPM_SU_CLEAR or TPM_SU_STATE.
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2Shutdown (
|
||||
IN TPM_SU ShutdownType
|
||||
);
|
||||
|
||||
/**
|
||||
This command causes the TPM to perform a test of its capabilities.
|
||||
If the fullTest is YES, the TPM will test all functions.
|
||||
If fullTest = NO, the TPM will only test those functions that have not previously been tested.
|
||||
|
||||
@param[in] FullTest YES if full test to be performed
|
||||
NO if only test of untested functions required
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2SelfTest (
|
||||
IN TPMI_YES_NO FullTest
|
||||
);
|
||||
|
||||
/**
|
||||
This command removes all TPM context associated with a specific Owner.
|
||||
|
||||
@param[in] AuthHandle TPM_RH_LOCKOUT or TPM_RH_PLATFORM+{PP}
|
||||
@param[in] AuthSession Auth Session context
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2Clear (
|
||||
IN TPMI_RH_CLEAR AuthHandle,
|
||||
IN TPMS_AUTH_COMMAND *AuthSession OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Disables and enables the execution of TPM2_Clear().
|
||||
|
||||
@param[in] AuthHandle TPM_RH_LOCKOUT or TPM_RH_PLATFORM+{PP}
|
||||
@param[in] AuthSession Auth Session context
|
||||
@param[in] Disable YES if the disableOwnerClear flag is to be SET,
|
||||
NO if the flag is to be CLEAR.
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2ClearControl (
|
||||
IN TPMI_RH_CLEAR AuthHandle,
|
||||
IN TPMS_AUTH_COMMAND *AuthSession, OPTIONAL
|
||||
IN TPMI_YES_NO Disable
|
||||
);
|
||||
|
||||
/**
|
||||
This command allows the authorization secret for a hierarchy or lockout to be changed using the current
|
||||
authorization value as the command authorization.
|
||||
|
||||
@param[in] AuthHandle TPM_RH_LOCKOUT, TPM_RH_ENDORSEMENT, TPM_RH_OWNER or TPM_RH_PLATFORM+{PP}
|
||||
@param[in] AuthSession Auth Session context
|
||||
@param[in] NewAuth New authorization secret
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2HierarchyChangeAuth (
|
||||
IN TPMI_RH_HIERARCHY_AUTH AuthHandle,
|
||||
IN TPMS_AUTH_COMMAND *AuthSession,
|
||||
IN TPM2B_AUTH *NewAuth
|
||||
);
|
||||
|
||||
/**
|
||||
This replaces the current EPS with a value from the RNG and sets the Endorsement hierarchy controls to
|
||||
their default initialization values.
|
||||
|
||||
@param[in] AuthHandle TPM_RH_PLATFORM+{PP}
|
||||
@param[in] AuthSession Auth Session context
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2ChangeEPS (
|
||||
IN TPMI_RH_PLATFORM AuthHandle,
|
||||
IN TPMS_AUTH_COMMAND *AuthSession
|
||||
);
|
||||
|
||||
/**
|
||||
This replaces the current PPS with a value from the RNG and sets platformPolicy to the default
|
||||
initialization value (the Empty Buffer).
|
||||
|
||||
@param[in] AuthHandle TPM_RH_PLATFORM+{PP}
|
||||
@param[in] AuthSession Auth Session context
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2ChangePPS (
|
||||
IN TPMI_RH_PLATFORM AuthHandle,
|
||||
IN TPMS_AUTH_COMMAND *AuthSession
|
||||
);
|
||||
|
||||
/**
|
||||
This command enables and disables use of a hierarchy.
|
||||
|
||||
@param[in] AuthHandle TPM_RH_ENDORSEMENT, TPM_RH_OWNER or TPM_RH_PLATFORM+{PP}
|
||||
@param[in] AuthSession Auth Session context
|
||||
@param[in] Hierarchy Hierarchy of the enable being modified
|
||||
@param[in] State YES if the enable should be SET,
|
||||
NO if the enable should be CLEAR
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2HierarchyControl (
|
||||
IN TPMI_RH_HIERARCHY AuthHandle,
|
||||
IN TPMS_AUTH_COMMAND *AuthSession,
|
||||
IN TPMI_RH_HIERARCHY Hierarchy,
|
||||
IN TPMI_YES_NO State
|
||||
);
|
||||
|
||||
/**
|
||||
This command cancels the effect of a TPM lockout due to a number of successive authorization failures.
|
||||
If this command is properly authorized, the lockout counter is set to zero.
|
||||
|
||||
@param[in] LockHandle LockHandle
|
||||
@param[in] AuthSession Auth Session context
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2DictionaryAttackLockReset (
|
||||
IN TPMI_RH_LOCKOUT LockHandle,
|
||||
IN TPMS_AUTH_COMMAND *AuthSession
|
||||
);
|
||||
|
||||
/**
|
||||
This command cancels the effect of a TPM lockout due to a number of successive authorization failures.
|
||||
If this command is properly authorized, the lockout counter is set to zero.
|
||||
|
||||
@param[in] LockHandle LockHandle
|
||||
@param[in] AuthSession Auth Session context
|
||||
@param[in] NewMaxTries Count of authorization failures before the lockout is imposed
|
||||
@param[in] NewRecoveryTime Time in seconds before the authorization failure count is automatically decremented
|
||||
@param[in] LockoutRecovery Time in seconds after a lockoutAuth failure before use of lockoutAuth is allowed
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2DictionaryAttackParameters (
|
||||
IN TPMI_RH_LOCKOUT LockHandle,
|
||||
IN TPMS_AUTH_COMMAND *AuthSession,
|
||||
IN UINT32 NewMaxTries,
|
||||
IN UINT32 NewRecoveryTime,
|
||||
IN UINT32 LockoutRecovery
|
||||
);
|
||||
|
||||
/**
|
||||
This command is used to read the public area and Name of an NV Index.
|
||||
|
||||
@param[in] NvIndex The NV Index.
|
||||
@param[out] NvPublic The public area of the index.
|
||||
@param[out] NvName The Name of the nvIndex.
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR The command was unsuccessful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2NvReadPublic (
|
||||
IN TPMI_RH_NV_INDEX NvIndex,
|
||||
OUT TPM2B_NV_PUBLIC *NvPublic,
|
||||
OUT TPM2B_NAME *NvName
|
||||
);
|
||||
|
||||
/**
|
||||
This command defines the attributes of an NV Index and causes the TPM to
|
||||
reserve space to hold the data associated with the index.
|
||||
If a definition already exists at the index, the TPM will return TPM_RC_NV_DEFINED.
|
||||
|
||||
@param[in] AuthHandle TPM_RH_OWNER or TPM_RH_PLATFORM+{PP}.
|
||||
@param[in] AuthSession Auth Session context
|
||||
@param[in] Auth The authorization data.
|
||||
@param[in] NvPublic The public area of the index.
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR The command was unsuccessful.
|
||||
@retval EFI_ALREADY_STARTED The command was returned successfully, but NvIndex is already defined.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2NvDefineSpace (
|
||||
IN TPMI_RH_PROVISION AuthHandle,
|
||||
IN TPMS_AUTH_COMMAND *AuthSession, OPTIONAL
|
||||
IN TPM2B_AUTH *Auth,
|
||||
IN TPM2B_NV_PUBLIC *NvPublic
|
||||
);
|
||||
|
||||
/**
|
||||
This command removes an index from the TPM.
|
||||
|
||||
@param[in] AuthHandle TPM_RH_OWNER or TPM_RH_PLATFORM+{PP}.
|
||||
@param[in] NvIndex The NV Index.
|
||||
@param[in] AuthSession Auth Session context
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR The command was unsuccessful.
|
||||
@retval EFI_NOT_FOUND The command was returned successfully, but NvIndex is not found.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2NvUndefineSpace (
|
||||
IN TPMI_RH_PROVISION AuthHandle,
|
||||
IN TPMI_RH_NV_INDEX NvIndex,
|
||||
IN TPMS_AUTH_COMMAND *AuthSession OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
This command reads a value from an area in NV memory previously defined by TPM2_NV_DefineSpace().
|
||||
|
||||
@param[in] AuthHandle the handle indicating the source of the authorization value.
|
||||
@param[in] NvIndex The index to be read.
|
||||
@param[in] AuthSession Auth Session context
|
||||
@param[in] Size Number of bytes to read.
|
||||
@param[in] Offset Byte offset into the area.
|
||||
@param[in,out] OutData The data read.
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR The command was unsuccessful.
|
||||
@retval EFI_NOT_FOUND The command was returned successfully, but NvIndex is not found.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2NvRead (
|
||||
IN TPMI_RH_NV_AUTH AuthHandle,
|
||||
IN TPMI_RH_NV_INDEX NvIndex,
|
||||
IN TPMS_AUTH_COMMAND *AuthSession, OPTIONAL
|
||||
IN UINT16 Size,
|
||||
IN UINT16 Offset,
|
||||
IN OUT TPM2B_MAX_BUFFER *OutData
|
||||
);
|
||||
|
||||
/**
|
||||
This command writes a value to an area in NV memory that was previously defined by TPM2_NV_DefineSpace().
|
||||
|
||||
@param[in] AuthHandle the handle indicating the source of the authorization value.
|
||||
@param[in] NvIndex The NV Index of the area to write.
|
||||
@param[in] AuthSession Auth Session context
|
||||
@param[in] InData The data to write.
|
||||
@param[in] Offset The offset into the NV Area.
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR The command was unsuccessful.
|
||||
@retval EFI_NOT_FOUND The command was returned successfully, but NvIndex is not found.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2NvWrite (
|
||||
IN TPMI_RH_NV_AUTH AuthHandle,
|
||||
IN TPMI_RH_NV_INDEX NvIndex,
|
||||
IN TPMS_AUTH_COMMAND *AuthSession, OPTIONAL
|
||||
IN TPM2B_MAX_BUFFER *InData,
|
||||
IN UINT16 Offset
|
||||
);
|
||||
|
||||
/**
|
||||
This command may be used to prevent further reads of the Index until the next TPM2_Startup (TPM_SU_CLEAR).
|
||||
|
||||
@param[in] AuthHandle the handle indicating the source of the authorization value.
|
||||
@param[in] NvIndex The NV Index of the area to lock.
|
||||
@param[in] AuthSession Auth Session context
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR The command was unsuccessful.
|
||||
@retval EFI_NOT_FOUND The command was returned successfully, but NvIndex is not found.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2NvReadLock (
|
||||
IN TPMI_RH_NV_AUTH AuthHandle,
|
||||
IN TPMI_RH_NV_INDEX NvIndex,
|
||||
IN TPMS_AUTH_COMMAND *AuthSession OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
This command may be used to inhibit further writes of the Index.
|
||||
|
||||
@param[in] AuthHandle the handle indicating the source of the authorization value.
|
||||
@param[in] NvIndex The NV Index of the area to lock.
|
||||
@param[in] AuthSession Auth Session context
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR The command was unsuccessful.
|
||||
@retval EFI_NOT_FOUND The command was returned successfully, but NvIndex is not found.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2NvWriteLock (
|
||||
IN TPMI_RH_NV_AUTH AuthHandle,
|
||||
IN TPMI_RH_NV_INDEX NvIndex,
|
||||
IN TPMS_AUTH_COMMAND *AuthSession OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
The command will SET TPMA_NV_WRITELOCKED for all indexes that have their TPMA_NV_GLOBALLOCK attribute SET.
|
||||
|
||||
@param[in] AuthHandle TPM_RH_OWNER or TPM_RH_PLATFORM+{PP}.
|
||||
@param[in] AuthSession Auth Session context
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR The command was unsuccessful.
|
||||
@retval EFI_NOT_FOUND The command was returned successfully, but NvIndex is not found.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2NvGlobalWriteLock (
|
||||
IN TPMI_RH_PROVISION AuthHandle,
|
||||
IN TPMS_AUTH_COMMAND *AuthSession OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
This command is used to cause an update to the indicated PCR.
|
||||
The digests parameter contains one or more tagged digest value identified by an algorithm ID.
|
||||
For each digest, the PCR associated with pcrHandle is Extended into the bank identified by the tag (hashAlg).
|
||||
|
||||
@param[in] PcrHandle Handle of the PCR
|
||||
@param[in] Digests List of tagged digest values to be extended
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2PcrExtend (
|
||||
IN TPMI_DH_PCR PcrHandle,
|
||||
IN TPML_DIGEST_VALUES *Digests
|
||||
);
|
||||
|
||||
/**
|
||||
This command is used to cause an update to the indicated PCR.
|
||||
The data in eventData is hashed using the hash algorithm associated with each bank in which the
|
||||
indicated PCR has been allocated. After the data is hashed, the digests list is returned. If the pcrHandle
|
||||
references an implemented PCR and not TPM_ALG_NULL, digests list is processed as in
|
||||
TPM2_PCR_Extend().
|
||||
A TPM shall support an Event.size of zero through 1,024 inclusive.
|
||||
|
||||
@param[in] PcrHandle Handle of the PCR
|
||||
@param[in] EventData Event data in sized buffer
|
||||
@param[out] Digests List of digest
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2PcrEvent (
|
||||
IN TPMI_DH_PCR PcrHandle,
|
||||
IN TPM2B_EVENT *EventData,
|
||||
OUT TPML_DIGEST_VALUES *Digests
|
||||
);
|
||||
|
||||
/**
|
||||
This command returns the values of all PCR specified in pcrSelect.
|
||||
|
||||
@param[in] PcrSelectionIn The selection of PCR to read.
|
||||
@param[out] PcrUpdateCounter The current value of the PCR update counter.
|
||||
@param[out] PcrSelectionOut The PCR in the returned list.
|
||||
@param[out] PcrValues The contents of the PCR indicated in pcrSelect.
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR The command was unsuccessful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2PcrRead (
|
||||
IN TPML_PCR_SELECTION *PcrSelectionIn,
|
||||
OUT UINT32 *PcrUpdateCounter,
|
||||
OUT TPML_PCR_SELECTION *PcrSelectionOut,
|
||||
OUT TPML_DIGEST *PcrValues
|
||||
);
|
||||
|
||||
/**
|
||||
This command is used to set the desired PCR allocation of PCR and algorithms.
|
||||
|
||||
@param[in] AuthHandle TPM_RH_PLATFORM+{PP}
|
||||
@param[in] AuthSession Auth Session context
|
||||
@param[in] PcrAllocation The requested allocation
|
||||
@param[out] AllocationSuccess YES if the allocation succeeded
|
||||
@param[out] MaxPCR maximum number of PCR that may be in a bank
|
||||
@param[out] SizeNeeded number of octets required to satisfy the request
|
||||
@param[out] SizeAvailable Number of octets available. Computed before the allocation
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR The command was unsuccessful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2PcrAllocate (
|
||||
IN TPMI_RH_PLATFORM AuthHandle,
|
||||
IN TPMS_AUTH_COMMAND *AuthSession,
|
||||
IN TPML_PCR_SELECTION *PcrAllocation,
|
||||
OUT TPMI_YES_NO *AllocationSuccess,
|
||||
OUT UINT32 *MaxPCR,
|
||||
OUT UINT32 *SizeNeeded,
|
||||
OUT UINT32 *SizeAvailable
|
||||
);
|
||||
|
||||
/**
|
||||
This command returns various information regarding the TPM and its current state.
|
||||
|
||||
The capability parameter determines the category of data returned. The property parameter
|
||||
selects the first value of the selected category to be returned. If there is no property
|
||||
that corresponds to the value of property, the next higher value is returned, if it exists.
|
||||
The moreData parameter will have a value of YES if there are more values of the requested
|
||||
type that were not returned.
|
||||
If no next capability exists, the TPM will return a zero-length list and moreData will have
|
||||
a value of NO.
|
||||
|
||||
NOTE:
|
||||
To simplify this function, leave returned CapabilityData for caller to unpack since there are
|
||||
many capability categories and only few categories will be used in firmware. It means the caller
|
||||
need swap the byte order for the feilds in CapabilityData.
|
||||
|
||||
@param[in] Capability Group selection; determines the format of the response.
|
||||
@param[in] Property Further definition of information.
|
||||
@param[in] PropertyCount Number of properties of the indicated type to return.
|
||||
@param[out] MoreData Flag to indicate if there are more values of this type.
|
||||
@param[out] CapabilityData The capability data.
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR The command was unsuccessful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2GetCapability (
|
||||
IN TPM_CAP Capability,
|
||||
IN UINT32 Property,
|
||||
IN UINT32 PropertyCount,
|
||||
OUT TPMI_YES_NO *MoreData,
|
||||
OUT TPMS_CAPABILITY_DATA *CapabilityData
|
||||
);
|
||||
|
||||
/**
|
||||
This command returns the information of TPM Family.
|
||||
|
||||
This function parse the value got from TPM2_GetCapability and return the Family.
|
||||
|
||||
@param[out] Family The Family of TPM. (a 4-octet character string)
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR The command was unsuccessful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2GetCapabilityFamily (
|
||||
OUT CHAR8 *Family
|
||||
);
|
||||
|
||||
/**
|
||||
This command returns the information of TPM manufacture ID.
|
||||
|
||||
This function parse the value got from TPM2_GetCapability and return the TPM manufacture ID.
|
||||
|
||||
@param[out] ManufactureId The manufacture ID of TPM.
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR The command was unsuccessful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2GetCapabilityManufactureID (
|
||||
OUT UINT32 *ManufactureId
|
||||
);
|
||||
|
||||
/**
|
||||
This command returns the information of TPM FirmwareVersion.
|
||||
|
||||
This function parse the value got from TPM2_GetCapability and return the TPM FirmwareVersion.
|
||||
|
||||
@param[out] FirmwareVersion1 The FirmwareVersion1.
|
||||
@param[out] FirmwareVersion2 The FirmwareVersion2.
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR The command was unsuccessful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2GetCapabilityFirmwareVersion (
|
||||
OUT UINT32 *FirmwareVersion1,
|
||||
OUT UINT32 *FirmwareVersion2
|
||||
);
|
||||
|
||||
/**
|
||||
This command returns the information of the maximum value for commandSize and responseSize in a command.
|
||||
|
||||
This function parse the value got from TPM2_GetCapability and return the max command size and response size
|
||||
|
||||
@param[out] MaxCommandSize The maximum value for commandSize in a command.
|
||||
@param[out] MaxResponseSize The maximum value for responseSize in a command.
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR The command was unsuccessful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2GetCapabilityMaxCommandResponseSize (
|
||||
OUT UINT32 *MaxCommandSize,
|
||||
OUT UINT32 *MaxResponseSize
|
||||
);
|
||||
|
||||
/**
|
||||
This command returns Returns a list of TPMS_ALG_PROPERTIES. Each entry is an
|
||||
algorithm ID and a set of properties of the algorithm.
|
||||
|
||||
This function parse the value got from TPM2_GetCapability and return the list.
|
||||
|
||||
@param[out] AlgList List of algorithm.
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR The command was unsuccessful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2GetCapabilitySupportedAlg (
|
||||
OUT TPML_ALG_PROPERTY *AlgList
|
||||
);
|
||||
|
||||
/**
|
||||
This command returns the information of TPM LockoutCounter.
|
||||
|
||||
This function parse the value got from TPM2_GetCapability and return the LockoutCounter.
|
||||
|
||||
@param[out] LockoutCounter The LockoutCounter of TPM.
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR The command was unsuccessful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2GetCapabilityLockoutCounter (
|
||||
OUT UINT32 *LockoutCounter
|
||||
);
|
||||
|
||||
/**
|
||||
This command returns the information of TPM LockoutInterval.
|
||||
|
||||
This function parse the value got from TPM2_GetCapability and return the LockoutInterval.
|
||||
|
||||
@param[out] LockoutInterval The LockoutInterval of TPM.
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR The command was unsuccessful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2GetCapabilityLockoutInterval (
|
||||
OUT UINT32 *LockoutInterval
|
||||
);
|
||||
|
||||
/**
|
||||
This command returns the information of TPM InputBufferSize.
|
||||
|
||||
This function parse the value got from TPM2_GetCapability and return the InputBufferSize.
|
||||
|
||||
@param[out] InputBufferSize The InputBufferSize of TPM.
|
||||
the maximum size of a parameter (typically, a TPM2B_MAX_BUFFER)
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR The command was unsuccessful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2GetCapabilityInputBufferSize (
|
||||
OUT UINT32 *InputBufferSize
|
||||
);
|
||||
|
||||
/**
|
||||
This command returns the information of TPM PCRs.
|
||||
|
||||
This function parse the value got from TPM2_GetCapability and return the PcrSelection.
|
||||
|
||||
@param[out] Pcrs The Pcr Selection
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR The command was unsuccessful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2GetCapabilityPcrs (
|
||||
OUT TPML_PCR_SELECTION *Pcrs
|
||||
);
|
||||
|
||||
/**
|
||||
This command returns the information of TPM AlgorithmSet.
|
||||
|
||||
This function parse the value got from TPM2_GetCapability and return the AlgorithmSet.
|
||||
|
||||
@param[out] AlgorithmSet The AlgorithmSet of TPM.
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR The command was unsuccessful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2GetCapabilityAlgorithmSet (
|
||||
OUT UINT32 *AlgorithmSet
|
||||
);
|
||||
|
||||
/**
|
||||
This command is used to check to see if specific combinations of algorithm parameters are supported.
|
||||
|
||||
@param[in] Parameters Algorithm parameters to be validated
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2TestParms (
|
||||
IN TPMT_PUBLIC_PARMS *Parameters
|
||||
);
|
||||
|
||||
/**
|
||||
This command allows the platform to change the set of algorithms that are used by the TPM.
|
||||
The algorithmSet setting is a vendor-dependent value.
|
||||
|
||||
@param[in] AuthHandle TPM_RH_PLATFORM
|
||||
@param[in] AuthSession Auth Session context
|
||||
@param[in] AlgorithmSet A TPM vendor-dependent value indicating the
|
||||
algorithm set selection
|
||||
|
||||
@retval EFI_SUCCESS Operation completed successfully.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2SetAlgorithmSet (
|
||||
IN TPMI_RH_PLATFORM AuthHandle,
|
||||
IN TPMS_AUTH_COMMAND *AuthSession,
|
||||
IN UINT32 AlgorithmSet
|
||||
);
|
||||
|
||||
//
|
||||
// Help function
|
||||
//
|
||||
|
||||
/**
|
||||
Copy AuthSessionIn to TPM2 command buffer.
|
||||
|
||||
@param [in] AuthSessionIn Input AuthSession data
|
||||
@param [out] AuthSessionOut Output AuthSession data in TPM2 command buffer
|
||||
|
||||
@return AuthSession size
|
||||
**/
|
||||
UINT32
|
||||
EFIAPI
|
||||
CopyAuthSessionCommand (
|
||||
IN TPMS_AUTH_COMMAND *AuthSessionIn, OPTIONAL
|
||||
OUT UINT8 *AuthSessionOut
|
||||
);
|
||||
|
||||
/**
|
||||
Copy AuthSessionIn from TPM2 response buffer.
|
||||
|
||||
@param [in] AuthSessionIn Input AuthSession data in TPM2 response buffer
|
||||
@param [out] AuthSessionOut Output AuthSession data
|
||||
|
||||
@return AuthSession size
|
||||
**/
|
||||
UINT32
|
||||
EFIAPI
|
||||
CopyAuthSessionResponse (
|
||||
IN UINT8 *AuthSessionIn,
|
||||
OUT TPMS_AUTH_RESPONSE *AuthSessionOut OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Return size of digest.
|
||||
|
||||
@param[in] HashAlgo Hash algorithm
|
||||
|
||||
@return size of digest
|
||||
**/
|
||||
UINT16
|
||||
EFIAPI
|
||||
GetHashSizeFromAlgo (
|
||||
IN TPMI_ALG_HASH HashAlgo
|
||||
);
|
||||
|
||||
#endif
|
109
SecurityPkg/Include/Library/Tpm2DeviceLib.h
Normal file
109
SecurityPkg/Include/Library/Tpm2DeviceLib.h
Normal file
@@ -0,0 +1,109 @@
|
||||
/** @file
|
||||
This library abstract how to access TPM2 hardware device.
|
||||
|
||||
Copyright (c) 2013, 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
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 _TPM2_DEVICE_LIB_H_
|
||||
#define _TPM2_DEVICE_LIB_H_
|
||||
|
||||
#include <Uefi.h>
|
||||
|
||||
/**
|
||||
This service enables the sending of commands to the TPM2.
|
||||
|
||||
@param[in] InputParameterBlockSize Size of the TPM2 input parameter block.
|
||||
@param[in] InputParameterBlock Pointer to the TPM2 input parameter block.
|
||||
@param[in,out] OutputParameterBlockSize Size of the TPM2 output parameter block.
|
||||
@param[in] OutputParameterBlock Pointer to the TPM2 output parameter block.
|
||||
|
||||
@retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received.
|
||||
@retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device.
|
||||
@retval EFI_BUFFER_TOO_SMALL The output parameter block is too small.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2SubmitCommand (
|
||||
IN UINT32 InputParameterBlockSize,
|
||||
IN UINT8 *InputParameterBlock,
|
||||
IN OUT UINT32 *OutputParameterBlockSize,
|
||||
IN UINT8 *OutputParameterBlock
|
||||
);
|
||||
|
||||
/**
|
||||
This service requests use TPM2.
|
||||
|
||||
@retval EFI_SUCCESS Get the control of TPM2 chip.
|
||||
@retval EFI_NOT_FOUND TPM2 not found.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2RequestUseTpm (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
This service enables the sending of commands to the TPM2.
|
||||
|
||||
@param[in] InputParameterBlockSize Size of the TPM2 input parameter block.
|
||||
@param[in] InputParameterBlock Pointer to the TPM2 input parameter block.
|
||||
@param[in,out] OutputParameterBlockSize Size of the TPM2 output parameter block.
|
||||
@param[in] OutputParameterBlock Pointer to the TPM2 output parameter block.
|
||||
|
||||
@retval EFI_SUCCESS The command byte stream was successfully sent to the device and a response was successfully received.
|
||||
@retval EFI_DEVICE_ERROR The command was not successfully sent to the device or a response was not successfully received from the device.
|
||||
@retval EFI_BUFFER_TOO_SMALL The output parameter block is too small.
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *TPM2_SUBMIT_COMMAND) (
|
||||
IN UINT32 InputParameterBlockSize,
|
||||
IN UINT8 *InputParameterBlock,
|
||||
IN OUT UINT32 *OutputParameterBlockSize,
|
||||
IN UINT8 *OutputParameterBlock
|
||||
);
|
||||
|
||||
/**
|
||||
This service requests use TPM2.
|
||||
|
||||
@retval EFI_SUCCESS Get the control of TPM2 chip.
|
||||
@retval EFI_NOT_FOUND TPM2 not found.
|
||||
@retval EFI_DEVICE_ERROR Unexpected device behavior.
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *TPM2_REQUEST_USE_TPM) (
|
||||
VOID
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
EFI_GUID ProviderGuid;
|
||||
TPM2_SUBMIT_COMMAND Tpm2SubmitCommand;
|
||||
TPM2_REQUEST_USE_TPM Tpm2RequestUseTpm;
|
||||
} TPM2_DEVICE_INTERFACE;
|
||||
|
||||
/**
|
||||
This service register TPM2 device.
|
||||
|
||||
@param Tpm2Device TPM2 device
|
||||
|
||||
@retval EFI_SUCCESS This TPM2 device is registered successfully.
|
||||
@retval EFI_UNSUPPORTED System does not support register this TPM2 device.
|
||||
@retval EFI_ALREADY_STARTED System already register this TPM2 device.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Tpm2RegisterTpm2DeviceLib (
|
||||
IN TPM2_DEVICE_INTERFACE *Tpm2Device
|
||||
);
|
||||
|
||||
#endif
|
57
SecurityPkg/Include/Library/TrEEPhysicalPresenceLib.h
Normal file
57
SecurityPkg/Include/Library/TrEEPhysicalPresenceLib.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/** @file
|
||||
Ihis library is intended to be used by BDS modules.
|
||||
This library will executing TPM2 request.
|
||||
|
||||
Copyright (c) 2013, 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
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 _TREE_PHYSICAL_PRESENCE_LIB_H_
|
||||
#define _TREE_PHYSICAL_PRESENCE_LIB_H_
|
||||
|
||||
#include <IndustryStandard/Tpm20.h>
|
||||
#include <Protocol/TrEEProtocol.h>
|
||||
|
||||
/**
|
||||
Check and execute the pending TPM request.
|
||||
|
||||
The TPM request may come from OS or BIOS. This API will display request information and wait
|
||||
for user confirmation if TPM request exists. The TPM request will be sent to TPM device after
|
||||
the TPM request is confirmed, and one or more reset may be required to make TPM request to
|
||||
take effect.
|
||||
|
||||
This API should be invoked after console in and console out are all ready as they are required
|
||||
to display request information and get user input to confirm the request.
|
||||
|
||||
@param PlatformAuth platform auth value. NULL means no platform auth change.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
TrEEPhysicalPresenceLibProcessRequest (
|
||||
IN TPM2B_AUTH *PlatformAuth OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
Check if the pending TPM request needs user input to confirm.
|
||||
|
||||
The TPM request may come from OS. This API will check if TPM request exists and need user
|
||||
input to confirmation.
|
||||
|
||||
@retval TRUE TPM needs input to confirm user physical presence.
|
||||
@retval FALSE TPM doesn't need input to confirm user physical presence.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
TrEEPhysicalPresenceLibNeedUserConfirm(
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif
|
@@ -0,0 +1,37 @@
|
||||
/** @file
|
||||
Ihis PPI means a FV does not need to be extended to PCR by TCG modules.
|
||||
|
||||
Copyright (c) 2013, 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
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
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 __EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_H__
|
||||
#define __EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_H__
|
||||
|
||||
#define EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_PPI_GUID \
|
||||
{ 0x6e056ff9, 0xc695, 0x4364, { 0x9e, 0x2c, 0x61, 0x26, 0xf5, 0xce, 0xea, 0xae } }
|
||||
|
||||
typedef struct {
|
||||
EFI_PHYSICAL_ADDRESS FvBase;
|
||||
UINT64 FvLength;
|
||||
} EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_FV;
|
||||
|
||||
//
|
||||
// This PPI means a FV does not need to be extended to PCR by TCG modules.
|
||||
//
|
||||
typedef struct {
|
||||
UINT32 Count;
|
||||
EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_FV Fv[1];
|
||||
} EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_PPI;
|
||||
|
||||
extern EFI_GUID gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid;
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user