consolidated a few case statements in TpmPcrEvent

This commit is contained in:
iadgovuser58 2024-08-09 13:20:26 -04:00
parent 6721b9502b
commit 1324edcfcb
3 changed files with 26 additions and 48 deletions

View File

@ -318,19 +318,6 @@ public class TpmPcrEvent {
case EvConstants.EV_EFI_EVENT_BASE:
break;
case EvConstants.EV_EFI_VARIABLE_DRIVER_CONFIG:
try {
sb.append(new UefiVariable(eventContent).toString());
} catch (CertificateException cEx) {
log.error(cEx);
sb.append(cEx.toString());
} catch (NoSuchAlgorithmException noSaEx) {
log.error(noSaEx);
sb.append(noSaEx.toString());
} catch (IOException ioEx) {
log.error(ioEx);
sb.append(ioEx.toString());
}
break;
case EvConstants.EV_EFI_VARIABLE_BOOT:
case EvConstants.EV_EFI_VARIABLE_AUTHORITY:
case EvConstants.EV_EFI_SPDM_DEVICE_POLICY:
@ -503,26 +490,19 @@ public class TpmPcrEvent {
case EvConstants.EV_EFI_EVENT_BASE:
break;
case EvConstants.EV_EFI_VARIABLE_DRIVER_CONFIG:
UefiVariable efiVar = new UefiVariable(content);
description += "Event Content:\n" + efiVar.toString();
vendorTableFileStatus = efiVar.getVendorTableFileStatus();
break;
case EvConstants.EV_EFI_VARIABLE_BOOT:
case EvConstants.EV_EFI_VARIABLE_AUTHORITY:
case EvConstants.EV_EFI_SPDM_DEVICE_POLICY:
case EvConstants.EV_EFI_SPDM_DEVICE_AUTHORITY:
UefiVariable efiVar2 = new UefiVariable(content);
description += "Event Content:\n" + efiVar2.toString();
vendorTableFileStatus = efiVar2.getVendorTableFileStatus();
UefiVariable efiVar = new UefiVariable(content);
description += "Event Content:\n" + efiVar.toString();
vendorTableFileStatus = efiVar.getVendorTableFileStatus();
break;
case EvConstants.EV_EFI_BOOT_SERVICES_APPLICATION:
case EvConstants.EV_EFI_BOOT_SERVICES_DRIVER:
EvEfiBootServicesApp bootServices = new EvEfiBootServicesApp(content);
description += "Event Content:\n" + bootServices.toString();
break;
case EvConstants.EV_EFI_BOOT_SERVICES_DRIVER: // same as EV_EFI_BOOT_SERVICES_APP
EvEfiBootServicesApp bootDriver = new EvEfiBootServicesApp(content);
description += "Event Content:\n" + bootDriver.toString();
break;
case EvConstants.EV_EFI_RUNTIME_SERVICES_DRIVER:
break;
case EvConstants.EV_EFI_GPT_EVENT:
@ -542,8 +522,6 @@ public class TpmPcrEvent {
case EvConstants.EV_EFI_HCRTM_EVENT:
break;
case EvConstants.EV_EFI_SPDM_FIRMWARE_BLOB:
description += "Event Content:\n" + new EvEfiSpdmDeviceSecurityEvent(content).toString();
break;
case EvConstants.EV_EFI_SPDM_FIRMWARE_CONFIG:
description += "Event Content:\n" + new EvEfiSpdmDeviceSecurityEvent(content).toString();
break;

View File

@ -69,25 +69,25 @@ public class EvEfiSpdmDeviceSecurityEvent {
spdmInfo = " Signature = SPDM Device Sec2\n";
if (dsedVersion.equals("0200")) {
dsed = new DeviceSecurityEventData2(eventData);
spdmInfo += dsed.toString();
}
else {
spdmInfo += " Incompatible version for DeviceSecurityEventData2: " + dsedVersion + "\n";
}
// if (dsedVersion.equals("0200")) {
// dsed = new DeviceSecurityEventData2(eventData);
// spdmInfo += dsed.toString();
// }
// else {
// spdmInfo += " Incompatible version for DeviceSecurityEventData2: " + dsedVersion + "\n";
// }
}
else if (dsedSignature.contains("SPDM Device Sec")) { // implies Device Security event
spdmInfo = " Signature = SPDM Device Sec\n";
if (dsedVersion.equals("0100")) {
dsed = new DeviceSecurityEventData(eventData);
spdmInfo += dsed.toString();
}
else {
spdmInfo += " Incompatible version for DeviceSecurityEventData: " + dsedVersion + "\n";
}
// if (dsedVersion.equals("0100")) {
// dsed = new DeviceSecurityEventData(eventData);
// spdmInfo += dsed.toString();
// }
// else {
// spdmInfo += " Incompatible version for DeviceSecurityEventData: " + dsedVersion + "\n";
// }
}
else {
spdmInfo = " Signature = Undetermined value: " + dsedSignature + "\n";

View File

@ -81,14 +81,14 @@ public class NvIndexInstanceEventLogData {
nvIndexInstanceInfo += " Signature = SPDM Device Sec2\n";
if (dsedVersion.equals("0200")) {
dsed = new DeviceSecurityEventData2(dsedEventData);
nvIndexInstanceInfo += dsed.toString();
}
else {
nvIndexInstanceInfo += " Incompatible version for DeviceSecurityEventData2: "
+ dsedVersion + "\n";
}
// if (dsedVersion.equals("0200")) {
// dsed = new DeviceSecurityEventData2(dsedEventData);
// nvIndexInstanceInfo += dsed.toString();
// }
// else {
// nvIndexInstanceInfo += " Incompatible version for DeviceSecurityEventData2: "
// + dsedVersion + "\n";
// }
}
else {
nvIndexInstanceInfo = " Signature error: should be \'SPDM Device Sec2\' but is "