SecurityPkg: Tcg2Dxe: Use UEFI_VARIABLE_DATA

Use UEFI_VARIABLE_DATA data structure according to TCG PC-Client PFP Spec
00.21.
http://www.trustedcomputinggroup.org/wp-content/uploads/PC-ClientSpecific_Platform_Profile_for_TPM_2p0_Systems_v21.pdf

Cc: Star Zeng <star.zeng@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
This commit is contained in:
Zhang, Chao B 2017-01-24 15:31:23 +08:00
parent 1de3b7fdb1
commit 9d77acf156
2 changed files with 8 additions and 9 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
Measure TrEE required variable. Measure TCG required variable.
Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR> Copyright (c) 2013 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -15,7 +15,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <PiDxe.h> #include <PiDxe.h>
#include <Guid/ImageAuthentication.h> #include <Guid/ImageAuthentication.h>
#include <IndustryStandard/UefiTcgPlatform.h> #include <IndustryStandard/UefiTcgPlatform.h>
#include <Protocol/TrEEProtocol.h>
#include <Library/UefiBootServicesTableLib.h> #include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h> #include <Library/UefiRuntimeServicesTableLib.h>
@ -230,18 +229,18 @@ MeasureVariable (
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINTN VarNameLength; UINTN VarNameLength;
EFI_VARIABLE_DATA_TREE *VarLog; UEFI_VARIABLE_DATA *VarLog;
UINT32 VarLogSize; UINT32 VarLogSize;
// //
// The EFI_VARIABLE_DATA_TREE.VariableData value shall be the EFI_SIGNATURE_DATA value // The UEFI_VARIABLE_DATA.VariableData value shall be the EFI_SIGNATURE_DATA value
// from the EFI_SIGNATURE_LIST that contained the authority that was used to validate the image // from the EFI_SIGNATURE_LIST that contained the authority that was used to validate the image
// //
VarNameLength = StrLen (VarName); VarNameLength = StrLen (VarName);
VarLogSize = (UINT32)(sizeof (*VarLog) + VarNameLength * sizeof (*VarName) + VarSize VarLogSize = (UINT32)(sizeof (*VarLog) + VarNameLength * sizeof (*VarName) + VarSize
- sizeof (VarLog->UnicodeName) - sizeof (VarLog->VariableData)); - sizeof (VarLog->UnicodeName) - sizeof (VarLog->VariableData));
VarLog = (EFI_VARIABLE_DATA_TREE *) AllocateZeroPool (VarLogSize); VarLog = (UEFI_VARIABLE_DATA *) AllocateZeroPool (VarLogSize);
if (VarLog == NULL) { if (VarLog == NULL) {
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
} }

View File

@ -1787,7 +1787,7 @@ MeasureVariable (
EFI_STATUS Status; EFI_STATUS Status;
TCG_PCR_EVENT_HDR TcgEvent; TCG_PCR_EVENT_HDR TcgEvent;
UINTN VarNameLength; UINTN VarNameLength;
EFI_VARIABLE_DATA_TREE *VarLog; UEFI_VARIABLE_DATA *VarLog;
DEBUG ((EFI_D_INFO, "Tcg2Dxe: MeasureVariable (Pcr - %x, EventType - %x, ", (UINTN)PCRIndex, (UINTN)EventType)); DEBUG ((EFI_D_INFO, "Tcg2Dxe: MeasureVariable (Pcr - %x, EventType - %x, ", (UINTN)PCRIndex, (UINTN)EventType));
DEBUG ((EFI_D_INFO, "VariableName - %s, VendorGuid - %g)\n", VarName, VendorGuid)); DEBUG ((EFI_D_INFO, "VariableName - %s, VendorGuid - %g)\n", VarName, VendorGuid));
@ -1799,7 +1799,7 @@ MeasureVariable (
TcgEvent.EventSize = (UINT32)(sizeof (*VarLog) + VarNameLength * sizeof (*VarName) + VarSize TcgEvent.EventSize = (UINT32)(sizeof (*VarLog) + VarNameLength * sizeof (*VarName) + VarSize
- sizeof (VarLog->UnicodeName) - sizeof (VarLog->VariableData)); - sizeof (VarLog->UnicodeName) - sizeof (VarLog->VariableData));
VarLog = (EFI_VARIABLE_DATA_TREE *)AllocatePool (TcgEvent.EventSize); VarLog = (UEFI_VARIABLE_DATA *)AllocatePool (TcgEvent.EventSize);
if (VarLog == NULL) { if (VarLog == NULL) {
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
} }
@ -1822,7 +1822,7 @@ MeasureVariable (
if (EventType == EV_EFI_VARIABLE_DRIVER_CONFIG) { if (EventType == EV_EFI_VARIABLE_DRIVER_CONFIG) {
// //
// Digest is the event data (EFI_VARIABLE_DATA) // Digest is the event data (UEFI_VARIABLE_DATA)
// //
Status = TcgDxeHashLogExtendEvent ( Status = TcgDxeHashLogExtendEvent (
0, 0,