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: case EvConstants.EV_EFI_EVENT_BASE:
break; break;
case EvConstants.EV_EFI_VARIABLE_DRIVER_CONFIG: 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_BOOT:
case EvConstants.EV_EFI_VARIABLE_AUTHORITY: case EvConstants.EV_EFI_VARIABLE_AUTHORITY:
case EvConstants.EV_EFI_SPDM_DEVICE_POLICY: case EvConstants.EV_EFI_SPDM_DEVICE_POLICY:
@ -503,26 +490,19 @@ public class TpmPcrEvent {
case EvConstants.EV_EFI_EVENT_BASE: case EvConstants.EV_EFI_EVENT_BASE:
break; break;
case EvConstants.EV_EFI_VARIABLE_DRIVER_CONFIG: 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_BOOT:
case EvConstants.EV_EFI_VARIABLE_AUTHORITY: case EvConstants.EV_EFI_VARIABLE_AUTHORITY:
case EvConstants.EV_EFI_SPDM_DEVICE_POLICY: case EvConstants.EV_EFI_SPDM_DEVICE_POLICY:
case EvConstants.EV_EFI_SPDM_DEVICE_AUTHORITY: case EvConstants.EV_EFI_SPDM_DEVICE_AUTHORITY:
UefiVariable efiVar2 = new UefiVariable(content); UefiVariable efiVar = new UefiVariable(content);
description += "Event Content:\n" + efiVar2.toString(); description += "Event Content:\n" + efiVar.toString();
vendorTableFileStatus = efiVar2.getVendorTableFileStatus(); vendorTableFileStatus = efiVar.getVendorTableFileStatus();
break; break;
case EvConstants.EV_EFI_BOOT_SERVICES_APPLICATION: case EvConstants.EV_EFI_BOOT_SERVICES_APPLICATION:
case EvConstants.EV_EFI_BOOT_SERVICES_DRIVER:
EvEfiBootServicesApp bootServices = new EvEfiBootServicesApp(content); EvEfiBootServicesApp bootServices = new EvEfiBootServicesApp(content);
description += "Event Content:\n" + bootServices.toString(); description += "Event Content:\n" + bootServices.toString();
break; 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: case EvConstants.EV_EFI_RUNTIME_SERVICES_DRIVER:
break; break;
case EvConstants.EV_EFI_GPT_EVENT: case EvConstants.EV_EFI_GPT_EVENT:
@ -542,8 +522,6 @@ public class TpmPcrEvent {
case EvConstants.EV_EFI_HCRTM_EVENT: case EvConstants.EV_EFI_HCRTM_EVENT:
break; break;
case EvConstants.EV_EFI_SPDM_FIRMWARE_BLOB: case EvConstants.EV_EFI_SPDM_FIRMWARE_BLOB:
description += "Event Content:\n" + new EvEfiSpdmDeviceSecurityEvent(content).toString();
break;
case EvConstants.EV_EFI_SPDM_FIRMWARE_CONFIG: case EvConstants.EV_EFI_SPDM_FIRMWARE_CONFIG:
description += "Event Content:\n" + new EvEfiSpdmDeviceSecurityEvent(content).toString(); description += "Event Content:\n" + new EvEfiSpdmDeviceSecurityEvent(content).toString();
break; break;

View File

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

View File

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