addessed checkstyle errors

This commit is contained in:
iadgovuser26 2022-08-02 13:52:22 -04:00
parent 505f62ce39
commit 96354113a5
3 changed files with 9 additions and 8 deletions

View File

@ -121,9 +121,10 @@ public class TpmPcrEvent {
* This can be SHA1 for older event structures or any algorithm for newer structure.
*
* @param digestData cryptographic hash
* @param digestLength length of the cryptographic hash
*/
protected void setEventDigest(final byte[] digestData, final int digestLength) {
digest = new byte[digestLength];
digest = new byte[digestLength];
System.arraycopy(digestData, 0, digest, 0, digestLength);
}
@ -138,7 +139,7 @@ public class TpmPcrEvent {
System.arraycopy(digest, 0, digestCopy, 0, this.digestLength);
return digestCopy;
}
/**
* Returns a hex representation of the event digest.
* @return hex string
@ -469,6 +470,7 @@ public class TpmPcrEvent {
* @param event the byte array holding the event data.
* @param eventContent the byte array holding the event content.
* @param eventNumber event position within the event log.
* @param hashName name of the hash algorithm used by the event log
* @return String description of the event.
* @throws CertificateException if the event contains an event that cannot be processed.
* @throws NoSuchAlgorithmException if an event contains an unsupported algorithm.
@ -485,11 +487,11 @@ public class TpmPcrEvent {
description += "\n";
if (hashName.compareToIgnoreCase("TPM_ALG_SHA1") == 0) { // Digest
description += "digest (SHA-1): " + Hex.encodeHexString(this.digest);
} else if (hashName.compareToIgnoreCase("TPM_ALG_SHA256") == 0) { // Digest
} else if (hashName.compareToIgnoreCase("TPM_ALG_SHA256") == 0) { // Digest
description += "digest (SHA256): " + Hex.encodeHexString(this.digest);
} else if (hashName.compareToIgnoreCase("TPM_ALG_SHA384") == 0) { // Digest
} else if (hashName.compareToIgnoreCase("TPM_ALG_SHA384") == 0) { // Digest
description += "digest (SHA384): " + Hex.encodeHexString(this.digest);
} else if (hashName.compareToIgnoreCase("TPM_ALG_SHA512") == 0) { // Digest
} else if (hashName.compareToIgnoreCase("TPM_ALG_SHA512") == 0) { // Digest
description += "digest (SHA512): " + Hex.encodeHexString(this.digest);
} else {
description += "Unsupported Hash Algorithm encoutered";

View File

@ -49,7 +49,7 @@ public class TpmPcrEvent1 extends TpmPcrEvent {
byte[] rawEventSize = new byte[UefiConstants.SIZE_4];
byte[] eventDigest = new byte[EvConstants.SHA1_LENGTH];
byte[] eventContent = null;
int digestSize= EvConstants.SHA1_LENGTH;
int digestSize = EvConstants.SHA1_LENGTH;
int eventSize = 0;
String hashName = "TPM_ALG_SHA1";
if (is.available() > UefiConstants.SIZE_32) {

View File

@ -104,9 +104,8 @@ public class TpmPcrEvent2 extends TpmPcrEvent {
hashName = hashAlg.getHashName();
hashlist.add(hashAlg);
eventDigest = new byte[hashAlg.getHashLength()];
setEventDigest(hashAlg.getDigest(),hashAlg.getHashLength());
setEventDigest(hashAlg.getDigest(), hashAlg.getHashLength());
}
is.read(rawEventSize);
eventSize = HexUtils.leReverseInt(rawEventSize);
eventContent = new byte[eventSize];