From d5221e91a4ce85b555758e78ffda7f66039cb40c Mon Sep 17 00:00:00 2001 From: Cyrus <24922493+cyrus-dev@users.noreply.github.com> Date: Mon, 5 Feb 2024 13:29:24 -0500 Subject: [PATCH] Updated some more checkstyle issues and removed the line call from the settings.gradle file --- .../tpm/eventlog/uefi/UefiDevicePath.java | 40 +++++++++++++------ .../tpm/eventlog/uefi/UefiPartition.java | 3 +- .../tpm/eventlog/uefi/UefiSignatureData.java | 3 +- config/checkstyle/checkstyle.xml | 2 +- settings.gradle | 1 - 5 files changed, 32 insertions(+), 17 deletions(-) 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 81ecc69e..adcec477 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 @@ -255,15 +255,19 @@ public class UefiDevicePath { private String hardDriveSubType(final byte[] path, final int offset) { subType = "Partition Number = "; byte[] partnumber = new byte[UefiConstants.SIZE_4]; - System.arraycopy(path, UefiConstants.OFFSET_4 + offset, partnumber, 0, UefiConstants.SIZE_4); + System.arraycopy(path, UefiConstants.OFFSET_4 + offset, partnumber, + 0, UefiConstants.SIZE_4); subType += HexUtils.byteArrayToHexString(partnumber); byte[] data = new byte[UefiConstants.SIZE_8]; - System.arraycopy(path, UefiConstants.OFFSET_8 + offset, data, 0, UefiConstants.SIZE_8); + System.arraycopy(path, UefiConstants.OFFSET_8 + offset, data, 0, + UefiConstants.SIZE_8); subType += " Partition Start = " + HexUtils.byteArrayToHexString(data); - System.arraycopy(path, UefiConstants.OFFSET_16 + offset, data, 0, UefiConstants.SIZE_8); + System.arraycopy(path, UefiConstants.OFFSET_16 + offset, data, 0, + UefiConstants.SIZE_8); 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); + System.arraycopy(path, UefiConstants.OFFSET_24 + offset, signature, 0, + UefiConstants.SIZE_16); subType += "\n Partition Signature = "; if (path[UefiConstants.OFFSET_41 + offset] == UefiConstants.DRIVE_SIG_NONE) { subType += "None"; @@ -299,7 +303,8 @@ public class UefiDevicePath { 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); + System.arraycopy(path, UefiConstants.OFFSET_4 + offset, filePath, + 0, subTypeLength); byte[] fileName = convertChar16tobyteArray(filePath); subType += new String(fileName, StandardCharsets.UTF_8); return subType; @@ -318,10 +323,12 @@ public class UefiDevicePath { private String vendorSubType(final byte[] path, final int offset) { subType = "Vendor Subtype GUID = "; byte[] lengthBytes = new byte[UefiConstants.SIZE_2]; - System.arraycopy(path, UefiConstants.OFFSET_2 + offset, lengthBytes, 0, 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); + System.arraycopy(path, UefiConstants.OFFSET_4 + offset, guidData, + 0, UefiConstants.SIZE_16); UefiGuid guid = new UefiGuid(guidData); subType += guid.toString() + " "; if (subTypeLength - UefiConstants.SIZE_16 > 0) { @@ -348,10 +355,12 @@ public class UefiDevicePath { 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, 0, UefiConstants.SIZE_2); + System.arraycopy(path, UefiConstants.OFFSET_2 + offset, lengthBytes, + 0, UefiConstants.SIZE_2); int subTypeLength = HexUtils.leReverseInt(lengthBytes); byte[] usbData = new byte[subTypeLength]; - System.arraycopy(path, UefiConstants.OFFSET_4 + offset, usbData, 0, subTypeLength); + System.arraycopy(path, UefiConstants.OFFSET_4 + offset, usbData, + 0, subTypeLength); // Todo add further USB processing ... return subType; } @@ -370,10 +379,12 @@ public class UefiDevicePath { private String nvmSubType(final byte[] path, final int offset) { subType = "NVM Express Namespace = "; byte[] lengthBytes = new byte[UefiConstants.SIZE_2]; - System.arraycopy(path, UefiConstants.OFFSET_2 + offset, lengthBytes, 0, 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); + System.arraycopy(path, UefiConstants.OFFSET_4 + offset, nvmData, + 0, subTypeLength); subType += HexUtils.byteArrayToHexString(nvmData); return subType; } @@ -385,6 +396,7 @@ public class UefiDevicePath { * Status bootHandler pointer, and description String pointer are ignored. * * @param path byte array holding the device path. + * @param offset * @return String that represents the UEFI defined BIOS Device Type. */ private String biosDevicePath(final byte[] path, final int offset) { @@ -436,7 +448,8 @@ public class UefiDevicePath { private String piwgFirmVolFile(final byte[] path, final int offset) { subType = "PIWG Firmware File "; byte[] guidData = new byte[UefiConstants.SIZE_16]; - System.arraycopy(path, UefiConstants.OFFSET_4 + offset, guidData, 0, UefiConstants.SIZE_16); + System.arraycopy(path, UefiConstants.OFFSET_4 + offset, guidData, + 0, UefiConstants.SIZE_16); UefiGuid guid = new UefiGuid(guidData); subType += guid.toString(); return subType; @@ -455,7 +468,8 @@ public class UefiDevicePath { private String piwgFirmVolPath(final byte[] path, final int offset) { subType = "PIWG Firmware Volume "; byte[] guidData = new byte[UefiConstants.SIZE_16]; - System.arraycopy(path, UefiConstants.OFFSET_4 + offset, guidData, 0, UefiConstants.SIZE_16); + System.arraycopy(path, UefiConstants.OFFSET_4 + offset, guidData, + 0, UefiConstants.SIZE_16); UefiGuid guid = new UefiGuid(guidData); subType += guid.toString(); return subType; diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiPartition.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiPartition.java index 6d15c032..994ac205 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiPartition.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiPartition.java @@ -49,7 +49,8 @@ public class UefiPartition { 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); + 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, diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiSignatureData.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiSignatureData.java index 328bbaaa..35d21864 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiSignatureData.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/uefi/UefiSignatureData.java @@ -119,7 +119,8 @@ public class UefiSignatureData { UefiSignatureData(final byte[] data) throws CertificateException, NoSuchAlgorithmException { System.arraycopy(data, 0, guid, 0, UefiConstants.SIZE_16); sigData = new byte[data.length - UefiConstants.SIZE_16]; - System.arraycopy(data, UefiConstants.OFFSET_16, sigData, 0, data.length - UefiConstants.SIZE_16); + System.arraycopy(data, UefiConstants.OFFSET_16, sigData, 0, + data.length - UefiConstants.SIZE_16); cert = new UefiX509Cert(sigData); efiVarGuid = new UefiGuid(guid); } diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index c900c0f6..503e7bab 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -71,7 +71,7 @@ - + diff --git a/settings.gradle b/settings.gradle index b67eb0b6..44f38ec3 100644 --- a/settings.gradle +++ b/settings.gradle @@ -12,7 +12,6 @@ dependencyResolutionManagement { libs { version('springboot', '3.0.1') version('jackson', '2.14.2') - library('checkstyle', 'com.puppycrawl.tools:checkstyle:10.12.7') library('commons-codec', 'commons-codec:commons-codec:1.15') library('commons_io', 'commons-io:commons-io:2.11.0') library('commons-lang3', 'org.apache.commons:commons-lang3:3.13.0')