mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-26 23:24:03 +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()
|
Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction() and Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction()
|
||||||
will receive untrusted input and do validation.
|
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
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <PiMm.h>
|
#include "MmTcg2PhysicalPresenceLibCommon.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"
|
|
||||||
|
|
||||||
EFI_SMM_VARIABLE_PROTOCOL *mTcg2PpSmmVariable;
|
EFI_SMM_VARIABLE_PROTOCOL *mTcg2PpSmmVariable;
|
||||||
BOOLEAN mIsTcg2PPVerLowerThan_1_3 = FALSE;
|
BOOLEAN mIsTcg2PPVerLowerThan_1_3 = FALSE;
|
||||||
@ -392,9 +380,7 @@ Tcg2PhysicalPresenceLibCommonConstructor (
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
if (AsciiStrnCmp (PP_INF_VERSION_1_2, (CHAR8 *)PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer), sizeof (PP_INF_VERSION_1_2) - 1) >= 0) {
|
mIsTcg2PPVerLowerThan_1_3 = IsTcg2PPVerLowerThan_1_3 ();
|
||||||
mIsTcg2PPVerLowerThan_1_3 = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Locate SmmVariableProtocol.
|
// Locate SmmVariableProtocol.
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction() and Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction()
|
Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction() and Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction()
|
||||||
will receive untrusted input and do validation.
|
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
|
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_
|
#ifndef _MM_TCG2_PHYSICAL_PRESENCE_LIB_COMMON_H_
|
||||||
#define _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.
|
The constructor function locates MmVariable protocol.
|
||||||
|
|
||||||
@ -31,4 +43,15 @@ Tcg2PhysicalPresenceLibCommonConstructor (
|
|||||||
VOID
|
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
|
#endif
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction() and Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction()
|
Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction() and Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction()
|
||||||
will receive untrusted input and do validation.
|
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
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -39,3 +39,17 @@ Tcg2PhysicalPresenceLibTraditionalConstructor (
|
|||||||
{
|
{
|
||||||
return Tcg2PhysicalPresenceLibCommonConstructor ();
|
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()
|
Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction() and Tcg2PhysicalPresenceLibGetUserConfirmationStatusFunction()
|
||||||
will receive untrusted input and do validation.
|
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.
|
Copyright (c) Microsoft Corporation.
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
@ -18,6 +18,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include <PiMm.h>
|
#include <PiMm.h>
|
||||||
|
|
||||||
|
#include <Library/HobLib.h>
|
||||||
|
|
||||||
#include "MmTcg2PhysicalPresenceLibCommon.h"
|
#include "MmTcg2PhysicalPresenceLibCommon.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,3 +42,26 @@ Tcg2PhysicalPresenceLibStandaloneMmConstructor (
|
|||||||
{
|
{
|
||||||
return Tcg2PhysicalPresenceLibCommonConstructor ();
|
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 driver will have external input - variable.
|
||||||
# This external input must be validated carefully to avoid security issue.
|
# 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.
|
# Copyright (c) Microsoft Corporation.
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
#
|
#
|
||||||
@ -44,18 +44,19 @@
|
|||||||
Tcg2PpVendorLib
|
Tcg2PpVendorLib
|
||||||
MmServicesTableLib
|
MmServicesTableLib
|
||||||
BaseMemoryLib
|
BaseMemoryLib
|
||||||
|
HobLib
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
## SOMETIMES_PRODUCES ## Variable:L"PhysicalPresence"
|
## SOMETIMES_PRODUCES ## Variable:L"PhysicalPresence"
|
||||||
## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresence"
|
## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresence"
|
||||||
## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresenceFlags"
|
## SOMETIMES_CONSUMES ## Variable:L"PhysicalPresenceFlags"
|
||||||
gEfiTcg2PhysicalPresenceGuid
|
gEfiTcg2PhysicalPresenceGuid
|
||||||
|
gEdkiiTcgPhysicalPresenceInterfaceVerHobGuid
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiSmmVariableProtocolGuid ## CONSUMES
|
gEfiSmmVariableProtocolGuid ## CONSUMES
|
||||||
|
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer ## CONSUMES
|
|
||||||
gEfiSecurityPkgTokenSpaceGuid.PcdTcg2PhysicalPresenceFlags ## SOMETIMES_CONSUMES
|
gEfiSecurityPkgTokenSpaceGuid.PcdTcg2PhysicalPresenceFlags ## SOMETIMES_CONSUMES
|
||||||
|
|
||||||
[Depex]
|
[Depex]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user