Revision: 16434
http://sourceforge.net/p/edk2/code/16434
Author: vanjeff
Date: 2014-11-25 07:32:22 +0000 (Tue, 25 Nov 2014)
Log Message:
-----------
Sync patch r16281 from main trunk.
Remove redundant ASSERT in TcgDxe & TreeDxe. Some asserts are removed directly,
some are replaced by debug output.
ASSERT for SetupEventLog is kept. It is the foundation of TcgProtocol and
TrEEProtocol
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <[email protected]>
Reviewed-by: Yao Jiewen <[email protected]>
(cherry picked from commit 2013c26b068bf06b532a93c33cd1824e09d91cd6)
Revision Links:
--------------
http://sourceforge.net/p/edk2/code/16281
Modified Paths:
--------------
branches/UDK2014.SP1/SecurityPkg/Tcg/TcgDxe/TcgDxe.c
branches/UDK2014.SP1/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c
Modified: branches/UDK2014.SP1/SecurityPkg/Tcg/TcgDxe/TcgDxe.c
===================================================================
--- branches/UDK2014.SP1/SecurityPkg/Tcg/TcgDxe/TcgDxe.c 2014-11-25
07:31:26 UTC (rev 16433)
+++ branches/UDK2014.SP1/SecurityPkg/Tcg/TcgDxe/TcgDxe.c 2014-11-25
07:32:22 UTC (rev 16434)
@@ -505,7 +505,10 @@
(UINTN) HashDataLen,
&NewEventHdr->Digest
);
- ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR(Status)) {
+ DEBUG ((DEBUG_ERROR, "TpmCommHashAll Failed. %x\n", Status));
+ return Status;
+ }
}
Status = TpmCommExtend (
@@ -745,9 +748,7 @@
(VOID **) &SmbiosTable
);
- if (!EFI_ERROR (Status)) {
- ASSERT (SmbiosTable != NULL);
-
+ if (!EFI_ERROR (Status) && SmbiosTable != NULL) {
TcgEvent.PCRIndex = 1;
TcgEvent.EventType = EV_EFI_HANDOFF_TABLES;
TcgEvent.EventSize = sizeof (HandoffTables);
@@ -1023,9 +1024,11 @@
if (Status == EFI_NOT_FOUND) {
return EFI_SUCCESS;
}
- ASSERT (BootOrder != NULL);
if (EFI_ERROR (Status)) {
+ //
+ // BootOrder can't be NULL if status is not EFI_NOT_FOUND
+ //
FreePool (BootOrder);
return Status;
}
@@ -1091,14 +1094,18 @@
Status = TcgMeasureAction (
EFI_CALLING_EFI_APPLICATION
);
- ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "%s not Measured. Error!\n",
EFI_CALLING_EFI_APPLICATION));
+ }
//
// 2. Draw a line between pre-boot env and entering post-boot env.
//
for (PcrIndex = 0; PcrIndex < 8; PcrIndex++) {
Status = MeasureSeparatorEvent (PcrIndex);
- ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Seperator Event not Measured. Error!\n"));
+ }
}
//
@@ -1119,7 +1126,9 @@
Status = TcgMeasureAction (
EFI_RETURNING_FROM_EFI_APPLICATOIN
);
- ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "%s not Measured. Error!\n",
EFI_RETURNING_FROM_EFI_APPLICATOIN));
+ }
}
DEBUG ((EFI_D_INFO, "TPM TcgDxe Measure Data when ReadyToBoot\n"));
@@ -1198,7 +1207,10 @@
&TableKey
);
}
- ASSERT_EFI_ERROR (Status);
+
+ if (EFI_ERROR (Status)) {
+ DEBUG((EFI_D_ERROR, "Tcg Acpi Table installation failure"));
+ }
}
/**
@@ -1225,7 +1237,9 @@
Status = TcgMeasureAction (
EFI_EXIT_BOOT_SERVICES_INVOCATION
);
- ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "%s not Measured. Error!\n",
EFI_EXIT_BOOT_SERVICES_INVOCATION));
+ }
//
// Measure success of ExitBootServices
@@ -1233,7 +1247,9 @@
Status = TcgMeasureAction (
EFI_EXIT_BOOT_SERVICES_SUCCEEDED
);
- ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)){
+ DEBUG ((EFI_D_ERROR, "%s not Measured. Error!\n",
EFI_EXIT_BOOT_SERVICES_SUCCEEDED));
+ }
}
/**
@@ -1260,8 +1276,9 @@
Status = TcgMeasureAction (
EFI_EXIT_BOOT_SERVICES_FAILED
);
- ASSERT_EFI_ERROR (Status);
-
+ if (EFI_ERROR (Status)){
+ DEBUG ((EFI_D_ERROR, "%s not Measured. Error!\n",
EFI_EXIT_BOOT_SERVICES_FAILED));
+ }
}
/**
Modified: branches/UDK2014.SP1/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c
===================================================================
--- branches/UDK2014.SP1/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c 2014-11-25
07:31:26 UTC (rev 16433)
+++ branches/UDK2014.SP1/SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c 2014-11-25
07:32:22 UTC (rev 16434)
@@ -1109,9 +1109,7 @@
(VOID **) &SmbiosTable
);
- if (!EFI_ERROR (Status)) {
- ASSERT (SmbiosTable != NULL);
-
+ if (!EFI_ERROR (Status) && SmbiosTable != NULL) {
TcgEvent.PCRIndex = 1;
TcgEvent.EventType = EV_EFI_HANDOFF_TABLES;
TcgEvent.EventSize = sizeof (HandoffTables);
@@ -1225,8 +1223,6 @@
UINTN VarNameLength;
EFI_VARIABLE_DATA_TREE *VarLog;
- ASSERT ((VarSize == 0 && VarData == NULL) || (VarSize != 0 && VarData !=
NULL));
-
DEBUG ((EFI_D_ERROR, "TrEEDxe: MeasureVariable (Pcr - %x, EventType - %x, ",
(UINTN)PCRIndex, (UINTN)EventType));
DEBUG ((EFI_D_ERROR, "VariableName - %s, VendorGuid - %g)\n", VarName,
VendorGuid));
@@ -1318,10 +1314,12 @@
*VarSize = 0;
}
} else {
+ //
+ // if status error, VarData is freed and set NULL by GetVariable2
+ //
if (EFI_ERROR (Status)) {
- return Status;
+ return EFI_NOT_FOUND;
}
- ASSERT (*VarData != NULL);
}
Status = MeasureVariable (
@@ -1428,9 +1426,11 @@
if (Status == EFI_NOT_FOUND) {
return EFI_SUCCESS;
}
- ASSERT (BootOrder != NULL);
if (EFI_ERROR (Status)) {
+ //
+ // BootOrder can't be NULL if status is not EFI_NOT_FOUND
+ //
FreePool (BootOrder);
return Status;
}
@@ -1721,7 +1721,10 @@
&TableKey
);
}
- ASSERT_EFI_ERROR (Status);
+
+ if (EFI_ERROR (Status)) {
+ DEBUG((EFI_D_ERROR, "Tcg Acpi Table installation failure"));
+ }
}
/**
@@ -1748,7 +1751,9 @@
Status = TcgMeasureAction (
EFI_EXIT_BOOT_SERVICES_INVOCATION
);
- ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "%s not Measured. Error!\n",
EFI_EXIT_BOOT_SERVICES_INVOCATION));
+ }
//
// Measure success of ExitBootServices
@@ -1756,7 +1761,9 @@
Status = TcgMeasureAction (
EFI_EXIT_BOOT_SERVICES_SUCCEEDED
);
- ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "%s not Measured. Error!\n",
EFI_EXIT_BOOT_SERVICES_SUCCEEDED));
+ }
}
/**
@@ -1783,7 +1790,9 @@
Status = TcgMeasureAction (
EFI_EXIT_BOOT_SERVICES_FAILED
);
- ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "%s not Measured. Error!\n",
EFI_EXIT_BOOT_SERVICES_FAILED));
+ }
}
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits