Fix the return status when physical presence variable and MemoryOverwriteRequestControl variable are corrupt.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dong Guo <guo.dong@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Yao Jiewen <jiewen.yao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15329 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
ExecutePendingTpmRequest() will receive untrusted input and do validation.
|
||||
|
||||
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2014, 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
|
||||
@@ -1059,6 +1059,9 @@ ExecutePendingTpmRequest (
|
||||
sizeof (UINT8),
|
||||
&NewFlags
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1162,19 +1165,20 @@ TcgPhysicalPresenceLibProcessRequest (
|
||||
&PpiFlags
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (Status == EFI_NOT_FOUND) {
|
||||
PpiFlags = FLAG_NO_PPI_PROVISION;
|
||||
Status = gRT->SetVariable (
|
||||
PHYSICAL_PRESENCE_FLAGS_VARIABLE,
|
||||
&gEfiPhysicalPresenceGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
sizeof (UINT8),
|
||||
&PpiFlags
|
||||
);
|
||||
PpiFlags = FLAG_NO_PPI_PROVISION;
|
||||
Status = gRT->SetVariable (
|
||||
PHYSICAL_PRESENCE_FLAGS_VARIABLE,
|
||||
&gEfiPhysicalPresenceGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
sizeof (UINT8),
|
||||
&PpiFlags
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((EFI_D_ERROR, "[TPM] Set physical presence flag failed, Status = %r\n", Status));
|
||||
return ;
|
||||
}
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
DEBUG ((EFI_D_ERROR, "[TPM] PpiFlags = %x, Status = %r\n", PpiFlags, Status));
|
||||
DEBUG ((EFI_D_INFO, "[TPM] PpiFlags = %x\n", PpiFlags));
|
||||
|
||||
//
|
||||
// This flags variable controls whether physical presence is required for TPM command.
|
||||
@@ -1205,18 +1209,19 @@ TcgPhysicalPresenceLibProcessRequest (
|
||||
&TcgPpData
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (Status == EFI_NOT_FOUND) {
|
||||
ZeroMem ((VOID*)&TcgPpData, sizeof (TcgPpData));
|
||||
DataSize = sizeof (EFI_PHYSICAL_PRESENCE);
|
||||
Status = gRT->SetVariable (
|
||||
PHYSICAL_PRESENCE_VARIABLE,
|
||||
&gEfiPhysicalPresenceGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
DataSize,
|
||||
&TcgPpData
|
||||
);
|
||||
ZeroMem ((VOID*)&TcgPpData, sizeof (TcgPpData));
|
||||
DataSize = sizeof (EFI_PHYSICAL_PRESENCE);
|
||||
Status = gRT->SetVariable (
|
||||
PHYSICAL_PRESENCE_VARIABLE,
|
||||
&gEfiPhysicalPresenceGuid,
|
||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
DataSize,
|
||||
&TcgPpData
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((EFI_D_ERROR, "[TPM] Set physical presence variable failed, Status = %r\n", Status));
|
||||
return;
|
||||
}
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
DEBUG ((EFI_D_INFO, "[TPM] Flags=%x, PPRequest=%x\n", PpiFlags, TcgPpData.PPRequest));
|
||||
|
Reference in New Issue
Block a user