mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
SecurityPkg:Consume gEdkiiTcgPhysicalPresenceInterfaceVerHobGuid
Consume gEdkiiTcgPhysicalPresenceInterfaceVerHobGuid in StandaloneMmTcg2PhysicalPresenceLib. This is to avoid using the dynamic PcdTcgPhysicalPresenceInterfaceVer in StandaloneMm module. Signed-off-by: Dun Tan <dun.tan@intel.com>
This commit is contained in:
parent
97ede07beb
commit
add3ca4e00
@ -10,24 +10,12 @@
|
||||
Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction() and Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction()
|
||||
will receive untrusted input and do validation.
|
||||
|
||||
Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include <PiMm.h>
|
||||
|
||||
#include <Guid/Tcg2PhysicalPresenceData.h>
|
||||
|
||||
#include <Protocol/SmmVariable.h>
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/Tcg2PpVendorLib.h>
|
||||
#include <Library/MmServicesTableLib.h>
|
||||
|
||||
#define PP_INF_VERSION_1_2 "1.2"
|
||||
#include "MmTcg2PhysicalPresenceLibCommon.h"
|
||||
|
||||
EFI_SMM_VARIABLE_PROTOCOL *mTcg2PpSmmVariable;
|
||||
BOOLEAN mIsTcg2PPVerLowerThan_1_3 = FALSE;
|
||||
@ -392,9 +380,7 @@ Tcg2PhysicalPresenceLibCommonConstructor (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (AsciiStrnCmp (PP_INF_VERSION_1_2, (CHAR8 *)PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer), sizeof (PP_INF_VERSION_1_2) - 1) >= 0) {
|
||||
mIsTcg2PPVerLowerThan_1_3 = TRUE;
|
||||
}
|
||||
mIsTcg2PPVerLowerThan_1_3 = IsTcg2PPVerLowerThan_1_3 ();
|
||||
|
||||
//
|
||||
// Locate SmmVariableProtocol.
|
||||
|
@ -10,7 +10,7 @@
|
||||
Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction() and Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction()
|
||||
will receive untrusted input and do validation.
|
||||
|
||||
Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
@ -18,6 +18,18 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#ifndef _MM_TCG2_PHYSICAL_PRESENCE_LIB_COMMON_H_
|
||||
#define _MM_TCG2_PHYSICAL_PRESENCE_LIB_COMMON_H_
|
||||
|
||||
#include <Guid/Tcg2PhysicalPresenceData.h>
|
||||
|
||||
#include <Protocol/SmmVariable.h>
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/Tcg2PpVendorLib.h>
|
||||
#include <Library/MmServicesTableLib.h>
|
||||
|
||||
#define PP_INF_VERSION_1_2 "1.2"
|
||||
|
||||
/**
|
||||
The constructor function locates MmVariable protocol.
|
||||
|
||||
@ -31,4 +43,15 @@ Tcg2PhysicalPresenceLibCommonConstructor (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Check if Tcg2 PP version is lower than PP_INF_VERSION_1_3.
|
||||
|
||||
@retval TRUE Tcg2 PP version is lower than PP_INF_VERSION_1_3.
|
||||
@retval Other Tcg2 PP version is not lower than PP_INF_VERSION_1_3.
|
||||
**/
|
||||
BOOLEAN
|
||||
IsTcg2PPVerLowerThan_1_3 (
|
||||
VOID
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@ -10,7 +10,7 @@
|
||||
Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction() and Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction()
|
||||
will receive untrusted input and do validation.
|
||||
|
||||
Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.<BR>
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
@ -39,3 +39,17 @@ Tcg2PhysicalPresenceLibTraditionalConstructor (
|
||||
{
|
||||
return Tcg2PhysicalPresenceLibCommonConstructor ();
|
||||
}
|
||||
|
||||
/**
|
||||
Check if Tcg2 PP version is lower than PP_INF_VERSION_1_3.
|
||||
|
||||
@retval TRUE Tcg2 PP version is lower than PP_INF_VERSION_1_3.
|
||||
@retval Other Tcg2 PP version is not lower than PP_INF_VERSION_1_3.
|
||||
**/
|
||||
BOOLEAN
|
||||
IsTcg2PPVerLowerThan_1_3 (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return (BOOLEAN)(AsciiStrnCmp (PP_INF_VERSION_1_2, (CHAR8 *)PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer), sizeof (PP_INF_VERSION_1_2) - 1) >= 0);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction() and Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction()
|
||||
will receive untrusted input and do validation.
|
||||
|
||||
Copyright (c) 2015 - 2020, 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
|
||||
|
||||
@ -18,6 +18,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#include <PiMm.h>
|
||||
|
||||
#include <Library/HobLib.h>
|
||||
|
||||
#include "MmTcg2PhysicalPresenceLibCommon.h"
|
||||
|
||||
/**
|
||||
@ -40,3 +42,26 @@ Tcg2PhysicalPresenceLibStandaloneMmConstructor (
|
||||
{
|
||||
return Tcg2PhysicalPresenceLibCommonConstructor ();
|
||||
}
|
||||
|
||||
/**
|
||||
Check if Tcg2 PP version is lower than PP_INF_VERSION_1_3.
|
||||
|
||||
@retval TRUE Tcg2 PP version is lower than PP_INF_VERSION_1_3.
|
||||
@retval Other Tcg2 PP version is not lower than PP_INF_VERSION_1_3.
|
||||
**/
|
||||
BOOLEAN
|
||||
IsTcg2PPVerLowerThan_1_3 (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
VOID *GuidHob;
|
||||
|
||||
GuidHob = GetFirstGuidHob (&gEdkiiTcgPhysicalPresenceInterfaceVerHobGuid);
|
||||
ASSERT (GuidHob != NULL);
|
||||
|
||||
if (AsciiStrnCmp (PP_INF_VERSION_1_2, (CHAR8 *)GET_GUID_HOB_DATA (GuidHob), sizeof (PP_INF_VERSION_1_2) - 1) >= 0) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
# This driver will have external input - variable.
|
||||
# This external input must be validated carefully to avoid security issue.
|
||||
#
|
||||
# Copyright (c) 2015 - 2020, 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
|
||||
#
|
||||
@ -44,18 +44,19 @@
|
||||
Tcg2PpVendorLib
|
||||
MmServicesTableLib
|
||||
BaseMemoryLib
|
||||
HobLib
|
||||
|
||||
[Guids]
|
||||
## SOMETIMES_PRODUCES ## Variable:L"PhysicalPresence"
|
||||
## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresence"
|
||||
## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresenceFlags"
|
||||
gEfiTcg2PhysicalPresenceGuid
|
||||
gEdkiiTcgPhysicalPresenceInterfaceVerHobGuid
|
||||
|
||||
[Protocols]
|
||||
gEfiSmmVariableProtocolGuid ## CONSUMES
|
||||
|
||||
[Pcd]
|
||||
gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer ## CONSUMES
|
||||
gEfiSecurityPkgTokenSpaceGuid.PcdTcg2PhysicalPresenceFlags ## SOMETIMES_CONSUMES
|
||||
|
||||
[Depex]
|
||||
|
Loading…
x
Reference in New Issue
Block a user