/** Measure and log EFI handoff tables, and extend the measurement result into PCR[1]. @retval EFI_SUCCESS Operation completed successfully. @retval EFI_DEVICE_ERROR The operation was unsuccessful. **/ EFI_STATUS EFIAPI MeasureHandoffTables ( VOID ) { EFI_STATUS Status; TCG_PCR_EVENT_HDR TcgEvent; EFI_HANDOFF_TABLE_POINTERS HandoffTables; UINTN ProcessorNum; EFI_CPU_PHYSICAL_LOCATION *ProcessorLocBuf; ProcessorLocBuf = NULL; Status = EFI_SUCCESS; if (PcdGet8 (PcdTpmPlatformClass) == TCG_PLATFORM_TYPE_SERVER) { // // Tcg Server spec. // Measure each processor EFI_CPU_PHYSICAL_LOCATION with EV_TABLE_OF_DEVICES to PCR[1] // Status = GetProcessorsCpuLocation(&ProcessorLocBuf, &ProcessorNum); if (!EFI_ERROR(Status)){ TcgEvent.PCRIndex = 1; TcgEvent.EventType = EV_TABLE_OF_DEVICES; TcgEvent.EventSize = sizeof (HandoffTables); HandoffTables.NumberOfTables = 1; HandoffTables.TableEntry[0].VendorGuid = gEfiMpServiceProtocolGuid; HandoffTables.TableEntry[0].VendorTable = ProcessorLocBuf; Status = TcgDxeHashLogExtendEventI ( &mTcgDxeData, (UINT8*)(UINTN)ProcessorLocBuf, sizeof(EFI_CPU_PHYSICAL_LOCATION) * ProcessorNum, &TcgEvent, (UINT8*)&HandoffTables ); FreePool(ProcessorLocBuf); } } return Status; }
/** Measure and log EFI handoff tables, and extend the measurement result into PCR[1]. @retval EFI_SUCCESS Operation completed successfully. @retval EFI_DEVICE_ERROR The operation was unsuccessful. **/ EFI_STATUS EFIAPI MeasureHandoffTables ( VOID ) { EFI_STATUS Status; SMBIOS_TABLE_ENTRY_POINT *SmbiosTable; TCG_PCR_EVENT_HDR TcgEvent; EFI_HANDOFF_TABLE_POINTERS HandoffTables; UINTN ProcessorNum; EFI_CPU_PHYSICAL_LOCATION *ProcessorLocBuf; // // Measure SMBIOS with EV_EFI_HANDOFF_TABLES to PCR[1] // Status = EfiGetSystemConfigurationTable ( &gEfiSmbiosTableGuid, (VOID **) &SmbiosTable ); if (!EFI_ERROR (Status)) { ASSERT (SmbiosTable != NULL); TcgEvent.PCRIndex = 1; TcgEvent.EventType = EV_EFI_HANDOFF_TABLES; TcgEvent.EventSize = sizeof (HandoffTables); HandoffTables.NumberOfTables = 1; HandoffTables.TableEntry[0].VendorGuid = gEfiSmbiosTableGuid; HandoffTables.TableEntry[0].VendorTable = SmbiosTable; DEBUG ((DEBUG_INFO, "The Smbios Table starts at: 0x%x\n", SmbiosTable->TableAddress)); DEBUG ((DEBUG_INFO, "The Smbios Table size: 0x%x\n", SmbiosTable->TableLength)); Status = TcgDxeHashLogExtendEventI ( &mTcgDxeData, (UINT8*)(UINTN)SmbiosTable->TableAddress, SmbiosTable->TableLength, &TcgEvent, (UINT8*)&HandoffTables ); } if (PcdGet8 (PcdTpmPlatformClass) == TCG_PLATFORM_TYPE_SERVER) { // // Tcg Server spec. // Measure each processor EFI_CPU_PHYSICAL_LOCATION with EV_TABLE_OF_DEVICES to PCR[1] // Status = GetProcessorsCpuLocation(&ProcessorLocBuf, &ProcessorNum); if (!EFI_ERROR(Status)) { TcgEvent.PCRIndex = 1; TcgEvent.EventType = EV_TABLE_OF_DEVICES; TcgEvent.EventSize = sizeof (HandoffTables); HandoffTables.NumberOfTables = 1; HandoffTables.TableEntry[0].VendorGuid = gEfiMpServiceProtocolGuid; HandoffTables.TableEntry[0].VendorTable = ProcessorLocBuf; Status = TcgDxeHashLogExtendEventI ( &mTcgDxeData, (UINT8*)(UINTN)ProcessorLocBuf, sizeof(EFI_CPU_PHYSICAL_LOCATION) * ProcessorNum, &TcgEvent, (UINT8*)&HandoffTables ); FreePool(ProcessorLocBuf); } } return Status; }