diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataPciContext.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataPciContext.java index 4f16a1e5..ff90af3d 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataPciContext.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataPciContext.java @@ -3,7 +3,6 @@ package hirs.utils.tpm.eventlog.events; import hirs.utils.HexUtils; import lombok.Getter; -import java.util.ArrayList; import java.util.List; import static hirs.utils.PciIds.translateDevice; @@ -102,7 +101,6 @@ public class DeviceSecurityEventDataPciContext extends DeviceSecurityEventDataDe byte[] pciSubsystemIdBytes = new byte[2]; System.arraycopy(dSEDpciContextBytes, 14, pciSubsystemIdBytes, 0, 2); subsystemId = HexUtils.byteArrayToHexString(HexUtils.leReverseByte(pciSubsystemIdBytes)); - } /** @@ -114,22 +112,22 @@ public class DeviceSecurityEventDataPciContext extends DeviceSecurityEventDataDe String dSEDpciContextInfo = ""; dSEDpciContextInfo += super.toString(); - dSEDpciContextInfo += "\n Device Type = PCI"; - dSEDpciContextInfo += "\n Vendor = " + translateVendor(vendorId); - dSEDpciContextInfo += "\n Device = " + translateDevice(vendorId, deviceId); - dSEDpciContextInfo += "\n RevisionID = " + revisionId; + dSEDpciContextInfo += " Device Type = PCI\n"; + dSEDpciContextInfo += " Vendor = " + translateVendor(vendorId) + "\n"; + dSEDpciContextInfo += " Device = " + translateDevice(vendorId, deviceId) + "\n"; + dSEDpciContextInfo += " RevisionID = " + revisionId + "\n"; List classCodeList = translateDeviceClass(classCode); - dSEDpciContextInfo += "\n Device Class: "; + dSEDpciContextInfo += " Device Class: \n"; if(classCodeList.size() == 3) { - dSEDpciContextInfo += "\n Class = " + classCodeList.get(0); - dSEDpciContextInfo += "\n Subclass = " + classCodeList.get(1); - dSEDpciContextInfo += "\n Programming Interface = " + classCodeList.get(2); + dSEDpciContextInfo += " Class = " + classCodeList.get(0) + "\n"; + dSEDpciContextInfo += " Subclass = " + classCodeList.get(1) + "\n"; + dSEDpciContextInfo += " Programming Interface = " + classCodeList.get(2) + "\n"; } else { dSEDpciContextInfo += " ** Class code could not be determined **"; } - dSEDpciContextInfo += "\n SubsystemVendor = " + translateVendor(subsystemVendorId); - dSEDpciContextInfo += "\n Subsystem = " + translateDevice(subsystemVendorId, subsystemId); + dSEDpciContextInfo += " SubsystemVendor = " + translateVendor(subsystemVendorId) + "\n"; + dSEDpciContextInfo += " Subsystem = " + translateDevice(subsystemVendorId, subsystemId) + "\n"; return dSEDpciContextInfo; } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventHeader.java index 5e60f607..5d2696b6 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventHeader.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventHeader.java @@ -5,7 +5,6 @@ import hirs.utils.tpm.eventlog.uefi.UefiConstants; import hirs.utils.tpm.eventlog.uefi.UefiDevicePath; import lombok.Getter; -import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; /** @@ -84,34 +83,9 @@ public abstract class DeviceSecurityEventHeader { */ @Getter private UefiDevicePath devicePath = null; - /** - * Is the Device Path Valid. - */ - private boolean devicePathValid = false; /** - * Device Security Event Data Device Type = no device type. - */ - public static final int DEVICE_TYPE_NONE = 0; - /** - * Device Security Event Data Device Type = DEVICE_TYPE_PCI. - */ - public static final int DEVICE_TYPE_PCI = 1; - /** - * Device Security Event Data Device Type = DEVICE_TYPE_USB. - */ - public static final int DEVICE_TYPE_USB = 2; - - - /** - * DeviceSecurityEventDataHeaderBase Default Constructor. - */ - public DeviceSecurityEventHeader() { - - } - - /** - * DeviceSecurityEventDataHeaderBase Constructor. + * DeviceSecurityEventDataHeader Constructor. * * @param dSEDbytes byte array holding the DeviceSecurityEventData. */ @@ -126,7 +100,6 @@ public abstract class DeviceSecurityEventHeader { System.arraycopy(dSEDbytes, UefiConstants.OFFSET_16, versionBytes, 0, UefiConstants.SIZE_2); version = HexUtils.byteArrayToHexString(versionBytes); - } /** @@ -154,24 +127,17 @@ public abstract class DeviceSecurityEventHeader { public void extractDevicePathAndFinalSize(final byte[] dsedBytes, int startByte) { // get the device path length - byte[] devicePathLengthBytes = new byte[UefiConstants.SIZE_8]; - System.arraycopy(dsedBytes, startByte, devicePathLengthBytes, 0, - UefiConstants.SIZE_8); + byte[] devicePathLengthBytes = new byte[8]; + System.arraycopy(dsedBytes, startByte, devicePathLengthBytes, 0, 8); int devicePathLength = HexUtils.leReverseInt(devicePathLengthBytes); // get the device path - if (devicePathLength != 0) { - startByte = startByte + UefiConstants.SIZE_8; + if (devicePathLength > 0) { + startByte = startByte + 8; byte[] devPathBytes = new byte[devicePathLength]; System.arraycopy(dsedBytes, startByte, devPathBytes, 0, devicePathLength); - try { - devicePath = new UefiDevicePath(devPathBytes); - devicePathValid = true; - } - catch (UnsupportedEncodingException e) { - devicePathValid = false; - } + devicePath = new UefiDevicePath(devPathBytes); } // header total size @@ -187,11 +153,11 @@ public abstract class DeviceSecurityEventHeader { */ public String deviceTypeToString(final int deviceTypeInt) { switch (deviceTypeInt) { - case DEVICE_TYPE_NONE: + case DeviceSecurityEventDataDeviceContext.DEVICE_TYPE_NONE: return "No device type"; - case DEVICE_TYPE_PCI: + case DeviceSecurityEventDataDeviceContext.DEVICE_TYPE_PCI: return "PCI"; - case DEVICE_TYPE_USB: + case DeviceSecurityEventDataDeviceContext.DEVICE_TYPE_USB: return "USB"; default: return "Unknown or invalid Device Type"; @@ -206,13 +172,13 @@ public abstract class DeviceSecurityEventHeader { public String toString() { String dsedHeaderCommonInfo = ""; - dsedHeaderCommonInfo += "\n SPDM Device Type = " + deviceTypeToString(deviceType); - if (devicePathValid) { - dsedHeaderCommonInfo += "\n SPDM Device Path:\n"; + dsedHeaderCommonInfo += " SPDM Device Type = " + deviceTypeToString(deviceType) + "\n"; + if (devicePath != null) { + dsedHeaderCommonInfo += " SPDM Device Path:\n"; dsedHeaderCommonInfo += devicePath; } else { - dsedHeaderCommonInfo += "\n SPDM Device Path = Unknown or invalid"; + dsedHeaderCommonInfo += " SPDM Device Path = Unknown or invalid\n"; } return dsedHeaderCommonInfo; diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiDevicePath.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiDevicePath.java index bd647deb..879e27f8 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiDevicePath.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiDevicePath.java @@ -3,12 +3,23 @@ package hirs.utils.tpm.eventlog.uefi; import hirs.utils.HexUtils; import lombok.Getter; -import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; /** - * Class to process EFI_DEVICE_PATH_PROTOCOL which is referred to as the UEFI_DEVICE_PATH + * Class to process a Device Path. A Device Path is a variable-length binary + * structure that is made up of variable-length generic Device Path nodes. + * The first Device Path node starts at byte offset zero of the Device Path. + * The next Device Path node starts at the end of the previous Device Path node. + * There is no limit to the number, type, or sequence of nodes in a Device Path. *

+ * Generic Device Path Node Structure: + * Name Byte Offset Byte Length Description + * Type 0 1 Device path type (such as 0x01 - Hardware Device Path) + * Sub-Type 1 1 Sub-Type + * Length 2 2 Length of this structure in bytes. Length is 4+n bytes + * Data 4 n Specific Device Path data + *

+ * EFI_DEVICE_PATH_PROTOCOL: * #define EFI_DEVICE_PATH_PROTOCOL_GUID \09576e91-6d3f-11d2-8e39-00a0c969723b * typedef struct _EFI_DEVICE_PATH_PROTOCOL { * UINT8 Type; @@ -23,7 +34,7 @@ import java.nio.charset.StandardCharsets; * Type 0x04 Media Device Path * Type 0x05 BIOS Boot Specification Device Path * Type 0x7F End of Hardware Device Path - * Each Type has a sub-type that may or may no be defined in the section + * Each Type has a Subtype that may or may not be defined in the section *

* Only a few of the SubTypes have been implemented as there are many, * but only those that were reported using the test devices at hand. @@ -36,11 +47,11 @@ public class UefiDevicePath { @Getter private String type = ""; /** - * UEFI Device path sub-type. + * UEFI Device path subtype. */ private String subType = ""; /** - * UEFI Device path human readable description. + * UEFI Device path human-readable description. */ private String devPathInfo = ""; /** @@ -53,9 +64,8 @@ public class UefiDevicePath { * UEFI Device path constructor. * * @param path byte array holding device path data - * @throws java.io.UnsupportedEncodingException if path byte array contains unexpected values */ - public UefiDevicePath(final byte[] path) throws UnsupportedEncodingException { + public UefiDevicePath(final byte[] path) { devPathInfo = processDevPath(path); byte[] lengthBytes = new byte[UefiConstants.SIZE_2]; System.arraycopy(path, UefiConstants.OFFSET_2, lengthBytes, 0, UefiConstants.OFFSET_2); @@ -63,9 +73,9 @@ public class UefiDevicePath { } /** - * Returns the UEFI device sub-type. + * Returns the UEFI device subtype. * - * @return uefi sub-type + * @return uefi subtype */ public String getSubType() { return subType.trim(); @@ -81,7 +91,7 @@ public class UefiDevicePath { * @return Human readable string containing the device path description. * @throws java.io.UnsupportedEncodingException */ - private String processDevPath(final byte[] path) throws UnsupportedEncodingException { + private String processDevPath(final byte[] path) { StringBuilder pInfo = new StringBuilder(); int devLength = 0, pathOffset = 0, devCount = 0; while (true) { @@ -90,9 +100,6 @@ public class UefiDevicePath { || (devPath.intValue() == UefiConstants.END_FLAG)) { break; } - if (devCount++ > 0) { - pInfo.append("\n"); - } pInfo.append(processDev(path, pathOffset)); devLength = path[pathOffset + UefiConstants.OFFSET_3] * UefiConstants.SIZE_256 + path[pathOffset + UefiConstants.OFFSET_2]; @@ -111,11 +118,10 @@ public class UefiDevicePath { * * @param path * @param offset - * @return human readable string representing the UEFI device path + * @return human-readable string representing the UEFI device path * @throws java.io.UnsupportedEncodingException */ - private String processDev(final byte[] path, final int offset) - throws UnsupportedEncodingException { + private String processDev(final byte[] path, final int offset) { String devInfo = " "; int devPath = path[offset]; byte unknownSubType = path[offset + UefiConstants.OFFSET_1]; @@ -123,50 +129,50 @@ public class UefiDevicePath { case UefiConstants.DEV_HW: type = "Hardware Device Path"; if (devPath == UefiConstants.DEVPATH_HARWARE) { - devInfo += type + ": " + pciSubType(path, offset); + devInfo += type + ":\n" + pciSubType(path, offset); } break; case UefiConstants.DEV_ACPI: type = "ACPI Device Path"; - devInfo += type + ": " + acpiSubType(path, offset); + devInfo += type + ":\n" + acpiSubType(path, offset); break; case UefiConstants.DEV_MSG: type = "Messaging Device Path"; if (path[offset + UefiConstants.OFFSET_1] == UefiConstants.DEV_SUB_SATA) { - devInfo += type + ": " + sataSubType(path, offset); + devInfo += type + ":\n" + sataSubType(path, offset); } else if (path[offset + UefiConstants.OFFSET_1] == UefiConstants.DEV_SUB_NVM) { - devInfo += type + ": " + nvmSubType(path, offset); + devInfo += type + ":\n" + nvmSubType(path, offset); } else if (path[offset + UefiConstants.OFFSET_1] == UefiConstants.DEV_SUB_USB) { - devInfo += type + ": " + usbSubType(path, offset); + devInfo += type + ":\n" + usbSubType(path, offset); } else { - devInfo += "UEFI Messaging Device Path Type " + Integer.valueOf(unknownSubType); + devInfo += "UEFI Messaging Device Path Type " + Integer.valueOf(unknownSubType) + "\n"; } break; case UefiConstants.DEV_MEDIA: type = "Media Device Path"; if (path[offset + UefiConstants.OFFSET_1] == 0x01) { - devInfo += type + ": " + hardDriveSubType(path, offset); + devInfo += type + ":\n" + hardDriveSubType(path, offset); } else if (path[offset + UefiConstants.OFFSET_1] == UefiConstants.DEVPATH_VENDOR) { - devInfo += type + ": " + vendorSubType(path, offset); + devInfo += type + ":\n" + vendorSubType(path, offset); } else if (path[offset + UefiConstants.OFFSET_1] == UefiConstants.DEVPATH_FILE) { - devInfo += type + ": " + filePathSubType(path, offset); + devInfo += type + ":\n" + filePathSubType(path, offset); } else if (path[offset + UefiConstants.OFFSET_1] == UefiConstants.DEVPATH_PWIG_FILE) { - devInfo += type + ": " + piwgFirmVolFile(path, offset); + devInfo += type + ":\n" + piwgFirmVolFile(path, offset); } else if (path[offset + UefiConstants.OFFSET_1] == UefiConstants.DEVPATH_PWIG_VOL) { - devInfo += type + ": " + piwgFirmVolPath(path, offset); + devInfo += type + ":\n" + piwgFirmVolPath(path, offset); } else { - devInfo += "UEFI Media Device Path Type " + Integer.valueOf(unknownSubType); + devInfo += "UEFI Media Device Path Type " + Integer.valueOf(unknownSubType) + "\n"; } break; case UefiConstants.DEV_BIOS: type = "BIOS Device Path"; - devInfo += type + ": " + biosDevicePath(path, offset); + devInfo += type + ":\n" + biosDevicePath(path, offset); break; case UefiConstants.TERMINATOR: - devInfo += "End of Hardware Device Path"; + devInfo += "End of Hardware Device Path\n"; break; default: - devInfo += "UEFI Device Path Type " + Integer.valueOf(unknownSubType); + devInfo += "UEFI Device Path Type " + Integer.valueOf(unknownSubType) + "\n"; } return devInfo; } @@ -179,17 +185,17 @@ public class UefiDevicePath { * @return acpi device info */ private String acpiSubType(final byte[] path, final int offset) { - subType = ""; + subType = " Sub Type = ACPI\n"; switch (path[offset + UefiConstants.OFFSET_1]) { - case 0x01: - subType = "(Short): "; + case 0x01: // standard version subType += acpiShortSubType(path, offset); break; case 0x02: - subType = "Expanded ACPI Device Path"; + subType = "(expanded version):\n"; + // tbd break; default: - subType = "Invalid ACPI Device Path sub type"; + subType = "Invalid ACPI Device Path sub type\n"; } return subType; } @@ -205,9 +211,13 @@ public class UefiDevicePath { subType = ""; byte[] hid = new byte[UefiConstants.SIZE_4]; System.arraycopy(path, UefiConstants.OFFSET_4 + offset, hid, 0, UefiConstants.SIZE_4); - subType += "_HID = " + HexUtils.byteArrayToHexString(hid); + subType += " _HID = " + HexUtils.byteArrayToHexString(hid) + "\n"; System.arraycopy(path, 2 * UefiConstants.SIZE_4 + offset, hid, 0, UefiConstants.SIZE_4); - subType += "_UID = " + HexUtils.byteArrayToHexString(hid); + String uid = HexUtils.byteArrayToHexString(hid); + if(uid.contains("00000000")) { + uid = "No _UID exists for this device"; + } + subType += " _UID = " + uid + "\n"; return subType; } @@ -219,22 +229,25 @@ public class UefiDevicePath { * @return pci device info. */ private String pciSubType(final byte[] path, final int offset) { - subType = "PCI: PCI Function Number = "; + subType = " Sub Type = PCI\n"; + subType += " PCI Function Number = "; subType += String.format("0x%x", path[offset + UefiConstants.SIZE_4]); - subType += " PCI Device Number = "; + subType += "\n PCI Device Number = "; subType += String.format("0x%x", path[offset + UefiConstants.SIZE_5]); + subType += "\n"; return subType; } /** - * processes the SATA sub type. + * processes the SATA subtype. * * @param path * @param offset * @return SATA drive info. */ private String sataSubType(final byte[] path, final int offset) { - subType = "SATA: HBA Port Number = "; + subType = " Sub Type = SATA\n"; + subType += " SATA: HBA Port Number = "; byte[] data = new byte[UefiConstants.SIZE_2]; System.arraycopy(path, UefiConstants.OFFSET_4 + offset, data, 0, UefiConstants.SIZE_2); subType += HexUtils.byteArrayToHexString(data); @@ -242,18 +255,20 @@ public class UefiDevicePath { subType += " Port Multiplier = " + HexUtils.byteArrayToHexString(data); System.arraycopy(path, UefiConstants.OFFSET_8 + offset, data, 0, UefiConstants.SIZE_2); subType += " Logical Unit Number = " + HexUtils.byteArrayToHexString(data); + subType += "\n"; return subType; } /** - * Processes the hard drive sub type. + * Processes the hard drive subtype. * * @param path * @param offset * @return hard drive info. */ private String hardDriveSubType(final byte[] path, final int offset) { - subType = "Partition Number = "; + subType = " Sub Type = Hard Drive\n"; + subType += " Partition Number = "; byte[] partnumber = new byte[UefiConstants.SIZE_4]; System.arraycopy(path, UefiConstants.OFFSET_4 + offset, partnumber, 0, UefiConstants.SIZE_4); @@ -261,14 +276,14 @@ public class UefiDevicePath { byte[] data = new byte[UefiConstants.SIZE_8]; System.arraycopy(path, UefiConstants.OFFSET_8 + offset, data, 0, UefiConstants.SIZE_8); - subType += " Partition Start = " + HexUtils.byteArrayToHexString(data); + subType += "\n Partition Start = " + HexUtils.byteArrayToHexString(data); System.arraycopy(path, UefiConstants.OFFSET_16 + offset, data, 0, UefiConstants.SIZE_8); - subType += " Partition Size = " + HexUtils.byteArrayToHexString(data); + subType += "\n Partition Size = " + HexUtils.byteArrayToHexString(data); byte[] signature = new byte[UefiConstants.SIZE_16]; System.arraycopy(path, UefiConstants.OFFSET_24 + offset, signature, 0, UefiConstants.SIZE_16); - subType += "\n Partition Signature = "; + subType += "\n Partition Signature = "; if (path[UefiConstants.OFFSET_41 + offset] == UefiConstants.DRIVE_SIG_NONE) { subType += "None"; } else if (path[UefiConstants.OFFSET_41 + offset] == UefiConstants.DRIVE_SIG_32BIT) { @@ -279,26 +294,28 @@ public class UefiDevicePath { } else { subType += "invalid partition signature type"; } - subType += " Partition Format = "; + subType += "\n Partition Format = "; if (path[UefiConstants.OFFSET_40 + offset] == UefiConstants.DRIVE_TYPE_PC_AT) { - subType += " PC-AT compatible legacy MBR"; + subType += "PC-AT compatible legacy MBR"; } else if (path[UefiConstants.OFFSET_40 + offset] == UefiConstants.DRIVE_TYPE_GPT) { - subType += " GUID Partition Table"; + subType += "GUID Partition Table"; } else { - subType += " Invalid partition table type"; + subType += "Invalid partition table type"; } + subType += "\n"; return subType; } /** - * Process the File path sub type. + * Process the File path subtype. * * @param path * @param offset * @return file path info. */ private String filePathSubType(final byte[] path, final int offset) { - subType = "File Path = "; + subType = " Sub Type = File Path\n"; + subType += " File Path = "; byte[] lengthBytes = new byte[UefiConstants.SIZE_2]; System.arraycopy(path, 2 + offset, lengthBytes, 0, UefiConstants.SIZE_2); int subTypeLength = HexUtils.leReverseInt(lengthBytes); @@ -307,11 +324,12 @@ public class UefiDevicePath { 0, subTypeLength); byte[] fileName = convertChar16tobyteArray(filePath); subType += new String(fileName, StandardCharsets.UTF_8); + subType += "\n"; return subType; } /** - * Process a vendor sub-type on a Media Type. + * Process a vendor subtype on a Media Type. * Length of this structure in bytes. Length is 20 + n bytes * Vendor-assigned GUID that defines the data that follows. * Vendor-defined variable size data. @@ -321,7 +339,8 @@ public class UefiDevicePath { * @return vendor device info. */ private String vendorSubType(final byte[] path, final int offset) { - subType = "Vendor Subtype GUID = "; + subType = " Sub Type = Vendor\n"; + subType += " Vendor Subtype GUID = "; byte[] lengthBytes = new byte[UefiConstants.SIZE_2]; System.arraycopy(path, UefiConstants.OFFSET_2 + offset, lengthBytes, 0, UefiConstants.SIZE_2); @@ -337,8 +356,9 @@ public class UefiDevicePath { + offset, vendorData, 0, subTypeLength - UefiConstants.SIZE_16); subType += " : Vendor Data = " + HexUtils.byteArrayToHexString(vendorData); } else { - subType += " : No Vendor Data pesent"; + subType += " : No Vendor Data present"; } + subType += "\n"; return subType; } @@ -351,8 +371,8 @@ public class UefiDevicePath { * @return USB device info. */ private String usbSubType(final byte[] path, final int offset) { - subType = " USB "; - subType += " port = " + Integer.valueOf(path[offset + UefiConstants.OFFSET_4]); + subType = " Sub Type = USB\n"; + subType += " port = " + Integer.valueOf(path[offset + UefiConstants.OFFSET_4]); subType += " interface = " + Integer.valueOf(path[offset + UefiConstants.OFFSET_5]); byte[] lengthBytes = new byte[UefiConstants.SIZE_2]; System.arraycopy(path, UefiConstants.OFFSET_2 + offset, lengthBytes, @@ -361,6 +381,7 @@ public class UefiDevicePath { byte[] usbData = new byte[subTypeLength]; System.arraycopy(path, UefiConstants.OFFSET_4 + offset, usbData, 0, subTypeLength); + subType += "\n"; // Todo add further USB processing ... return subType; } @@ -377,7 +398,8 @@ public class UefiDevicePath { * @return NVM device info. */ private String nvmSubType(final byte[] path, final int offset) { - subType = "NVM Express Namespace = "; + subType = " Sub Type = NVM\n"; + subType += " NVM Express Namespace = "; byte[] lengthBytes = new byte[UefiConstants.SIZE_2]; System.arraycopy(path, UefiConstants.OFFSET_2 + offset, lengthBytes, 0, UefiConstants.SIZE_2); @@ -386,6 +408,7 @@ public class UefiDevicePath { System.arraycopy(path, UefiConstants.OFFSET_4 + offset, nvmData, 0, subTypeLength); subType += HexUtils.byteArrayToHexString(nvmData); + subType += "\n"; return subType; } @@ -400,7 +423,8 @@ public class UefiDevicePath { * @return String that represents the UEFI defined BIOS Device Type. */ private String biosDevicePath(final byte[] path, final int offset) { - subType = "Legacy BIOS : Type = "; + subType = " Sub Type = Bios Device Path\n"; + subType += " Legacy BIOS : Type = "; Byte pathType = Byte.valueOf(path[offset + 1]); switch (pathType.intValue()) { case UefiConstants.DEVPATH_BIOS_RESERVED: @@ -432,6 +456,7 @@ public class UefiDevicePath { subType += "Unknown"; break; } + subType += "\n"; return subType; } @@ -446,12 +471,13 @@ public class UefiDevicePath { * @return String that represents the PIWG Firmware Volume Path */ private String piwgFirmVolFile(final byte[] path, final int offset) { - subType = "PIWG Firmware File "; + subType = " Sub Type = PIWG Firmware Volume File\n"; byte[] guidData = new byte[UefiConstants.SIZE_16]; System.arraycopy(path, UefiConstants.OFFSET_4 + offset, guidData, 0, UefiConstants.SIZE_16); UefiGuid guid = new UefiGuid(guidData); subType += guid.toString(); + subType += "\n"; return subType; } @@ -466,12 +492,13 @@ public class UefiDevicePath { * @return String that represents the PIWG Firmware Volume Path */ private String piwgFirmVolPath(final byte[] path, final int offset) { - subType = "PIWG Firmware Volume "; + subType = " Sub Type = PIWG Firmware Volume Path\n"; byte[] guidData = new byte[UefiConstants.SIZE_16]; System.arraycopy(path, UefiConstants.OFFSET_4 + offset, guidData, 0, UefiConstants.SIZE_16); UefiGuid guid = new UefiGuid(guidData); subType += guid.toString(); + subType += "\n"; return subType; }