mirror of https://github.com/acidanthera/audk.git
SecurityPkg/Tcg2StandaloneMm:Consume gEdkiiTpmInstanceHobGuid
Consume gEdkiiTpmInstanceHobGuid in Tcg2StandaloneMm driver. It's to avoid using dynamic PcdTpmInstanceGuid in StandaloneMm driver. Signed-off-by: Dun Tan <dun.tan@intel.com>
This commit is contained in:
parent
cb38d27f1d
commit
97ede07beb
|
@ -9,7 +9,7 @@
|
|||
|
||||
PhysicalPresenceCallback() and MemoryClearCallback() will receive untrusted input and do some check.
|
||||
|
||||
Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) Microsoft Corporation.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
|
@ -285,7 +285,7 @@ InitializeTcgCommon (
|
|||
EFI_HANDLE McSwHandle;
|
||||
EFI_HANDLE NotifyHandle;
|
||||
|
||||
if (!CompareGuid (PcdGetPtr (PcdTpmInstanceGuid), &gEfiTpmDeviceInstanceTpm20DtpmGuid)) {
|
||||
if (!IsTpm20Dtpm ()) {
|
||||
DEBUG ((DEBUG_ERROR, "No TPM2 DTPM instance required!\n"));
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
The header file for Tcg2 SMM driver.
|
||||
|
||||
Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) Microsoft Corporation.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
|
@ -84,4 +84,15 @@ InitializeTcgCommon (
|
|||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
This function checks if the required DTPM instance is TPM 2.0.
|
||||
|
||||
@retval TRUE The required DTPM instance is equal to gEfiTpmDeviceInstanceTpm20DtpmGuid.
|
||||
@retval FALSE The required DTPM instance is not equal to gEfiTpmDeviceInstanceTpm20DtpmGuid.
|
||||
**/
|
||||
BOOLEAN
|
||||
IsTpm20Dtpm (
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif // __TCG_SMM_H__
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
PhysicalPresenceCallback() and MemoryClearCallback() will receive untrusted input and do some check.
|
||||
|
||||
Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) Microsoft Corporation.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
|
@ -17,6 +17,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||
|
||||
#include "Tcg2Smm.h"
|
||||
#include <Library/StandaloneMmMemLib.h>
|
||||
#include <Library/HobLib.h>
|
||||
|
||||
/**
|
||||
Notify the system that the SMM variable driver is ready.
|
||||
|
@ -47,6 +48,33 @@ IsBufferOutsideMmValid (
|
|||
return MmIsBufferOutsideMmValid (Buffer, Length);
|
||||
}
|
||||
|
||||
/**
|
||||
This function checks if the required DTPM instance is TPM 2.0.
|
||||
|
||||
@retval TRUE The required DTPM instance is equal to gEfiTpmDeviceInstanceTpm20DtpmGuid.
|
||||
@retval FALSE The required DTPM instance is not equal to gEfiTpmDeviceInstanceTpm20DtpmGuid.
|
||||
**/
|
||||
BOOLEAN
|
||||
IsTpm20Dtpm (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
VOID *GuidHob;
|
||||
|
||||
GuidHob = GetFirstGuidHob (&gEdkiiTpmInstanceHobGuid);
|
||||
if (GuidHob != NULL) {
|
||||
if (CompareGuid ((EFI_GUID *)GET_GUID_HOB_DATA (GuidHob), &gEfiTpmDeviceInstanceTpm20DtpmGuid)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_ERROR, "No TPM2 DTPM instance required! - %g\n", (EFI_GUID *)GET_GUID_HOB_DATA (GuidHob)));
|
||||
} else {
|
||||
DEBUG ((DEBUG_ERROR, "No gEdkiiTpmInstanceHobGuid!\n"));
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
The driver's entry point.
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
# This driver will have external input - variable and ACPINvs data in SMM mode.
|
||||
# This external input must be validated carefully to avoid security issue.
|
||||
#
|
||||
# Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) Microsoft Corporation.<BR>
|
||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#
|
||||
|
@ -55,6 +55,7 @@
|
|||
Tcg2PhysicalPresenceLib
|
||||
PcdLib
|
||||
MemLib
|
||||
HobLib
|
||||
|
||||
[Guids]
|
||||
## SOMETIMES_PRODUCES ## Variable:L"MemoryOverwriteRequestControl"
|
||||
|
@ -63,15 +64,13 @@
|
|||
|
||||
gEfiTpmDeviceInstanceTpm20DtpmGuid ## PRODUCES ## GUID # TPM device identifier
|
||||
gTpmNvsMmGuid ## CONSUMES
|
||||
gEdkiiTpmInstanceHobGuid
|
||||
|
||||
[Protocols]
|
||||
gEfiSmmSwDispatch2ProtocolGuid ## CONSUMES
|
||||
gEfiSmmVariableProtocolGuid ## CONSUMES
|
||||
gEfiMmReadyToLockProtocolGuid ## CONSUMES
|
||||
|
||||
[Pcd]
|
||||
gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid ## CONSUMES
|
||||
|
||||
[Depex]
|
||||
gEfiSmmSwDispatch2ProtocolGuid AND
|
||||
gEfiSmmVariableProtocolGuid
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
PhysicalPresenceCallback() and MemoryClearCallback() will receive untrusted input and do some check.
|
||||
|
||||
Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) Microsoft Corporation.
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
|
@ -58,6 +58,20 @@ IsBufferOutsideMmValid (
|
|||
return SmmIsBufferOutsideSmmValid (Buffer, Length);
|
||||
}
|
||||
|
||||
/**
|
||||
This function checks if the required DTPM instance is TPM 2.0.
|
||||
|
||||
@retval TRUE The required DTPM instance is equal to gEfiTpmDeviceInstanceTpm20DtpmGuid.
|
||||
@retval FALSE The required DTPM instance is not equal to gEfiTpmDeviceInstanceTpm20DtpmGuid.
|
||||
**/
|
||||
BOOLEAN
|
||||
IsTpm20Dtpm (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return CompareGuid (PcdGetPtr (PcdTpmInstanceGuid), &gEfiTpmDeviceInstanceTpm20DtpmGuid);
|
||||
}
|
||||
|
||||
/**
|
||||
The driver's entry point.
|
||||
|
||||
|
|
Loading…
Reference in New Issue