Merge branch 'issue-242' into issue-245

This commit is contained in:
iadgovuser26 2020-04-28 10:50:34 -04:00
commit dda14ca16d
8 changed files with 105 additions and 136 deletions

View File

@ -15,7 +15,7 @@ public class UefiBootOrder {
*/
UefiBootOrder(final byte[] order) {
bootOrder = new char[order.length / UefiConstants.SIZE_2];
for (int i = 0; i < order.length; i = i + UefiConstants.SIZE_2) {
for (int i = 0; i < order.length; i += UefiConstants.SIZE_2) {
bootOrder[i / UefiConstants.SIZE_2] =
(char) (order[i + 1] * UefiConstants.SIZE_256 + order[i]);
}
@ -26,11 +26,10 @@ public class UefiBootOrder {
* @return A human readable Boot Order
*/
public String toString() {
StringBuffer orderList = new StringBuffer();
StringBuilder orderList = new StringBuilder();
orderList.append("BootOrder = ");
for (int i = 0; i < bootOrder.length; i++) {
int order = bootOrder[i];
orderList.append(" Boot" + String.format("%04d", order));
orderList.append(String.format("Boot %04d", (int) bootOrder[i]));
}
return orderList.toString();
}

View File

@ -1,6 +1,7 @@
package hirs.tpm.eventlog.uefi;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import hirs.utils.HexUtils;
@ -49,7 +50,7 @@ public UefiBootVariable(final byte[] bootVar) throws UnsupportedEncodingExceptio
int descLength = getChar16ArrayLength(blob);
byte[] desc = new byte[descLength * UefiConstants.SIZE_2];
System.arraycopy(bootVar, UefiConstants.OFFSET_6, desc, 0, descLength * UefiConstants.SIZE_2);
description = new String(UefiDevicePath.convertChar16tobyteArray(desc), "UTF-8");
description = new String(UefiDevicePath.convertChar16tobyteArray(desc), StandardCharsets.UTF_8);
// Data following the Description should be EFI Partition Data (EFI_DEVICE_PATH_PROTOCOL)
int devPathLength = blobLength;
int devPathOffset = UefiConstants.OFFSET_6 + descLength; //attributes+bloblength+desc+length+2
@ -66,11 +67,10 @@ public UefiBootVariable(final byte[] bootVar) throws UnsupportedEncodingExceptio
* @return string that represents a UEFI boot variable.
*/
public String toString() {
String bootInfo = "";
StringBuilder bootInfo = new StringBuilder("Description = ");
String bootvar = description.replaceAll("[^a-zA-Z_0-0\\s]", ""); // remove all non ascii chars
bootInfo += "Description = " + bootvar + "\n";
bootInfo += efiDevPath.toString();
return bootInfo;
bootInfo.append(bootvar + "\n" + efiDevPath.toString());
return bootInfo.toString();
}
/**
@ -82,15 +82,15 @@ public String toString() {
*/
public int getChar16ArrayLength(final byte[] data) {
int count = 0;
byte[] nullTerminitor = new byte[UefiConstants.SIZE_2];
byte[] nullTerminator = new byte[UefiConstants.SIZE_2];
byte[] char16 = new byte[UefiConstants.SIZE_2];
nullTerminitor[0] = 0;
nullTerminitor[1] = 0;
for (int i = 0; i < data.length; i = i + UefiConstants.SIZE_2) {
nullTerminator[0] = 0;
nullTerminator[1] = 0;
for (int i = 0; i < data.length; i += UefiConstants.SIZE_2) {
char16[0] = data[i];
char16[1] = data[i + 1];
count++;
if (Arrays.equals(nullTerminitor, char16)) {
if (Arrays.equals(nullTerminator, char16)) {
return count * UefiConstants.SIZE_2;
}
}

View File

@ -83,27 +83,25 @@ public class UefiDevicePath {
* @throws UnsupportedEncodingException
*/
private String processDevPath(final byte[] path) throws UnsupportedEncodingException {
StringBuffer pInfo = new StringBuffer();
StringBuilder pInfo = new StringBuilder();
String devicePathInfo = "";
int devLength = 0, pathOffset = 0;
boolean moreDev = true;
while (moreDev) {
while (true) {
Byte devPath = Byte.valueOf(path[pathOffset]);
if ((devPath.intValue() == UefiConstants.TERMINATOR)
|| (devPath.intValue() == UefiConstants.END_FLAG)) {
moreDev = false;
break;
}
devicePathInfo = processDev(path, pathOffset);
if (devicePathInfo.contains("Unknown Device Path")) {
moreDev = false;
break;
}
pInfo.append(devicePathInfo);
devLength = path[pathOffset + UefiConstants.OFFSET_3] * UefiConstants.SIZE_256
+ path[pathOffset + UefiConstants.OFFSET_2];
pathOffset = pathOffset + devLength;
if (pathOffset >= path.length) {
moreDev = false;
break;
}
}
return pInfo.toString();
@ -171,16 +169,15 @@ public class UefiDevicePath {
* @return acpi device info
*/
private String acpiSubType(final byte[] path, final int offset) {
String tmpType = "";
subType = "";
switch (path[offset + UefiConstants.OFFSET_1]) {
case 0x01: tmpType = "(Short): ";
tmpType += acpiShortSubType(path, offset);
case 0x01: subType = "(Short): ";
subType += acpiShortSubType(path, offset);
break;
case 0x02: tmpType = "Expanded ACPI Device Path"; break;
default: tmpType = "Invalid ACPI Device Path sub type";
case 0x02: subType = "Expanded ACPI Device Path"; break;
default: subType = "Invalid ACPI Device Path sub type";
}
subType = tmpType;
return tmpType;
return subType;
}
/**
@ -190,14 +187,13 @@ private String acpiSubType(final byte[] path, final int offset) {
* @return short acpi info.
*/
private String acpiShortSubType(final byte[] path, final int offset) {
String tmpType = "";
subType = "";
byte[] hid = new byte[UefiConstants.SIZE_4];
System.arraycopy(path, UefiConstants.OFFSET_4 + offset, hid, 0, UefiConstants.SIZE_4);
tmpType += "_HID = " + HexUtils.byteArrayToHexString(hid);
subType += "_HID = " + HexUtils.byteArrayToHexString(hid);
System.arraycopy(path, 2 * UefiConstants.SIZE_4 + offset, hid, 0, UefiConstants.SIZE_4);
tmpType += "_UID = " + HexUtils.byteArrayToHexString(hid);
subType = tmpType;
return tmpType;
subType += "_UID = " + HexUtils.byteArrayToHexString(hid);
return subType;
}
/**
@ -207,12 +203,11 @@ private String acpiShortSubType(final byte[] path, final int offset) {
* @return pci device info.
*/
private String pciSubType(final byte[] path, final int offset) {
String tmpType = "PCI: PCI Function Number = ";
tmpType += String.format("0x%x", path[offset + UefiConstants.SIZE_4]);
tmpType += " PCI Device Number = ";
tmpType += String.format("0x%x", path[offset + UefiConstants.SIZE_5]);
subType = tmpType;
return tmpType;
subType = "PCI: PCI Function Number = ";
subType += String.format("0x%x", path[offset + UefiConstants.SIZE_4]);
subType += " PCI Device Number = ";
subType += String.format("0x%x", path[offset + UefiConstants.SIZE_5]);
return subType;
}
/**
@ -222,16 +217,15 @@ private String pciSubType(final byte[] path, final int offset) {
* @return SATA drive info.
*/
private String sataSubType(final byte[] path, final int offset) {
String tmpType = "SATA: HBA Port Number = ";
subType = "SATA: HBA Port Number = ";
byte[] data = new byte[UefiConstants.SIZE_2];
System.arraycopy(path, UefiConstants.OFFSET_4 + offset, data, 0, UefiConstants.SIZE_2);
tmpType += HexUtils.byteArrayToHexString(data);
subType += HexUtils.byteArrayToHexString(data);
System.arraycopy(path, UefiConstants.OFFSET_6 + offset, data, 0, UefiConstants.SIZE_2);
tmpType += " Port Multiplier = " + HexUtils.byteArrayToHexString(data);
subType += " Port Multiplier = " + HexUtils.byteArrayToHexString(data);
System.arraycopy(path, UefiConstants.OFFSET_8 + offset, data, 0, UefiConstants.SIZE_2);
tmpType += " Logical Unit Number = " + HexUtils.byteArrayToHexString(data);
subType = tmpType;
return tmpType;
subType += " Logical Unit Number = " + HexUtils.byteArrayToHexString(data);
return subType;
}
/**
@ -241,38 +235,37 @@ private String sataSubType(final byte[] path, final int offset) {
* @return hard drive info.
*/
private String hardDriveSubType(final byte[] path, final int offset) {
String tmpType = "Partition Number = ";
subType = "Partition Number = ";
byte[] partnumber = new byte[UefiConstants.SIZE_4];
System.arraycopy(path, UefiConstants.OFFSET_4 + offset, partnumber, 0, UefiConstants.SIZE_4);
tmpType += HexUtils.byteArrayToHexString(partnumber);
subType += HexUtils.byteArrayToHexString(partnumber);
byte[] data = new byte[UefiConstants.SIZE_8];
System.arraycopy(path, UefiConstants.OFFSET_8 + offset, data, 0, UefiConstants.SIZE_8);
tmpType += "Partition Start = " + HexUtils.byteArrayToHexString(data);
subType += "Partition Start = " + HexUtils.byteArrayToHexString(data);
System.arraycopy(path, UefiConstants.OFFSET_16 + offset, data, 0, UefiConstants.SIZE_8);
tmpType += "Partition Size = " + HexUtils.byteArrayToHexString(data);
subType += "Partition Size = " + HexUtils.byteArrayToHexString(data);
byte[] signature = new byte[UefiConstants.SIZE_16];
System.arraycopy(path, UefiConstants.OFFSET_24 + offset, signature, 0, UefiConstants.SIZE_16);
tmpType += "Partition Signature = ";
subType += "Partition Signature = ";
if (path[UefiConstants.OFFSET_41 + offset] == UefiConstants.DRIVE_SIG_NONE) {
tmpType += "None";
subType += "None";
} else if (path[UefiConstants.OFFSET_41 + offset] == UefiConstants.DRIVE_SIG_32BIT) {
tmpType += HexUtils.byteArrayToHexString(signature);
subType += HexUtils.byteArrayToHexString(signature);
} else if (path[UefiConstants.OFFSET_41 + offset] == UefiConstants.DRIVE_SIG_GUID) {
UefiGuid guid = new UefiGuid(signature);
tmpType += guid.toString();
subType += guid.toString();
} else {
tmpType += "invalid partition signature type";
subType += "invalid partition signature type";
}
tmpType += "Partition Format = ";
subType += "Partition Format = ";
if (path[UefiConstants.OFFSET_40 + offset] == UefiConstants.DRIVE_TYPE_PC_AT) {
tmpType += "PC-AT compatible legacy MBR";
subType += "PC-AT compatible legacy MBR";
} else if (path[UefiConstants.OFFSET_40 + offset] == UefiConstants.DRIVE_TYPE_GPT) {
tmpType += "GUID Partition Table";
subType += "GUID Partition Table";
} else {
tmpType += "Invalid partition table type";
subType += "Invalid partition table type";
}
subType = tmpType;
return tmpType;
return subType;
}
/**
@ -284,16 +277,15 @@ private String hardDriveSubType(final byte[] path, final int offset) {
*/
private String filePathSubType(final byte[] path, final int offset)
throws UnsupportedEncodingException {
String tmpType = "File Path = ";
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);
byte[] filePath = new byte[subTypeLength];
System.arraycopy(path, UefiConstants.OFFSET_4 + offset, filePath, 0, subTypeLength);
byte[] fileName = convertChar16tobyteArray(filePath);
tmpType += new String(fileName, "UTF-8");
subType = tmpType;
return tmpType;
subType += new String(fileName, "UTF-8");
return subType;
}
/**
@ -306,24 +298,23 @@ private String filePathSubType(final byte[] path, final int offset)
* @return vendor device info.
*/
private String vendorSubType(final byte[] path, final int offset) {
String tmpType = "Vendor Subtype GUID = ";
subType = "Vendor Subtype GUID = ";
byte[] lengthBytes = new byte[UefiConstants.SIZE_2];
System.arraycopy(path, UefiConstants.OFFSET_2 + offset, lengthBytes, 0, UefiConstants.SIZE_2);
int subTypeLength = HexUtils.leReverseInt(lengthBytes);
byte[] guidData = new byte[UefiConstants.SIZE_16];
System.arraycopy(path, UefiConstants.OFFSET_4 + offset, guidData, 0, UefiConstants.SIZE_16);
UefiGuid guid = new UefiGuid(guidData);
tmpType += guid.toString() + " ";
subType += guid.toString() + " ";
if (subTypeLength - UefiConstants.SIZE_16 > 0) {
byte[] vendorData = new byte[subTypeLength - UefiConstants.SIZE_16];
System.arraycopy(path, UefiConstants.OFFSET_20
+ offset, vendorData, 0, subTypeLength - UefiConstants.SIZE_16);
tmpType += " : Vendor Data = " + HexUtils.byteArrayToHexString(vendorData);
subType += " : Vendor Data = " + HexUtils.byteArrayToHexString(vendorData);
} else {
tmpType += " : No Vendor Data pesent";
subType += " : No Vendor Data pesent";
}
subType = tmpType;
return tmpType;
return subType;
}
/**
@ -337,45 +328,42 @@ private String vendorSubType(final byte[] path, final int offset) {
* @return NVM device info.
*/
private String nvmSubType(final byte[] path, final int offset) {
String tmpType = "NVM Express Namespace = ";
subType = "NVM Express Namespace = ";
byte[] lengthBytes = new byte[UefiConstants.SIZE_2];
System.arraycopy(path, UefiConstants.OFFSET_2 + offset, lengthBytes, 0, UefiConstants.SIZE_2);
int subTypeLength = HexUtils.leReverseInt(lengthBytes);
byte[] nvmData = new byte[subTypeLength];
System.arraycopy(path, UefiConstants.OFFSET_4 + offset, nvmData, 0, subTypeLength);
tmpType += HexUtils.byteArrayToHexString(nvmData);
subType = tmpType;
return tmpType;
subType += HexUtils.byteArrayToHexString(nvmData);
return subType;
}
/**
* BIOS Device Type definition.
* From Appendix A of the BIOS Boot Specification.
* Only process the Device type.
* Only processes the Device type.
* Status bootHandler pointer, and description String pointer are ignored.
* @param path byte array holding the device path.
* @return String that represents the UEFI defined BIOS Device Type.
*/
private String biosDevicePath(final byte[] path, final int offset) {
String devPath = "Legacy BIOS : Type = ";
byte devPathType = path[offset + 1];
Byte pathType = Byte.valueOf(devPathType);
subType = "Legacy BIOS : Type = ";
Byte pathType = Byte.valueOf(path[offset + 1]);
switch (pathType.intValue()) {
case UefiConstants.DEVPATH_BIOS_RESERVED: devPath += "Reserved"; break;
case UefiConstants.DEVPATH_BIOS_FLOPPY: devPath += "Floppy"; break;
case UefiConstants.DEVPATH_BIOS_HD: devPath += "Hard Disk"; break;
case UefiConstants.DEVPATH_BIOS_CD: devPath += "CD-ROM"; break;
case UefiConstants.DEVPATH_BIOS_PCM: devPath += "PCMCIA"; break;
case UefiConstants.DEVPATH_BIOS_USB: devPath += "USB"; break;
case UefiConstants.DEVPATH_BIOS_EN: devPath += "Embedded network"; break;
case UefiConstants.DEVPATH_BIOS_BEV: devPath +=
case UefiConstants.DEVPATH_BIOS_RESERVED: subType += "Reserved"; break;
case UefiConstants.DEVPATH_BIOS_FLOPPY: subType += "Floppy"; break;
case UefiConstants.DEVPATH_BIOS_HD: subType += "Hard Disk"; break;
case UefiConstants.DEVPATH_BIOS_CD: subType += "CD-ROM"; break;
case UefiConstants.DEVPATH_BIOS_PCM: subType += "PCMCIA"; break;
case UefiConstants.DEVPATH_BIOS_USB: subType += "USB"; break;
case UefiConstants.DEVPATH_BIOS_EN: subType += "Embedded network"; break;
case UefiConstants.DEVPATH_BIOS_BEV: subType +=
"Bootstrap Entry Vector (BEV) from an Option ROM";
break;
default: devPath += "Reserved";
default: subType += "Unknown";
break;
}
subType = devPath;
return devPath;
return subType;
}
/**
@ -388,13 +376,12 @@ private String biosDevicePath(final byte[] path, final int offset) {
* @return String that represents the PIWG Firmware Volume Path
*/
private String piwgFirmVolFile(final byte[] path, final int offset) {
String fWPath = "PIWG Firmware File ";
subType = "PIWG Firmware File ";
byte[] guidData = new byte[UefiConstants.SIZE_16];
System.arraycopy(path, UefiConstants.OFFSET_4 + offset, guidData, 0, UefiConstants.SIZE_16);
UefiGuid guid = new UefiGuid(guidData);
fWPath += guid.toString();
subType = fWPath;
return fWPath;
subType += guid.toString();
return subType;
}
/**
@ -407,13 +394,12 @@ private String piwgFirmVolFile(final byte[] path, final int offset) {
* @return String that represents the PIWG Firmware Volume Path
*/
private String piwgFirmVolPath(final byte[] path, final int offset) {
String fWPath = "PIWG Firmware Volume ";
subType = "PIWG Firmware Volume ";
byte[] guidData = new byte[UefiConstants.SIZE_16];
System.arraycopy(path, UefiConstants.OFFSET_4 + offset, guidData, 0, UefiConstants.SIZE_16);
UefiGuid guid = new UefiGuid(guidData);
fWPath += guid.toString();
subType = fWPath;
return fWPath;
subType += guid.toString();
return subType;
}
/**
@ -421,7 +407,7 @@ private String piwgFirmVolPath(final byte[] path, final int offset) {
* @return UEFi Device path.
*/
public String toString() {
return (devPathInfo);
return devPathInfo;
}
/**

View File

@ -52,13 +52,7 @@ private static UUID processGuid(final byte[] guid) {
UUID tmpUuid = new UUID(msbl, lsbl);
return tmpUuid;
}
/**
* Returns the standard GUID length.
* @return guid length
*/
public static int getGuidLength() {
return UefiConstants.SIZE_16;
}
/**
* Returns a String that represents a specification name referenced by the EFI_CONFIGURATION_TABLE
* VendorGUID field. For structure of EFI_CONFIGURATION_TABLE type, the UEFI specification
@ -71,10 +65,9 @@ public static int getGuidLength() {
@SuppressWarnings("checkstyle:methodlength")
public String getVendorTableReference() {
String vendorRef = uuid.toString().toLowerCase();
String reference = "";
switch (vendorRef) {
switch (uuid.toString().toLowerCase()) {
// UUIDS listed in the UEFI Specification
case "eb9d2d30-2d88-11d3-9a16-0090273fc14d": reference = "ACPI_TABLE_GUID"; break;
case "eb9d2d32-2d88-11d3-9a16-0090273fc14d": reference = "SAL_SYSTEM_TABLE_GUID"; break;
@ -206,7 +199,7 @@ public String getVendorTableReference() {
// RHBoot Lenovo specific UUIDS
case "3cc24e96-22c7-41d8-8863-8e39dcdcc2cf":reference = "lenovo"; break;
case "82988420-7467-4490-9059-feb448dd1963":reference = "lenovo_me_config"; break;
case "f7e615b-0d45-4f80-88dc-26b234958560":reference = "lenovo_diag"; break;
case "3f7e615b-0d45-4f80-88dc-26b234958560":reference = "lenovo_diag"; break;
case "665d3f60-ad3e-4cad-8e26-db46eee9f1b5":reference = "lenovo_rescue"; break;
case "721c8b66-426c-4e86-8e99-3457c46ab0b9":reference = "lenovo_setup"; break;
case "f46ee6f4-4785-43a3-923d-7f786c3c8479":reference = "lenovo_startup_interrupt"; break;
@ -234,7 +227,7 @@ public String getVendorTableReference() {
// Linux specific GUIDS
case "0fc63daf-8483-4772-8e79-3d69d8477de":reference = "Linux filesystem data"; break;
case "44479540-f297-41b2-9af7-d131d5f0458a4":reference = "Root partition (x86)"; break;
case "44479540-f297-41b2-9af7-d131d5f0458a":reference = "Root partition (x86)"; break;
case "69dad710-2ce4-4e3c-b16c-21a1d49abed3":reference = "Root partition (32-bit ARM)"; break;
case "b921b045-1df0-41c3-af44-4c6f280d3fae":
reference = "Root partition (64-bit ARM/AArch64)"; break;
@ -295,7 +288,7 @@ public String getVendorTableReference() {
case "26a2481e-4424-46a2-9943-cc4039ead8f8":reference = "S3Save"; break;
case "efd652cc-0e99-40f0-96c0-e08c089070fc":reference = "S3Restore"; break;
case "8c783970-f02a-4a4d-af09-8797a51eec8d":reference = "PowerManagement"; break;
case "299141bb-211a-48a5-92c0-6f9a0a3a006e0":reference = "PowerManagement-ACPI-table"; break;
case "299141bb-211a-48a5-92c0-6f9a0a3a006e":reference = "PowerManagement-ACPI-table"; break;
case "2df10014-cf21-4280-8c3f-e539b8ee5150":reference = "PpmPolicyInitDxe"; break;
case "4b680e2d-0d63-4f62-b930-7ae995b9b3a3":reference = "SmBusDxe"; break;
// SMM handlers
@ -382,7 +375,7 @@ public static boolean isValidUUID(final byte[] guid) {
if (tmpUuid.toString().length() != 0) {
valid = true;
}
return (valid);
return valid;
}
/**
@ -398,10 +391,7 @@ public boolean isEmptyUUID() {
* @return true if the uuid is the Empty UUID, false if not
*/
public boolean isUnknownUUID() {
if (getVendorTableReference().equals("Unknown GUID reference")) {
return true;
}
return false;
return getVendorTableReference().equals("Unknown GUID reference");
}
/**

View File

@ -42,19 +42,20 @@ public class UefiPartition {
* @throws UnsupportedEncodingException if parsing of the data fails.
*/
public UefiPartition(final byte[] table) throws UnsupportedEncodingException {
byte[] partitionGUID = new byte[UefiGuid.getGuidLength()];
System.arraycopy(table, 0, partitionGUID, 0, UefiGuid.getGuidLength());
partitionTypeGUID = new UefiGuid(partitionGUID);
byte[] uniquePartGUID = new byte[UefiGuid.getGuidLength()];
System.arraycopy(table, UefiGuid.getGuidLength(), uniquePartGUID, 0, UefiGuid.getGuidLength());
uniquePartitionGUID = new UefiGuid(uniquePartGUID);
byte[] attribute = new byte[UefiConstants.SIZE_8];
System.arraycopy(table, UefiConstants.ATTRIBUTE_LENGTH, attribute, 0, UefiConstants.SIZE_8);
attributes = HexUtils.byteArrayToHexString(attribute);
byte[] partitionname = new byte[UefiConstants.UEFI_PT_LENGTH];
System.arraycopy(table, UefiConstants.PART_NAME_LENGTH, partitionname,
byte[] partitionGuidBytes = new byte[UefiConstants.SIZE_16];
System.arraycopy(table, 0, partitionGuidBytes, 0, UefiConstants.SIZE_16);
partitionTypeGUID = new UefiGuid(partitionGuidBytes);
byte[] uniquePartGuidBytes = new byte[UefiConstants.SIZE_16];
System.arraycopy(table, UefiConstants.SIZE_16, uniquePartGuidBytes, 0, UefiConstants.SIZE_16);
uniquePartitionGUID = new UefiGuid(uniquePartGuidBytes);
byte[] attributeBytes = new byte[UefiConstants.SIZE_8];
System.arraycopy(table, UefiConstants.ATTRIBUTE_LENGTH, attributeBytes,
0, UefiConstants.SIZE_8);
attributes = HexUtils.byteArrayToHexString(attributeBytes);
byte[] partitionNameBytes = new byte[UefiConstants.UEFI_PT_LENGTH];
System.arraycopy(table, UefiConstants.PART_NAME_LENGTH, partitionNameBytes,
0, UefiConstants.UEFI_PT_LENGTH);
byte[] pName = convertChar16tobyteArray(partitionname);
byte[] pName = convertChar16tobyteArray(partitionNameBytes);
partitionName = new String(pName, "UTF-8").trim();
}
@ -102,7 +103,7 @@ public String toString() {
private byte[] convertChar16tobyteArray(final byte[] data) {
byte[] hexdata = new byte[data.length];
int j = 0;
for (int i = 0; i < data.length; i = i + 2) {
for (int i = 0; i < data.length; i += 2) {
hexdata[j++] = data[i];
}
return hexdata;

View File

@ -188,7 +188,7 @@ public boolean isValidSigListGUID(final UefiGuid guid) {
* @return human readable description.
*/
public String toString() {
StringBuffer sigInfo = new StringBuffer();
StringBuilder sigInfo = new StringBuilder();
sigInfo.append("UEFI Signature List Type = " + signatureType.toString() + "\n");
sigInfo.append("Number if items = " + numberOfItems + "\n");
sigList.iterator();

View File

@ -134,7 +134,7 @@ private void processSigList(final byte[] data)
* @return human readable description of the UEFi variable.
*/
public String toString() {
StringBuffer efiVariable = new StringBuffer();
StringBuilder efiVariable = new StringBuilder();
efiVariable.append("UEFI Variable Name:" + varName + "\n");
efiVariable.append("UEFI_GUID = " + getEfiVarGuid().toString() + "\n");
efiVariable.append("UEFI Variable Contents => " + "\n");

View File

@ -13,13 +13,6 @@ import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/*
import org.junit.Test;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
*/
/**
* Class for testing TCG Event Log processing of UEFI defined Data.
*/