mirror of
https://github.com/nsacyber/HIRS.git
synced 2024-12-18 20:47:58 +00:00
fixing NoAction event
This commit is contained in:
parent
cbfe800659
commit
e463c0cf76
@ -6,7 +6,6 @@ import hirs.utils.tpm.eventlog.events.EvConstants;
|
||||
import hirs.utils.tpm.eventlog.events.EvEfiGptPartition;
|
||||
import hirs.utils.tpm.eventlog.events.EvEfiHandoffTable;
|
||||
import hirs.utils.tpm.eventlog.events.EvEfiSpdmDeviceSecurityEvent;
|
||||
import hirs.utils.tpm.eventlog.events.EvEfiSpecIdEvent;
|
||||
import hirs.utils.tpm.eventlog.events.EvEventTag;
|
||||
import hirs.utils.tpm.eventlog.events.EvIPL;
|
||||
import hirs.utils.tpm.eventlog.events.EvNoAction;
|
||||
@ -113,7 +112,6 @@ public class TpmPcrEvent {
|
||||
* Event hash for Crypto Agile events.
|
||||
*/
|
||||
private byte[] eventDataSha256hash;
|
||||
private EvPostCode evPostCode;
|
||||
@Setter @Getter
|
||||
private int eventNumber;
|
||||
@Setter @Getter
|
||||
@ -232,7 +230,7 @@ public class TpmPcrEvent {
|
||||
*/
|
||||
protected void setEventContent(final byte[] eventData) {
|
||||
eventContent = new byte[eventData.length];
|
||||
evPostCode = new EvPostCode(eventContent);
|
||||
//EvPostCode evPostCode = new EvPostCode(eventContent);
|
||||
System.arraycopy(eventData, 0, eventContent, 0, eventData.length);
|
||||
}
|
||||
|
||||
@ -263,22 +261,25 @@ public class TpmPcrEvent {
|
||||
case EvConstants.EV_UNUSED:
|
||||
break;
|
||||
case EvConstants.EV_NO_ACTION:
|
||||
EvNoAction noAction = null;
|
||||
try {
|
||||
noAction = new EvNoAction(eventContent);
|
||||
sb.append(noAction.toString());
|
||||
if (noAction.isSpecIDEvent()) {
|
||||
// this should be in the constructor
|
||||
EvEfiSpecIdEvent specID = noAction.getSpecIDEvent();
|
||||
specVersion = String.format("%s.%s",
|
||||
specID.getVersionMajor(),
|
||||
specID.getVersionMinor());
|
||||
specErrataVersion = specID.getErrata();
|
||||
}
|
||||
} catch (UnsupportedEncodingException ueEx) {
|
||||
log.error(ueEx);
|
||||
sb.append(ueEx.toString());
|
||||
// EvNoAction noAction = null;
|
||||
// try {
|
||||
// noAction = new EvNoAction(eventContent);
|
||||
EvNoAction noAction = new EvNoAction(eventContent);
|
||||
sb.append(noAction.toString());
|
||||
if (noAction.isSpecIDEvent()) {
|
||||
// // this should be in the constructor
|
||||
// EvEfiSpecIdEvent specID = noAction.getSpecIDEvent();
|
||||
// specVersion = String.format("%s.%s",
|
||||
// specID.getVersionMajor(),
|
||||
// specID.getVersionMinor());
|
||||
// specErrataVersion = specID.getErrata();
|
||||
specVersion = noAction.getSpecVersion();
|
||||
specErrataVersion = noAction.getSpecErrataVersion();
|
||||
}
|
||||
// } catch (UnsupportedEncodingException ueEx) {
|
||||
// log.error(ueEx);
|
||||
// sb.append(ueEx.toString());
|
||||
// }
|
||||
break;
|
||||
case EvConstants.EV_SEPARATOR:
|
||||
if (EvPostCode.isAscii(eventContent)
|
||||
@ -458,9 +459,11 @@ public class TpmPcrEvent {
|
||||
EvNoAction noAction = new EvNoAction(content);
|
||||
description += "Event Content:\n" + noAction.toString();
|
||||
if (noAction.isSpecIDEvent()) {
|
||||
EvEfiSpecIdEvent specID = noAction.getSpecIDEvent();
|
||||
specVersion = specID.getVersionMajor() + "." + specID.getVersionMinor();
|
||||
specErrataVersion = specID.getErrata();
|
||||
// EvEfiSpecIdEvent specID = noAction.getSpecIDEvent();
|
||||
// specVersion = specID.getVersionMajor() + "." + specID.getVersionMinor();
|
||||
// specErrataVersion = specID.getErrata();
|
||||
specVersion = noAction.getSpecVersion();
|
||||
specErrataVersion = noAction.getSpecErrataVersion();
|
||||
}
|
||||
break;
|
||||
case EvConstants.EV_SEPARATOR:
|
||||
|
@ -32,6 +32,16 @@ public class EvNoAction {
|
||||
* True of the event is a SpecIDEvent.
|
||||
*/
|
||||
private boolean bSpecIDEvent = false;
|
||||
/**
|
||||
* TCG Event Log spec version.
|
||||
*/
|
||||
@Getter
|
||||
private String specVersion = "Unknown";
|
||||
/**
|
||||
* TCG Event Log errata version.
|
||||
*/
|
||||
@Getter
|
||||
private String specErrataVersion = "Unknown";
|
||||
// /**
|
||||
// * EvEfiSpecIdEvent Object.
|
||||
// */
|
||||
@ -55,7 +65,8 @@ public class EvNoAction {
|
||||
* @param eventData byte array holding the event to process.
|
||||
* @throws java.io.UnsupportedEncodingException if input fails to parse.
|
||||
*/
|
||||
public EvNoAction(final byte[] eventData) throws UnsupportedEncodingException {
|
||||
// public EvNoAction(final byte[] eventData) throws UnsupportedEncodingException {
|
||||
public EvNoAction(final byte[] eventData) {
|
||||
byte[] signatureBytes = new byte[UefiConstants.SIZE_15];
|
||||
System.arraycopy(eventData, 0, signatureBytes, 0, UefiConstants.SIZE_15);
|
||||
signature = new String(signatureBytes, StandardCharsets.UTF_8);
|
||||
@ -64,13 +75,20 @@ public class EvNoAction {
|
||||
EvEfiSpecIdEvent specIDEvent = new EvEfiSpecIdEvent(eventData);
|
||||
noActionInfo += specIDEventToString(specIDEvent).toString();
|
||||
bSpecIDEvent = true;
|
||||
specVersion = String.format("%s.%s",
|
||||
specIDEvent.getVersionMajor(),
|
||||
specIDEvent.getVersionMinor());
|
||||
specErrataVersion = specIDEvent.getErrata();
|
||||
} else if (signature.contains("StartupLocality")) {
|
||||
noActionInfo += " Signature = StartupLocality: ";
|
||||
noActionInfo += "\n " + getLocality(eventData);
|
||||
}
|
||||
else if (signature.contains("NvIndexInstance")) {
|
||||
} else if (signature.contains("NvIndexInstance")) {
|
||||
NvIndexInstanceEventLogData nvIndexInstanceEvent = new NvIndexInstanceEventLogData(eventData);
|
||||
noActionInfo += nvIndexInstanceEvent.toString();
|
||||
} else {
|
||||
noActionInfo = "EV_NO_ACTION event named " + signature
|
||||
+ " encountered but support for processing it has not been"
|
||||
+ " added to this application.\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,7 +113,7 @@ public class EvNoAction {
|
||||
specIdInfo += " Platform Profile Specification version = "
|
||||
+ specIDEvent.getVersionMajor() + "." + specIDEvent.getVersionMinor()
|
||||
+ " using errata version " + specIDEvent.getErrata();
|
||||
|
||||
|
||||
return specIdInfo;
|
||||
}
|
||||
|
||||
@ -126,25 +144,6 @@ public class EvNoAction {
|
||||
* @return Human-readable description of this event.
|
||||
*/
|
||||
public String toString() {
|
||||
String noActionInfo = "";
|
||||
if (bSpecIDEvent) {
|
||||
noActionInfo += " Signature = Spec ID Event03 : ";
|
||||
if (specIDEvent.isCryptoAgile()) {
|
||||
noActionInfo += "Log format is Crypto Agile\n";
|
||||
} else {
|
||||
noActionInfo += "Log format is SHA 1 (NOT Crypto Agile)\n";
|
||||
}
|
||||
noActionInfo += " Platform Profile Specification version = "
|
||||
+ specIDEvent.getVersionMajor() + "." + specIDEvent.getVersionMinor()
|
||||
+ " using errata version " + specIDEvent.getErrata();
|
||||
} else if (b) {
|
||||
noActionInfo = nvIndexInstanceEvent.toString();
|
||||
} else if (bNvIndexInstance) {
|
||||
noActionInfo = nvIndexInstanceEvent.toString();
|
||||
} else {
|
||||
noActionInfo = "EV_NO_ACTION event named " + signature
|
||||
+ " encountered but support for processing it has not been added to this application.\n";
|
||||
}
|
||||
return noActionInfo;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user