From 07c7b52a640293bd0551c1d2501bfd3879817f44 Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Fri, 5 Apr 2024 10:45:21 -0400 Subject: [PATCH 01/31] added files for EvEfiSpdmFirmwareBlob --- .../hirs/utils/tpm/eventlog/TpmPcrEvent.java | 4 + .../tpm/eventlog/events/EvConstants.java | 4 + .../events/EvEfiSpdmFirmwareBlob.java | 92 +++++++++++++++++++ .../evDeviceSecurityEventDataHeader.java | 4 + .../evDeviceSecurityEventDataPciContext.java | 4 + 5 files changed, 108 insertions(+) create mode 100644 HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java create mode 100644 HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/evDeviceSecurityEventDataHeader.java create mode 100644 HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/evDeviceSecurityEventDataPciContext.java diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java index 0f2c9cc5..d2f685ba 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java @@ -374,6 +374,7 @@ public class TpmPcrEvent { break; case EvConstants.EV_EFI_HCRTM_EVENT: break; + case EvConstants.EV_EFI_SPDM_FIRMWARE_BLOB: default: sb.append("Unknown Event found\n"); } @@ -532,6 +533,7 @@ public class TpmPcrEvent { case EvConstants.EV_EFI_VARIABLE_AUTHORITY: description += "Event Content:\n" + new UefiVariable(content).toString(); break; + case EvConstants.EV_EFI_SPDM_FIRMWARE_BLOB: default: description += " Unknown Event found" + "\n"; } @@ -609,6 +611,8 @@ public class TpmPcrEvent { return "EV_EFI_HCRTM_EVENT"; } else if (event == EvConstants.EV_EFI_VARIABLE_AUTHORITY) { return "EV_EFI_VARIABLE_AUTHORITY"; + } else if (event == EvConstants.EV_EFI_SPDM_FIRMWARE_BLOB) { + return "EV_EFI_SPDM_FIRMWARE_BLOB"; } else { return "Unknown Event ID " + event + " encountered"; } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvConstants.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvConstants.java index 07d01ea2..aaf69776 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvConstants.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvConstants.java @@ -163,4 +163,8 @@ public final class EvConstants { * EFI Variable Authority Event ID. */ public static final int EV_EFI_VARIABLE_AUTHORITY = 0x800000E0; + /** + * EFI SPDM Firmware Blob Event ID. + */ + public static final int EV_EFI_SPDM_FIRMWARE_BLOB = 0x800000E1; } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java new file mode 100644 index 00000000..e9755ad1 --- /dev/null +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java @@ -0,0 +1,92 @@ +package hirs.utils.tpm.eventlog.events; + +import hirs.utils.HexUtils; +import hirs.utils.tpm.eventlog.TcgTpmtHa; +import hirs.utils.tpm.eventlog.uefi.UefiConstants; +import lombok.Getter; + +import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; + +/** + * Class to process the EV_EFI_SPDM_FIRMWARE_BLOB event using structures: + * 1) DEVICE_SECURITY_EVENT_DATA_HEADER [ delete: TCG_EfiSpecIDEvent] + * 2) DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT + * DEVICE_SECURITY_EVENT_DATA_HEADER + * The first 16 bytes of the event data MUST be a String based identifier (Signature), NUL-terminated. + * The only currently defined Signature is "SPDM Device Sec" + * which implies the data is a DEVICE_SECURITY_EVENT_DATA_HEADER. + * DEVICE_SECURITY_EVENT_DATA_HEADER contains the measurement(s) and hash algorithm + * (SpdmHashAlg) identifier returned by the SPDM "GET_MEASUREMENTS" function + * DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT + * DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT is a common SPDM structure which includes the + * identification of the device, device vendor, subsystem, etc for PCI connection devices + */ +public class EvEfiSpdmFirmwareBlob { + + /** + * Signature (text) data. + */ + private String signature = ""; + /** + * True if the event is a DEVICE_SECURITY_EVENT_DATA_HEADER. + */ + private boolean bDeviceSecurityEventDataHeader = false; + /** + * evDeviceSecurityEventDataHeader Object. + */ + @Getter + private evDeviceSecurityEventDataHeader deviceSecurityEventDataHeader = null; + + /** + * EvEfiSpdmFirmwareBlob constructor. + * + * @param eventData byte array holding the event to process. + * @throws java.io.UnsupportedEncodingException if input fails to parse. + */ + public EvEfiSpdmFirmwareBlob(final byte[] eventData) throws UnsupportedEncodingException { + byte[] signatureBytes = new byte[UefiConstants.SIZE_15]; +// System.arraycopy(eventData, 0, signatureBytes, 0, UefiConstants.SIZE_15); +// signature = new String(signatureBytes, StandardCharsets.UTF_8); +// signature = signature.replaceAll("[^\\P{C}\t\r\n]", ""); // remove null characters +// if (signature.contains("Spec ID Event03")) { // implies CryptAgileFormat +// specIDEvent = new EvEfiSpecIdEvent(eventData); +// bSpecIDEvent = true; +// } + } + + /** + * Determines if this event is a SpecIDEvent. + * + * @return true of the event is a SpecIDEvent. + */ + public boolean isDeviceSecurityEventDataHeader() { + return bDeviceSecurityEventDataHeader; + } + + /** + * Returns a description of this event. + * + * @return Human readable description of this event. + */ +// public String toString() { +// String specInfo = ""; +// if (bSpecIDEvent) { +// specInfo += " Signature = Spec ID Event03 : "; +// if (specIDEvent.isCryptoAgile()) { +// specInfo += "Log format is Crypto Agile\n"; +// } else { +// specInfo += "Log format is SHA 1 (NOT Crypto Agile)\n"; +// } +// specInfo += " Platform Profile Specification version = " +// + specIDEvent.getVersionMajor() + "." + specIDEvent.getVersionMinor() +// + " using errata version " + specIDEvent.getErrata(); +// } else { +// specInfo = "EV_NO_ACTION event named " + signature +// + " encountered but support for processing it has not been added to this application.\n"; +// } +// return specInfo; +// } +} diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/evDeviceSecurityEventDataHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/evDeviceSecurityEventDataHeader.java new file mode 100644 index 00000000..a0c319fa --- /dev/null +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/evDeviceSecurityEventDataHeader.java @@ -0,0 +1,4 @@ +package hirs.utils.tpm.eventlog.events; + +public class evDeviceSecurityEventDataHeader { +} diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/evDeviceSecurityEventDataPciContext.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/evDeviceSecurityEventDataPciContext.java new file mode 100644 index 00000000..77a1368f --- /dev/null +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/evDeviceSecurityEventDataPciContext.java @@ -0,0 +1,4 @@ +package hirs.utils.tpm.eventlog.events; + +public class evDeviceSecurityEventDataPciContext { +} From f5031efb42ea09d8cfd5431a55d943de099124b7 Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Mon, 8 Apr 2024 12:28:03 -0400 Subject: [PATCH 02/31] spdm event structures --- .../events/DeviceSecurityEventData.java | 41 +++++ .../DeviceSecurityEventDataDeviceContext.java | 17 ++ .../events/DeviceSecurityEventDataHeader.java | 162 ++++++++++++++++++ .../DeviceSecurityEventDataPciContext.java | 4 + .../events/EvEfiSpdmFirmwareBlob.java | 23 +-- .../evDeviceSecurityEventDataHeader.java | 4 - .../evDeviceSecurityEventDataPciContext.java | 4 - 7 files changed, 233 insertions(+), 22 deletions(-) create mode 100644 HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java create mode 100644 HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java create mode 100644 HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java create mode 100644 HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataPciContext.java delete mode 100644 HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/evDeviceSecurityEventDataHeader.java delete mode 100644 HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/evDeviceSecurityEventDataPciContext.java diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java new file mode 100644 index 00000000..478faa4a --- /dev/null +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java @@ -0,0 +1,41 @@ +package hirs.utils.tpm.eventlog.events; + +import hirs.utils.HexUtils; +import hirs.utils.tpm.eventlog.TcgTpmtHa; +import hirs.utils.tpm.eventlog.uefi.UefiConstants; +import lombok.Getter; + +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; + + +/** + * Class to process the DeviceSecurityEventData event + * DEVICE_SECURITY_EVENT_DATA has 2 structures: + * 1) DEVICE_SECURITY_EVENT_DATA_HEADER + * 2) DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT + * DEVICE_SECURITY_EVENT_DATA_HEADER + * The first 16 bytes of the event data header MUST be a String based identifier (Signature), + * NUL-terminated. The only currently defined Signature is "SPDM Device Sec" which implies + * the event data is a DEVICE_SECURITY_EVENT_DATA. DEVICE_SECURITY_EVENT_DATA_HEADER contains + * the measurement(s) and hash algorithm (SpdmHashAlg) identifier returned by the SPDM + * "GET_MEASUREMENTS" function. + * DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT + * DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT is a common SPDM structure which includes the + * identification of the device, device vendor, subsystem, etc. + * <p> + * typedef struct tdDEVICE_SECURITY_EVENT_DATA { + * DEVICE_SECURITY_EVENT_DATA_HEADER EventDataHeader; + * DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT DeviceContext; + * } DEVICE_SECURITY_EVENT_DATA; + * <p> + * Notes: Parses event data for an DEVICE_SECURITY_EVENT_DATA per PFP Spec. + * 1. Has an EventType of EV_EFI_SPDM_FIRMWARE_BLOB (0x800000E1) + * 2. Digest of 48 bytes + * 3. Event content defined as DEVICE_SECURITY_EVENT_DATA Struct. + * 4. First 16 bytes of the structure is an ASCII "SPDM Device Sec" + */ +public class DeviceSecurityEventData { + +} diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java new file mode 100644 index 00000000..bd12cb92 --- /dev/null +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java @@ -0,0 +1,17 @@ +package hirs.utils.tpm.eventlog.events; + +/** + * Class to process the DeviceSecurityEventDataDeviceContext event + * DEVICE_SECURITY_EVENT_DATA has 2 structures: + * 1) DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT + * 2) DEVICE_SECURITY_EVENT_DATA_USB_CONTEXT + * <p> + * typedef struct tdDEVICE_SECURITY_EVENT_DATA { + * DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT PciContext; + * DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT UsbContext; + * } DEVICE_SECURITY_EVENT_DATA; + * <p> + */ +public class DeviceSecurityEventDataDeviceContext { +} + diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java new file mode 100644 index 00000000..a6d83580 --- /dev/null +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java @@ -0,0 +1,162 @@ +package hirs.utils.tpm.eventlog.events; + +import hirs.utils.HexUtils; +import hirs.utils.tpm.eventlog.TcgTpmtHa; +import hirs.utils.tpm.eventlog.uefi.UefiConstants; +import lombok.Getter; + +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; + +/** + * Class to process the DeviceSecurityEventDataHeader. + * The first 16 bytes of the event data header MUST be a String based identifier (Signature), + * NUL-terminated. The only currently defined Signature is "SPDM Device Sec" which implies + * the event data is a DEVICE_SECURITY_EVENT_DATA. DEVICE_SECURITY_EVENT_DATA_HEADER contains + * the measurement(s) and hash algorithm (SpdmHashAlg) identifier returned by the SPDM + * "GET_MEASUREMENTS" function. + * <p> + * typedef struct tdDEVICE_SECURITY_EVENT_DATA_HEADER { + * UINT8 Signature[16]; + * UINT16 Version; + * UINT16 Length; + * UINT32 SpdmHashAlg; + * UINT32 DeviceType; + * SPDM_MEASUREMENT_BLOCK SpdmMeasurementBlock; + * UINT64 DevicePathLength; + * UNIT8 DevicePath[DevicePathLength] + * } DEVICE_SECURITY_EVENT_DATA_HEADER; + * <p> + * typedef struct tdSPDM_MEASUREMENT_BLOCK { + * tbd tbdalgorithmId; + * tbd tbddigestSize; + * } SPDM_MEASUREMENT_BLOCK; + * <p> + * typedef struct tdDEVICEPATHLENGTH { + * tbd tbdalgorithmId; + * tbd tbddigestSize; + * } DEVICEPATHLENGTH; + * <p> + * define TPM_ALG_SHA1 (TPM_ALG_ID)(0x0004) + * define TPM_ALG_SHA256 (TPM_ALG_ID)(0x000B) + * define TPM_ALG_SHA384 (TPM_ALG_ID)(0x000C) + * define TPM_ALG_SHA512 (TPM_ALG_ID)(0x000D) + * <p> +// * Notes: Parses event data for an EfiSpecID per Table 5 TCG_EfiSpecIdEvent Example. +// * 1. Should be the first Structure in the log +// * 2. Has an EventType of EV_NO_ACTION (0x00000003) +// * 3. Digest of 20 bytes of all 0's +// * 4. Event content defined as TCG_EfiSpecIDEvent Struct. +// * 5. First 16 bytes of the structure is an ASCII "Spec ID Event03" +// * 6. The version of the log is used to determine which format the Log +// * is to use (sha1 or Crypto Agile) + */ +public class DeviceSecurityEventDataHeader { +// /** +// * Minor Version. +// */ +// @Getter +// private String versionMinor = ""; +// /** +// * Major Version. +// */ +// @Getter +// private String versionMajor = ""; +// /** +// * Specification errata version. +// */ +// @Getter +// private String errata = ""; +// /** +// * Signature (text) data. +// */ +// @Getter +// private String signature = ""; +// /** +// * Platform class. +// */ +// @Getter +// private String platformClass = ""; +// /** +// * Algorithm count. +// */ +// @Getter +// private int numberOfAlg = 0; +// /** +// * True if event log uses Crypto Agile format. +// */ +// @Getter +// private boolean cryptoAgile = false; +// /** +// * Algorithm list. +// */ +// private List<String> algList; +// +// /** +// * EvEfiSpecIdEvent Constructor. +// * +// * @param efiSpecId byte array holding the spec ID Event. +// */ +// public EvEfiSpecIdEvent(final byte[] efiSpecId) { +// algList = new ArrayList<>(); +// byte[] signatureBytes = new byte[UefiConstants.SIZE_16]; +// System.arraycopy(efiSpecId, 0, signatureBytes, 0, UefiConstants.SIZE_16); +// signature = HexUtils.byteArrayToHexString(signatureBytes); +// signature = new String(signatureBytes, StandardCharsets.UTF_8) +// .substring(0, UefiConstants.SIZE_15); +// +// byte[] platformClassBytes = new byte[UefiConstants.SIZE_4]; +// System.arraycopy(efiSpecId, UefiConstants.OFFSET_16, platformClassBytes, 0, +// UefiConstants.SIZE_4); +// platformClass = HexUtils.byteArrayToHexString(platformClassBytes); +// +// byte[] specVersionMinorBytes = new byte[1]; +// System.arraycopy(efiSpecId, UefiConstants.OFFSET_20, specVersionMinorBytes, 0, 1); +// versionMinor = HexUtils.byteArrayToHexString(specVersionMinorBytes); +// +// byte[] specVersionMajorBytes = new byte[1]; +// System.arraycopy(efiSpecId, UefiConstants.OFFSET_21, specVersionMajorBytes, 0, 1); +// versionMajor = HexUtils.byteArrayToHexString(specVersionMajorBytes); +// +// byte[] specErrataBytes = new byte[1]; +// System.arraycopy(efiSpecId, UefiConstants.OFFSET_22, specErrataBytes, 0, 1); +// errata = HexUtils.byteArrayToHexString(specErrataBytes); +// +// byte[] numberOfAlgBytes = new byte[UefiConstants.SIZE_4]; +// System.arraycopy(efiSpecId, UefiConstants.OFFSET_24, numberOfAlgBytes, 0, +// UefiConstants.SIZE_4); +// numberOfAlg = HexUtils.leReverseInt(numberOfAlgBytes); +// +// byte[] algorithmIDBytes = new byte[UefiConstants.SIZE_2]; +// int algLocation = UefiConstants.SIZE_28; +// for (int i = 0; i < numberOfAlg; i++) { +// System.arraycopy(efiSpecId, algLocation + UefiConstants.OFFSET_4 * i, algorithmIDBytes, +// 0, UefiConstants.SIZE_2); +// String alg = TcgTpmtHa.tcgAlgIdToString(HexUtils.leReverseInt(algorithmIDBytes)); +// algList.add(alg); +// } +// if ((algList.size() == 1) && (algList.get(0).compareTo("SHA1") == 0)) { +// cryptoAgile = false; +// } else { +// cryptoAgile = true; +// } +// } +// +// /** +// * Returns a human readable description of the data within this event. +// * +// * @return a description of this event.. +// */ +// public String toString() { +// String specInfo = ""; +// if (signature.equals("Spec ID Event#")) { +// specInfo += "Platform Profile Specification version = " + versionMajor + "." + versionMinor +// + " using errata version" + errata; +// } else { +// specInfo = "EV_NO_ACTION event named " + signature +// + " encountered but support for processing it has not been added to this application"; +// } +// return specInfo; +// } +} 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 new file mode 100644 index 00000000..cd6e01bd --- /dev/null +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataPciContext.java @@ -0,0 +1,4 @@ +package hirs.utils.tpm.eventlog.events; + +public class DeviceSecurityEventDataPciContext { +} diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java index e9755ad1..64d717e8 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java @@ -11,18 +11,13 @@ import java.util.ArrayList; import java.util.List; /** - * Class to process the EV_EFI_SPDM_FIRMWARE_BLOB event using structures: - * 1) DEVICE_SECURITY_EVENT_DATA_HEADER [ delete: TCG_EfiSpecIDEvent] + * Class to process the EV_EFI_SPDM_FIRMWARE_BLOB event using structure DEVICE_SECURITY_EVENT_DATA + * DEVICE_SECURITY_EVENT_DATA has 2 structures: + * 1) DEVICE_SECURITY_EVENT_DATA_HEADER * 2) DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT - * DEVICE_SECURITY_EVENT_DATA_HEADER - * The first 16 bytes of the event data MUST be a String based identifier (Signature), NUL-terminated. - * The only currently defined Signature is "SPDM Device Sec" - * which implies the data is a DEVICE_SECURITY_EVENT_DATA_HEADER. - * DEVICE_SECURITY_EVENT_DATA_HEADER contains the measurement(s) and hash algorithm - * (SpdmHashAlg) identifier returned by the SPDM "GET_MEASUREMENTS" function - * DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT - * DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT is a common SPDM structure which includes the - * identification of the device, device vendor, subsystem, etc for PCI connection devices + * The first 16 bytes of the event data header MUST be a String based identifier (Signature), + * NUL-terminated. The only currently defined Signature is "SPDM Device Sec" + * which implies the event data is a DEVICE_SECURITY_EVENT_DATA. */ public class EvEfiSpdmFirmwareBlob { @@ -31,14 +26,14 @@ public class EvEfiSpdmFirmwareBlob { */ private String signature = ""; /** - * True if the event is a DEVICE_SECURITY_EVENT_DATA_HEADER. + * True if the event is a DEVICE_SECURITY_EVENT_DATA. */ private boolean bDeviceSecurityEventDataHeader = false; /** - * evDeviceSecurityEventDataHeader Object. + * DeviceSecurityEventDataHeader Object. */ @Getter - private evDeviceSecurityEventDataHeader deviceSecurityEventDataHeader = null; + private DeviceSecurityEventDataHeader deviceSecurityEventDataHeader = null; /** * EvEfiSpdmFirmwareBlob constructor. diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/evDeviceSecurityEventDataHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/evDeviceSecurityEventDataHeader.java deleted file mode 100644 index a0c319fa..00000000 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/evDeviceSecurityEventDataHeader.java +++ /dev/null @@ -1,4 +0,0 @@ -package hirs.utils.tpm.eventlog.events; - -public class evDeviceSecurityEventDataHeader { -} diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/evDeviceSecurityEventDataPciContext.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/evDeviceSecurityEventDataPciContext.java deleted file mode 100644 index 77a1368f..00000000 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/evDeviceSecurityEventDataPciContext.java +++ /dev/null @@ -1,4 +0,0 @@ -package hirs.utils.tpm.eventlog.events; - -public class evDeviceSecurityEventDataPciContext { -} From 72be21705ea46287f2ef8180167f2f863382bc23 Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Tue, 9 Apr 2024 16:23:59 -0400 Subject: [PATCH 03/31] completed descriptions for data structures --- .../events/DeviceSecurityEventData.java | 8 +-- .../DeviceSecurityEventDataDeviceContext.java | 16 ++--- .../events/DeviceSecurityEventDataHeader.java | 63 ++++++++++--------- .../DeviceSecurityEventDataPciContext.java | 18 ++++++ .../events/EvEfiSpdmFirmwareBlob.java | 4 +- 5 files changed, 67 insertions(+), 42 deletions(-) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java index 478faa4a..d4de40af 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java @@ -11,10 +11,10 @@ import java.util.List; /** - * Class to process the DeviceSecurityEventData event + * Class to process the DEVICE_SECURITY_EVENT_DATA event per PFP. * DEVICE_SECURITY_EVENT_DATA has 2 structures: * 1) DEVICE_SECURITY_EVENT_DATA_HEADER - * 2) DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT + * 2) DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT * DEVICE_SECURITY_EVENT_DATA_HEADER * The first 16 bytes of the event data header MUST be a String based identifier (Signature), * NUL-terminated. The only currently defined Signature is "SPDM Device Sec" which implies @@ -30,11 +30,11 @@ import java.util.List; * DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT DeviceContext; * } DEVICE_SECURITY_EVENT_DATA; * <p> - * Notes: Parses event data for an DEVICE_SECURITY_EVENT_DATA per PFP Spec. + * Notes: Parses event data for an DEVICE_SECURITY_EVENT_DATA per PFP v1.06 Rev52 Table 20. * 1. Has an EventType of EV_EFI_SPDM_FIRMWARE_BLOB (0x800000E1) * 2. Digest of 48 bytes * 3. Event content defined as DEVICE_SECURITY_EVENT_DATA Struct. - * 4. First 16 bytes of the structure is an ASCII "SPDM Device Sec" + * 4. First 16 bytes of the structure header is an ASCII "SPDM Device Sec" */ public class DeviceSecurityEventData { diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java index bd12cb92..34b9b28a 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java @@ -1,15 +1,15 @@ package hirs.utils.tpm.eventlog.events; /** - * Class to process the DeviceSecurityEventDataDeviceContext event - * DEVICE_SECURITY_EVENT_DATA has 2 structures: - * 1) DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT - * 2) DEVICE_SECURITY_EVENT_DATA_USB_CONTEXT + * Class to process the DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT event per PFP. + * DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT is a common SPDM structure which includes the + * identification of the device, device vendor, subsystem, etc. Device can be either a PCI + * or USB connection. * <p> - * typedef struct tdDEVICE_SECURITY_EVENT_DATA { - * DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT PciContext; - * DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT UsbContext; - * } DEVICE_SECURITY_EVENT_DATA; + * typedef struct tdDEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT { + * DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT PciContext; + * DEVICE_SECURITY_EVENT_DATA_USB_CONTEXT UsbContext; + * } tdDEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT; * <p> */ public class DeviceSecurityEventDataDeviceContext { diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java index a6d83580..1ad91963 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java @@ -10,47 +10,52 @@ import java.util.ArrayList; import java.util.List; /** - * Class to process the DeviceSecurityEventDataHeader. + * Class to process the DEVICE_SECURITY_EVENT_DATA_HEADER per PFP. * The first 16 bytes of the event data header MUST be a String based identifier (Signature), * NUL-terminated. The only currently defined Signature is "SPDM Device Sec" which implies * the event data is a DEVICE_SECURITY_EVENT_DATA. DEVICE_SECURITY_EVENT_DATA_HEADER contains * the measurement(s) and hash algorithm (SpdmHashAlg) identifier returned by the SPDM * "GET_MEASUREMENTS" function. * <p> + * PFP v1.06 Rev 52: * typedef struct tdDEVICE_SECURITY_EVENT_DATA_HEADER { - * UINT8 Signature[16]; - * UINT16 Version; - * UINT16 Length; - * UINT32 SpdmHashAlg; - * UINT32 DeviceType; - * SPDM_MEASUREMENT_BLOCK SpdmMeasurementBlock; - * UINT64 DevicePathLength; - * UNIT8 DevicePath[DevicePathLength] + * UINT8 Signature[16]; + * UINT16 Version; + * UINT16 Length; + * UINT32 SpdmHashAlg; + * UINT32 DeviceType; + * SPDM_MEASUREMENT_BLOCK SpdmMeasurementBlock; + * UINT64 DevicePathLength; + * UNIT8 DevicePath[DevicePathLength] * } DEVICE_SECURITY_EVENT_DATA_HEADER; * <p> - * typedef struct tdSPDM_MEASUREMENT_BLOCK { - * tbd tbdalgorithmId; - * tbd tbddigestSize; - * } SPDM_MEASUREMENT_BLOCK; + * SPDM_MEASUREMENT_BLOCK: + * SPDM v1.03, Sect 10.11.1, Table 53: + * Measurement block format { + * Index 1 byte; + * MeasurementSpec 1 byte; + * MeasurementSize 2 bytes; + * Measurement <MeasurementSize> bytes; + * } * <p> - * typedef struct tdDEVICEPATHLENGTH { - * tbd tbdalgorithmId; - * tbd tbddigestSize; - * } DEVICEPATHLENGTH; + * SPDM v1.03, SPDM 10.11.1, Table 54: + * DMTF measurement spec format { + * DMTFSpecMeasurementValueType 1 byte; + * DMTFSpecMeasurementValueSize 2 bytes; + * DMTFSpecMeasurementValue <DMTFSpecMeasurementValueSize> bytes; + * } * <p> - * define TPM_ALG_SHA1 (TPM_ALG_ID)(0x0004) - * define TPM_ALG_SHA256 (TPM_ALG_ID)(0x000B) - * define TPM_ALG_SHA384 (TPM_ALG_ID)(0x000C) - * define TPM_ALG_SHA512 (TPM_ALG_ID)(0x000D) + * DMTFSpecMeasurementValueType[7] + * Indicates how bits [0:6] are represented + * Bit = 0: Digest + * Bit = 1: Raw bit stream + * DMTFSpecMeasurementValueType[6:0] + * Immutable ROM 0x0 + * Mutable firmware 0x1 + * Hardware configuration 0x2 + * Firmware configuration 0x3 + * etc. * <p> -// * Notes: Parses event data for an EfiSpecID per Table 5 TCG_EfiSpecIdEvent Example. -// * 1. Should be the first Structure in the log -// * 2. Has an EventType of EV_NO_ACTION (0x00000003) -// * 3. Digest of 20 bytes of all 0's -// * 4. Event content defined as TCG_EfiSpecIDEvent Struct. -// * 5. First 16 bytes of the structure is an ASCII "Spec ID Event03" -// * 6. The version of the log is used to determine which format the Log -// * is to use (sha1 or Crypto Agile) */ public class DeviceSecurityEventDataHeader { // /** 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 cd6e01bd..174dab66 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 @@ -1,4 +1,22 @@ package hirs.utils.tpm.eventlog.events; + +/** + * Class to process the DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT event per PFP. + * DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT is an SPDM structure which includes the + * identification of the device, device vendor, subsystem, etc. for a PCI device. + * <p> + * typedef struct DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT { + * UINT16 Version; + * UINT16 Length; + * UINT16 VendorId; + * UINT16 DeviceId; + * UINT8 RevisionID; + * UINT8 ClassCode[3]; + * UINT16 SubsystemVendorID; + * UINT16 SubsystemID; + * } DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT; + * <p> + */ public class DeviceSecurityEventDataPciContext { } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java index 64d717e8..8ea069fe 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java @@ -14,7 +14,9 @@ import java.util.List; * Class to process the EV_EFI_SPDM_FIRMWARE_BLOB event using structure DEVICE_SECURITY_EVENT_DATA * DEVICE_SECURITY_EVENT_DATA has 2 structures: * 1) DEVICE_SECURITY_EVENT_DATA_HEADER - * 2) DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT + * 2) DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT, which has 2 structures + * a) DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT + * b) DEVICE_SECURITY_EVENT_DATA_USB_CONTEXT * The first 16 bytes of the event data header MUST be a String based identifier (Signature), * NUL-terminated. The only currently defined Signature is "SPDM Device Sec" * which implies the event data is a DEVICE_SECURITY_EVENT_DATA. From 11297d26c2f32257efeea19f0ddfb634f9b61469 Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Tue, 9 Apr 2024 16:41:13 -0400 Subject: [PATCH 04/31] additional descriptions for data structures --- .../events/EvEfiSpdmFirmwareBlob.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java index 8ea069fe..e4fb7150 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java @@ -11,15 +11,25 @@ import java.util.ArrayList; import java.util.List; /** - * Class to process the EV_EFI_SPDM_FIRMWARE_BLOB event using structure DEVICE_SECURITY_EVENT_DATA + * Class to process the EV_EFI_SPDM_FIRMWARE_BLOB event. The event field MUST be a + * 1) DEVICE_SECURITY_EVENT_DATA or + * 1) DEVICE_SECURITY_EVENT_DATA2 * DEVICE_SECURITY_EVENT_DATA has 2 structures: * 1) DEVICE_SECURITY_EVENT_DATA_HEADER * 2) DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT, which has 2 structures * a) DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT * b) DEVICE_SECURITY_EVENT_DATA_USB_CONTEXT + * DEVICE_SECURITY_EVENT_DATA2 has 3 structures: + * 1) DEVICE_SECURITY_EVENT_DATA_HEADER2 + * 2) DEVICE_SECURITY_EVENT_DATA_SUB_HEADER + * 3) DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT, which has 2 structures (see above) * The first 16 bytes of the event data header MUST be a String based identifier (Signature), - * NUL-terminated. The only currently defined Signature is "SPDM Device Sec" - * which implies the event data is a DEVICE_SECURITY_EVENT_DATA. + * NUL-terminated, per PFP. The only currently defined Signature is "SPDM Device Sec", + * which implies the data is a DEVICE_SECURITY_EVENT_DATA. + * This event is used to record an extended digest for the firmware of an embedded component + * or an add-in device that supports SPDM “GET_MEASUREMENTS” functionality. This event records + * extended digests of SPDM GET_MEASUREMENT responses that correspond to firmware, such as + * immutable ROM, mutable firmware, firmware version, firmware secure version number, etc. */ public class EvEfiSpdmFirmwareBlob { @@ -30,12 +40,12 @@ public class EvEfiSpdmFirmwareBlob { /** * True if the event is a DEVICE_SECURITY_EVENT_DATA. */ - private boolean bDeviceSecurityEventDataHeader = false; + private boolean bDeviceSecurityEventData = false; /** - * DeviceSecurityEventDataHeader Object. + * DeviceSecurityEventData Object. */ @Getter - private DeviceSecurityEventDataHeader deviceSecurityEventDataHeader = null; + private DeviceSecurityEventData deviceSecurityEventData = null; /** * EvEfiSpdmFirmwareBlob constructor. From f1d75beb3ae1445a650cfb7d115985d7713632db Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Tue, 9 Apr 2024 18:02:53 -0400 Subject: [PATCH 05/31] parsing event --- .../events/DeviceSecurityEventData.java | 99 +++++++++++++++++++ .../events/EvEfiSpdmFirmwareBlob.java | 42 ++++---- 2 files changed, 120 insertions(+), 21 deletions(-) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java index d4de40af..c2d74566 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java @@ -37,5 +37,104 @@ import java.util.List; * 4. First 16 bytes of the structure header is an ASCII "SPDM Device Sec" */ public class DeviceSecurityEventData { +// /** +// * Minor Version. +// */ +// @Getter +// private String versionMinor = ""; +// /** +// * Major Version. +// */ +// @Getter +// private String versionMajor = ""; +// /** +// * Specification errata version. +// */ +// @Getter +// private String errata = ""; + /** + * Signature (text) data. + */ + @Getter + private String signature = ""; + /** + * Platform class. + */ + @Getter + private String version = ""; +// /** +// * Algorithm count. +// */ +// @Getter +// private int numberOfAlg = 0; +// /** +// * True if event log uses Crypto Agile format. +// */ +// @Getter +// private boolean cryptoAgile = false; +// /** +// * Algorithm list. +// */ +// private List<String> algList; + /** + * DeviceSecurityEventData Constructor. + * + * @param deviceSecurityEventDataBytes byte array holding the spec ID Event. + */ + public DeviceSecurityEventData(final byte[] deviceSecurityEventDataBytes) { +// algList = new ArrayList<>(); + byte[] signatureBytes = new byte[UefiConstants.SIZE_16]; + System.arraycopy(deviceSecurityEventDataBytes, 0, signatureBytes, 0, UefiConstants.SIZE_16); + //signature = HexUtils.byteArrayToHexString(signatureBytes); + signature = new String(signatureBytes, StandardCharsets.UTF_8) + .substring(0, UefiConstants.SIZE_15); + + byte[] versionBytes = new byte[UefiConstants.SIZE_4]; + System.arraycopy(deviceSecurityEventDataBytes, UefiConstants.OFFSET_16, versionBytes, 0, + UefiConstants.SIZE_4); + version = HexUtils.byteArrayToHexString(versionBytes); + + if (version == "1") { + + } else if (version == "2") { + + } + +// byte[] platformClassBytes = new byte[UefiConstants.SIZE_4]; +// System.arraycopy(efiSpecId, UefiConstants.OFFSET_16, platformClassBytes, 0, +// UefiConstants.SIZE_4); +// platformClass = HexUtils.byteArrayToHexString(platformClassBytes); +// +// byte[] specVersionMinorBytes = new byte[1]; +// System.arraycopy(efiSpecId, UefiConstants.OFFSET_20, specVersionMinorBytes, 0, 1); +// versionMinor = HexUtils.byteArrayToHexString(specVersionMinorBytes); +// +// byte[] specVersionMajorBytes = new byte[1]; +// System.arraycopy(efiSpecId, UefiConstants.OFFSET_21, specVersionMajorBytes, 0, 1); +// versionMajor = HexUtils.byteArrayToHexString(specVersionMajorBytes); +// +// byte[] specErrataBytes = new byte[1]; +// System.arraycopy(efiSpecId, UefiConstants.OFFSET_22, specErrataBytes, 0, 1); +// errata = HexUtils.byteArrayToHexString(specErrataBytes); +// +// byte[] numberOfAlgBytes = new byte[UefiConstants.SIZE_4]; +// System.arraycopy(efiSpecId, UefiConstants.OFFSET_24, numberOfAlgBytes, 0, +// UefiConstants.SIZE_4); +// numberOfAlg = HexUtils.leReverseInt(numberOfAlgBytes); +// +// byte[] algorithmIDBytes = new byte[UefiConstants.SIZE_2]; +// int algLocation = UefiConstants.SIZE_28; +// for (int i = 0; i < numberOfAlg; i++) { +// System.arraycopy(efiSpecId, algLocation + UefiConstants.OFFSET_4 * i, algorithmIDBytes, +// 0, UefiConstants.SIZE_2); +// String alg = TcgTpmtHa.tcgAlgIdToString(HexUtils.leReverseInt(algorithmIDBytes)); +// algList.add(alg); +// } +// if ((algList.size() == 1) && (algList.get(0).compareTo("SHA1") == 0)) { +// cryptoAgile = false; +// } else { +// cryptoAgile = true; +// } + } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java index e4fb7150..42920012 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java @@ -55,22 +55,22 @@ public class EvEfiSpdmFirmwareBlob { */ public EvEfiSpdmFirmwareBlob(final byte[] eventData) throws UnsupportedEncodingException { byte[] signatureBytes = new byte[UefiConstants.SIZE_15]; -// System.arraycopy(eventData, 0, signatureBytes, 0, UefiConstants.SIZE_15); -// signature = new String(signatureBytes, StandardCharsets.UTF_8); -// signature = signature.replaceAll("[^\\P{C}\t\r\n]", ""); // remove null characters -// if (signature.contains("Spec ID Event03")) { // implies CryptAgileFormat -// specIDEvent = new EvEfiSpecIdEvent(eventData); -// bSpecIDEvent = true; -// } + System.arraycopy(eventData, 0, signatureBytes, 0, UefiConstants.SIZE_15); + signature = new String(signatureBytes, StandardCharsets.UTF_8); + signature = signature.replaceAll("[^\\P{C}\t\r\n]", ""); // remove null characters + if (signature.contains("SPDM Device Sec")) { // implies Device Security event + deviceSecurityEventData = new DeviceSecurityEventData(eventData); + bDeviceSecurityEventData = true; + } } /** - * Determines if this event is a SpecIDEvent. + * Determines if this event is a DeviceSecurityEventData. * - * @return true of the event is a SpecIDEvent. + * @return true of the event is a DeviceSecurityEventData. */ - public boolean isDeviceSecurityEventDataHeader() { - return bDeviceSecurityEventDataHeader; + public boolean isDeviceSecurityEventData() { + return bDeviceSecurityEventData; } /** @@ -78,10 +78,10 @@ public class EvEfiSpdmFirmwareBlob { * * @return Human readable description of this event. */ -// public String toString() { -// String specInfo = ""; -// if (bSpecIDEvent) { -// specInfo += " Signature = Spec ID Event03 : "; + public String toString() { + String specInfo = ""; + if (bDeviceSecurityEventData) { + specInfo += " Signature = SPDM Device Sec : "; // if (specIDEvent.isCryptoAgile()) { // specInfo += "Log format is Crypto Agile\n"; // } else { @@ -90,10 +90,10 @@ public class EvEfiSpdmFirmwareBlob { // specInfo += " Platform Profile Specification version = " // + specIDEvent.getVersionMajor() + "." + specIDEvent.getVersionMinor() // + " using errata version " + specIDEvent.getErrata(); -// } else { -// specInfo = "EV_NO_ACTION event named " + signature -// + " encountered but support for processing it has not been added to this application.\n"; -// } -// return specInfo; -// } + } else { + specInfo = "EV_EFI_SPDM_FIRMWARE_BLOB event named " + signature + + " encountered but support for processing it has not been added to this application.\n"; + } + return specInfo; + } } From a1534a9c7bc89b8b66d8c2b8f164de00a75a0209 Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:46:37 -0400 Subject: [PATCH 06/31] SPDM processing --- .../events/DeviceSecurityEventData.java | 160 ++++++++---------- .../DeviceSecurityEventDataDeviceContext.java | 40 +++++ .../events/DeviceSecurityEventDataHeader.java | 95 +++++------ .../DeviceSecurityEventDataPciContext.java | 22 --- .../events/EvEfiSpdmFirmwareBlob.java | 15 +- 5 files changed, 167 insertions(+), 165 deletions(-) delete mode 100644 HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataPciContext.java diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java index c2d74566..5d98b8bd 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java @@ -3,6 +3,7 @@ package hirs.utils.tpm.eventlog.events; import hirs.utils.HexUtils; import hirs.utils.tpm.eventlog.TcgTpmtHa; import hirs.utils.tpm.eventlog.uefi.UefiConstants; +import jakarta.persistence.criteria.CriteriaBuilder; import lombok.Getter; import java.nio.charset.StandardCharsets; @@ -11,25 +12,33 @@ import java.util.List; /** - * Class to process the DEVICE_SECURITY_EVENT_DATA event per PFP. - * DEVICE_SECURITY_EVENT_DATA has 2 structures: - * 1) DEVICE_SECURITY_EVENT_DATA_HEADER - * 2) DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT - * DEVICE_SECURITY_EVENT_DATA_HEADER - * The first 16 bytes of the event data header MUST be a String based identifier (Signature), - * NUL-terminated. The only currently defined Signature is "SPDM Device Sec" which implies - * the event data is a DEVICE_SECURITY_EVENT_DATA. DEVICE_SECURITY_EVENT_DATA_HEADER contains - * the measurement(s) and hash algorithm (SpdmHashAlg) identifier returned by the SPDM - * "GET_MEASUREMENTS" function. - * DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT - * DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT is a common SPDM structure which includes the - * identification of the device, device vendor, subsystem, etc. + * Class to process the DEVICE_SECURITY_EVENT_DATA or ..DATA2 event per PFP. + * The event data comes in 2 forms: + * 1) DEVICE_SECURITY_EVENT_DATA or + * 2) DEVICE_SECURITY_EVENT_DATA2 + * The first 16 bytes of the event data header MUST be a String based identifier (Signature), + * NUL-terminated, per PFP. The only currently defined Signature is "SPDM Device Sec", which + * implies the data is a DEVICE_SECURITY_EVENT_DATA or ..DATA2. The Version field indicates + * whether it is ..DATA or ..DATA2. + * + * DEVICE SECURITY EVENT structures defined by PFP v1.06 Rev 52: * <p> * typedef struct tdDEVICE_SECURITY_EVENT_DATA { * DEVICE_SECURITY_EVENT_DATA_HEADER EventDataHeader; * DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT DeviceContext; * } DEVICE_SECURITY_EVENT_DATA; * <p> + * typedef struct tdDEVICE_SECURITY_EVENT_DATA2 { + * DEVICE_SECURITY_EVENT_DATA_HEADER2 EventDataHeader; + * DEVICE_SECURITY_EVENT_DATA_SUB_HEADER EventDataSubHeader; + * DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT DeviceContext; + * } DEVICE_SECURITY_EVENT_DATA; + * <p> + * typedef struct tdDEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT { + * DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT PciContext; + * DEVICE_SECURITY_EVENT_DATA_USB_CONTEXT UsbContext; + * } DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT; + * <p> * Notes: Parses event data for an DEVICE_SECURITY_EVENT_DATA per PFP v1.06 Rev52 Table 20. * 1. Has an EventType of EV_EFI_SPDM_FIRMWARE_BLOB (0x800000E1) * 2. Digest of 48 bytes @@ -37,104 +46,79 @@ import java.util.List; * 4. First 16 bytes of the structure header is an ASCII "SPDM Device Sec" */ public class DeviceSecurityEventData { -// /** -// * Minor Version. -// */ -// @Getter -// private String versionMinor = ""; -// /** -// * Major Version. -// */ -// @Getter -// private String versionMajor = ""; -// /** -// * Specification errata version. -// */ -// @Getter -// private String errata = ""; + /** * Signature (text) data. */ @Getter private String signature = ""; /** - * Platform class. + * Version determines data structure used (..DATA or ..DATA2). + */ +// @Getter +// private String version = ""; +// /** +// * Contains the human-readable info inside the Device Security Event. +// */ + @Getter + private String dSEDinfo = ""; + /** + * DeviceSecurityEventDataHeader Object. */ @Getter - private String version = ""; -// /** -// * Algorithm count. -// */ -// @Getter -// private int numberOfAlg = 0; -// /** -// * True if event log uses Crypto Agile format. -// */ -// @Getter -// private boolean cryptoAgile = false; -// /** -// * Algorithm list. -// */ -// private List<String> algList; + private DeviceSecurityEventDataHeader dSEDheader = null; + /** + * DeviceSecurityEventDataSubHeader Object. + */ + @Getter + private DeviceSecurityEventDataHeader dSEDsubHeader = null; + /** + * DeviceSecurityEventDataDeviceContext Object. + */ + @Getter + private DeviceSecurityEventDataDeviceContext dSEDdeviceContext = null; /** * DeviceSecurityEventData Constructor. * - * @param deviceSecurityEventDataBytes byte array holding the spec ID Event. + * @param dSEDbytes byte array holding the DeviceSecurityEventData. */ - public DeviceSecurityEventData(final byte[] deviceSecurityEventDataBytes) { -// algList = new ArrayList<>(); + public DeviceSecurityEventData(final byte[] dSEDbytes) { + byte[] signatureBytes = new byte[UefiConstants.SIZE_16]; - System.arraycopy(deviceSecurityEventDataBytes, 0, signatureBytes, 0, UefiConstants.SIZE_16); + System.arraycopy(dSEDbytes, 0, signatureBytes, 0, UefiConstants.SIZE_16); //signature = HexUtils.byteArrayToHexString(signatureBytes); signature = new String(signatureBytes, StandardCharsets.UTF_8) .substring(0, UefiConstants.SIZE_15); byte[] versionBytes = new byte[UefiConstants.SIZE_4]; - System.arraycopy(deviceSecurityEventDataBytes, UefiConstants.OFFSET_16, versionBytes, 0, + System.arraycopy(dSEDbytes, UefiConstants.OFFSET_16, versionBytes, 0, UefiConstants.SIZE_4); - version = HexUtils.byteArrayToHexString(versionBytes); + String version = HexUtils.byteArrayToHexString(versionBytes); + + // If version is 0x01, the event is a DEVICE_SECURITY_EVENT_DATA + // If version is 0x02, the event is a DEVICE_SECURITY_EVENT_DATA2 + int byteOffset = 0; + dSEDheader = new DeviceSecurityEventDataHeader(dSEDbytes); + byteOffset = dSEDheader.getDSEDheaderByteSize(); + if (version == "2") { +// dSEDsubHeader = new DeviceSecurityEventDataSubHeader(dSEDbytes,byteOffset); +// byteOffset = dSEDheader.getDSEDsubHeaderByteSize(); + } + dSEDdeviceContext = new DeviceSecurityEventDataDeviceContext(dSEDbytes, byteOffset); if (version == "1") { - + dSEDinfo =+ + dSEDataHeader.getDSEDheaderInfo(); + dSEDinfo =+ + dSEDdeviceContext.getdSEDdeviceContextInfo(); } else if (version == "2") { - + dSEDinfo =+ + dSEDheader.getDSEDheaderInfo(); + dSEDinfo =+ + dSEDsubHeader.getDSEDsubHeaderInfo(); + dSEDinfo =+ + dSEDdeviceContext.getDSEDdeviceContextInfo(); } - -// byte[] platformClassBytes = new byte[UefiConstants.SIZE_4]; -// System.arraycopy(efiSpecId, UefiConstants.OFFSET_16, platformClassBytes, 0, -// UefiConstants.SIZE_4); -// platformClass = HexUtils.byteArrayToHexString(platformClassBytes); -// -// byte[] specVersionMinorBytes = new byte[1]; -// System.arraycopy(efiSpecId, UefiConstants.OFFSET_20, specVersionMinorBytes, 0, 1); -// versionMinor = HexUtils.byteArrayToHexString(specVersionMinorBytes); -// -// byte[] specVersionMajorBytes = new byte[1]; -// System.arraycopy(efiSpecId, UefiConstants.OFFSET_21, specVersionMajorBytes, 0, 1); -// versionMajor = HexUtils.byteArrayToHexString(specVersionMajorBytes); -// -// byte[] specErrataBytes = new byte[1]; -// System.arraycopy(efiSpecId, UefiConstants.OFFSET_22, specErrataBytes, 0, 1); -// errata = HexUtils.byteArrayToHexString(specErrataBytes); -// -// byte[] numberOfAlgBytes = new byte[UefiConstants.SIZE_4]; -// System.arraycopy(efiSpecId, UefiConstants.OFFSET_24, numberOfAlgBytes, 0, -// UefiConstants.SIZE_4); -// numberOfAlg = HexUtils.leReverseInt(numberOfAlgBytes); -// -// byte[] algorithmIDBytes = new byte[UefiConstants.SIZE_2]; -// int algLocation = UefiConstants.SIZE_28; -// for (int i = 0; i < numberOfAlg; i++) { -// System.arraycopy(efiSpecId, algLocation + UefiConstants.OFFSET_4 * i, algorithmIDBytes, -// 0, UefiConstants.SIZE_2); -// String alg = TcgTpmtHa.tcgAlgIdToString(HexUtils.leReverseInt(algorithmIDBytes)); -// algList.add(alg); -// } -// if ((algList.size() == 1) && (algList.get(0).compareTo("SHA1") == 0)) { -// cryptoAgile = false; -// } else { -// cryptoAgile = true; -// } } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java index 34b9b28a..286ebc31 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java @@ -1,5 +1,11 @@ package hirs.utils.tpm.eventlog.events; +import hirs.utils.HexUtils; +import hirs.utils.tpm.eventlog.uefi.UefiConstants; +import lombok.Getter; + +import java.nio.charset.StandardCharsets; + /** * Class to process the DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT event per PFP. * DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT is a common SPDM structure which includes the @@ -13,5 +19,39 @@ package hirs.utils.tpm.eventlog.events; * <p> */ public class DeviceSecurityEventDataDeviceContext { + + /** + * Contains the human-readable info inside the Device Security Event Data Device Context structure. + */ + @Getter + private String dSEDdeviceContextInfo = ""; + /** + * PCI Version. + */ + @Getter + private String pciVersion = ""; + /** + * PCI Length. + */ + @Getter + private String pciLength = ""; + + public DeviceSecurityEventDataDeviceContext(final byte[] dSEDbytes, int byteStartOffset) { + + int byteOffset = byteStartOffset; + + byte[] pciVersionBytes = new byte[UefiConstants.SIZE_16]; + System.arraycopy(dSEDbytes, byteOffset, pciVersionBytes, 0, UefiConstants.SIZE_16); + pciVersion = new String(pciVersionBytes, StandardCharsets.UTF_8) + .substring(0, UefiConstants.SIZE_15); + + byteOffset += UefiConstants.SIZE_16; + byte[] pciLengthBytes = new byte[UefiConstants.SIZE_4]; + System.arraycopy(dSEDbytes, byteOffset, pciLengthBytes, 0, + UefiConstants.SIZE_16); + pciLength = HexUtils.byteArrayToHexString(pciLengthBytes); + + + } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java index 1ad91963..28348eeb 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java @@ -10,14 +10,15 @@ import java.util.ArrayList; import java.util.List; /** - * Class to process the DEVICE_SECURITY_EVENT_DATA_HEADER per PFP. + * Class to process the DEVICE_SECURITY_EVENT_DATA_HEADER or ..HEADER2 per PFP. * The first 16 bytes of the event data header MUST be a String based identifier (Signature), - * NUL-terminated. The only currently defined Signature is "SPDM Device Sec" which implies - * the event data is a DEVICE_SECURITY_EVENT_DATA. DEVICE_SECURITY_EVENT_DATA_HEADER contains - * the measurement(s) and hash algorithm (SpdmHashAlg) identifier returned by the SPDM - * "GET_MEASUREMENTS" function. + * NUL-terminated, per PFP. The only currently defined Signature is "SPDM Device Sec", + * which implies the data is a DEVICE_SECURITY_EVENT_DATA or ..DATA2. + * DEVICE_SECURITY_EVENT_DATA_HEADER contains the measurement(s) and hash algorithm identifier + * returned by the SPDM "GET_MEASUREMENTS" function. + * + * HEADERS defined by PFP v1.06 Rev 52: * <p> - * PFP v1.06 Rev 52: * typedef struct tdDEVICE_SECURITY_EVENT_DATA_HEADER { * UINT8 Signature[16]; * UINT16 Version; @@ -29,8 +30,22 @@ import java.util.List; * UNIT8 DevicePath[DevicePathLength] * } DEVICE_SECURITY_EVENT_DATA_HEADER; * <p> - * SPDM_MEASUREMENT_BLOCK: - * SPDM v1.03, Sect 10.11.1, Table 53: + * typedef struct tdDEVICE_SECURITY_EVENT_DATA_HEADER2 { + * UINT8 Signature[16]; + * UINT16 Version; + * UINT8 AuthState; + * UINT8 Reserved; + * UINT32 Length; + * UINT32 DeviceType; + * UINT32 SubHeaderType; + * UINT32 SubHeaderLength; + * UINT32 SubHeaderUID; + * UINT64 DevicePathLength; + * UNIT8 DevicePath[DevicePathLength] + * } DEVICE_SECURITY_EVENT_DATA_HEADER2; + * + * SPDM_MEASUREMENT_BLOCK and contents defined by SPDM v1.03, Sect 10.11.1, Table 53 and 54: + * <p> * Measurement block format { * Index 1 byte; * MeasurementSpec 1 byte; @@ -38,7 +53,6 @@ import java.util.List; * Measurement <MeasurementSize> bytes; * } * <p> - * SPDM v1.03, SPDM 10.11.1, Table 54: * DMTF measurement spec format { * DMTFSpecMeasurementValueType 1 byte; * DMTFSpecMeasurementValueSize 2 bytes; @@ -58,45 +72,28 @@ import java.util.List; * <p> */ public class DeviceSecurityEventDataHeader { -// /** -// * Minor Version. -// */ -// @Getter -// private String versionMinor = ""; -// /** -// * Major Version. -// */ -// @Getter -// private String versionMajor = ""; -// /** -// * Specification errata version. -// */ -// @Getter -// private String errata = ""; -// /** -// * Signature (text) data. -// */ -// @Getter -// private String signature = ""; -// /** -// * Platform class. -// */ -// @Getter -// private String platformClass = ""; -// /** -// * Algorithm count. -// */ -// @Getter -// private int numberOfAlg = 0; -// /** -// * True if event log uses Crypto Agile format. -// */ -// @Getter -// private boolean cryptoAgile = false; -// /** -// * Algorithm list. -// */ -// private List<String> algList; + + /** + * Signature (text) data. + */ + @Getter + private String signature = ""; + /** + * Version determines data structure used (..DATA or ..DATA2), + * which determines whether ..HEADER or ..HEADER2 is used + */ + @Getter + private String version = ""; + /** + * Contains the human-readable info inside the Device Security Event. + */ + @Getter + private String dSEDheaderInfo = ""; + /** + * Contains the size (in bytes) of the Header. + */ + @Getter + private Integer dSEDheaderByteSize = 0; // // /** // * EvEfiSpecIdEvent Constructor. @@ -164,4 +161,6 @@ public class DeviceSecurityEventDataHeader { // } // return specInfo; // } + + } 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 deleted file mode 100644 index 174dab66..00000000 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataPciContext.java +++ /dev/null @@ -1,22 +0,0 @@ -package hirs.utils.tpm.eventlog.events; - - -/** - * Class to process the DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT event per PFP. - * DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT is an SPDM structure which includes the - * identification of the device, device vendor, subsystem, etc. for a PCI device. - * <p> - * typedef struct DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT { - * UINT16 Version; - * UINT16 Length; - * UINT16 VendorId; - * UINT16 DeviceId; - * UINT8 RevisionID; - * UINT8 ClassCode[3]; - * UINT16 SubsystemVendorID; - * UINT16 SubsystemID; - * } DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT; - * <p> - */ -public class DeviceSecurityEventDataPciContext { -} diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java index 42920012..f5c49860 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java @@ -12,8 +12,8 @@ import java.util.List; /** * Class to process the EV_EFI_SPDM_FIRMWARE_BLOB event. The event field MUST be a - * 1) DEVICE_SECURITY_EVENT_DATA or - * 1) DEVICE_SECURITY_EVENT_DATA2 + * 1) DEVICE_SECURITY_EVENT_DATA or + * 2) DEVICE_SECURITY_EVENT_DATA2 * DEVICE_SECURITY_EVENT_DATA has 2 structures: * 1) DEVICE_SECURITY_EVENT_DATA_HEADER * 2) DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT, which has 2 structures @@ -25,11 +25,12 @@ import java.util.List; * 3) DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT, which has 2 structures (see above) * The first 16 bytes of the event data header MUST be a String based identifier (Signature), * NUL-terminated, per PFP. The only currently defined Signature is "SPDM Device Sec", - * which implies the data is a DEVICE_SECURITY_EVENT_DATA. - * This event is used to record an extended digest for the firmware of an embedded component - * or an add-in device that supports SPDM “GET_MEASUREMENTS” functionality. This event records - * extended digests of SPDM GET_MEASUREMENT responses that correspond to firmware, such as - * immutable ROM, mutable firmware, firmware version, firmware secure version number, etc. + * which implies the data is a DEVICE_SECURITY_EVENT_DATA or ..DATA2. + * The EV_EFI_SPDM_FIRMWARE_BLOB event is used to record an extended digest for the firmware of + * an embedded component or an add-in device that supports SPDM “GET_MEASUREMENTS” functionality. + * This event records extended digests of SPDM GET_MEASUREMENT responses that correspond to + * firmware, such as immutable ROM, mutable firmware, firmware version, firmware secure version + * number, etc. */ public class EvEfiSpdmFirmwareBlob { From e1844dedbd446ffc98dd8699c4a4ba46a0e9e589 Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Wed, 10 Apr 2024 12:02:01 -0400 Subject: [PATCH 07/31] SPDM processing --- .../DeviceSecurityEventDataDeviceContext.java | 5 +++ .../events/DeviceSecurityEventDataHeader.java | 34 ++++++++++++------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java index 286ebc31..34bdd300 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java @@ -36,6 +36,11 @@ public class DeviceSecurityEventDataDeviceContext { @Getter private String pciLength = ""; + /** + * DeviceSecurityEventDataDeviceContext Constructor. + * + * @param dSEDbytes byte array holding the DeviceSecurityEventData. + */ public DeviceSecurityEventDataDeviceContext(final byte[] dSEDbytes, int byteStartOffset) { int byteOffset = byteStartOffset; diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java index 28348eeb..1bee8f51 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java @@ -73,6 +73,16 @@ import java.util.List; */ public class DeviceSecurityEventDataHeader { + /** + * Contains the human-readable info inside the Device Security Event. + */ + @Getter + private String dSEDheaderInfo = ""; + /** + * Contains the size (in bytes) of the Header. + */ + @Getter + private Integer dSEDheaderByteSize = 0; /** * Signature (text) data. */ @@ -85,22 +95,22 @@ public class DeviceSecurityEventDataHeader { @Getter private String version = ""; /** - * Contains the human-readable info inside the Device Security Event. + * Event Data Length. */ @Getter - private String dSEDheaderInfo = ""; + private String length = ""; /** - * Contains the size (in bytes) of the Header. + * Signature (text) data. */ @Getter - private Integer dSEDheaderByteSize = 0; -// -// /** -// * EvEfiSpecIdEvent Constructor. -// * -// * @param efiSpecId byte array holding the spec ID Event. -// */ -// public EvEfiSpecIdEvent(final byte[] efiSpecId) { + private String spdmHashAlgo = ""; + + /** + * DeviceSecurityEventDataHeader Constructor. + * + * @param dSEDbytes byte array holding the DeviceSecurityEventData. + */ + public DeviceSecurityEventDataHeader(final byte[] dSEDbytes) { // algList = new ArrayList<>(); // byte[] signatureBytes = new byte[UefiConstants.SIZE_16]; // System.arraycopy(efiSpecId, 0, signatureBytes, 0, UefiConstants.SIZE_16); @@ -143,7 +153,7 @@ public class DeviceSecurityEventDataHeader { // } else { // cryptoAgile = true; // } -// } + } // // /** // * Returns a human readable description of the data within this event. From e96da43a4859db22c32195284f8e94329e89abed Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Mon, 15 Apr 2024 17:56:23 -0400 Subject: [PATCH 08/31] spdm processing --- .../events/DeviceSecurityEventData.java | 22 +++++--- .../events/DeviceSecurityEventDataHeader.java | 50 ++++++++++++------- 2 files changed, 47 insertions(+), 25 deletions(-) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java index 5d98b8bd..779d2c3e 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java @@ -18,8 +18,8 @@ import java.util.List; * 2) DEVICE_SECURITY_EVENT_DATA2 * The first 16 bytes of the event data header MUST be a String based identifier (Signature), * NUL-terminated, per PFP. The only currently defined Signature is "SPDM Device Sec", which - * implies the data is a DEVICE_SECURITY_EVENT_DATA or ..DATA2. The Version field indicates - * whether it is ..DATA or ..DATA2. + * implies the data is a DEVICE_SECURITY_EVENT_DATA or ..DATA2. The Version field in the HEADER + * or HEADER2 indicates whether the Device Security Event is ..DATA or ..DATA2. * * DEVICE SECURITY EVENT structures defined by PFP v1.06 Rev 52: * <p> @@ -34,6 +34,12 @@ import java.util.List; * DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT DeviceContext; * } DEVICE_SECURITY_EVENT_DATA; * <p> + * typedef struct tdDEVICE_SECURITY_EVENT_DATA_HEADER or HEADER2 { + * UINT8 Signature[16]; + * UINT16 Version; + * ... ... + * } + * <p> * typedef struct tdDEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT { * DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT PciContext; * DEVICE_SECURITY_EVENT_DATA_USB_CONTEXT UsbContext; @@ -55,11 +61,11 @@ public class DeviceSecurityEventData { /** * Version determines data structure used (..DATA or ..DATA2). */ -// @Getter -// private String version = ""; -// /** -// * Contains the human-readable info inside the Device Security Event. -// */ + @Getter + private String version = ""; + /** + * Contains the human-readable info inside the Device Security Event. + */ @Getter private String dSEDinfo = ""; /** @@ -94,7 +100,7 @@ public class DeviceSecurityEventData { byte[] versionBytes = new byte[UefiConstants.SIZE_4]; System.arraycopy(dSEDbytes, UefiConstants.OFFSET_16, versionBytes, 0, UefiConstants.SIZE_4); - String version = HexUtils.byteArrayToHexString(versionBytes); + version = HexUtils.byteArrayToHexString(versionBytes); // If version is 0x01, the event is a DEVICE_SECURITY_EVENT_DATA // If version is 0x02, the event is a DEVICE_SECURITY_EVENT_DATA2 diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java index 1bee8f51..772b766e 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java @@ -95,15 +95,20 @@ public class DeviceSecurityEventDataHeader { @Getter private String version = ""; /** - * Event Data Length. + * Event data length. */ @Getter private String length = ""; /** - * Signature (text) data. + * SPDM hash algorithm. */ @Getter private String spdmHashAlgo = ""; + /** + * Device type. + */ + @Getter + private String deviceType = ""; /** * DeviceSecurityEventDataHeader Constructor. @@ -112,21 +117,32 @@ public class DeviceSecurityEventDataHeader { */ public DeviceSecurityEventDataHeader(final byte[] dSEDbytes) { // algList = new ArrayList<>(); -// byte[] signatureBytes = new byte[UefiConstants.SIZE_16]; -// System.arraycopy(efiSpecId, 0, signatureBytes, 0, UefiConstants.SIZE_16); -// signature = HexUtils.byteArrayToHexString(signatureBytes); -// signature = new String(signatureBytes, StandardCharsets.UTF_8) -// .substring(0, UefiConstants.SIZE_15); -// -// byte[] platformClassBytes = new byte[UefiConstants.SIZE_4]; -// System.arraycopy(efiSpecId, UefiConstants.OFFSET_16, platformClassBytes, 0, -// UefiConstants.SIZE_4); -// platformClass = HexUtils.byteArrayToHexString(platformClassBytes); -// -// byte[] specVersionMinorBytes = new byte[1]; -// System.arraycopy(efiSpecId, UefiConstants.OFFSET_20, specVersionMinorBytes, 0, 1); -// versionMinor = HexUtils.byteArrayToHexString(specVersionMinorBytes); -// + byte[] signatureBytes = new byte[UefiConstants.SIZE_16]; + System.arraycopy(dSEDbytes, 0, signatureBytes, 0, UefiConstants.SIZE_16); + //signature = HexUtils.byteArrayToHexString(signatureBytes); + signature = new String(signatureBytes, StandardCharsets.UTF_8) + .substring(0, UefiConstants.SIZE_15); + + byte[] versionBytes = new byte[UefiConstants.SIZE_4]; + System.arraycopy(dSEDbytes, UefiConstants.OFFSET_16, versionBytes, 0, + UefiConstants.SIZE_4); + version = HexUtils.byteArrayToHexString(versionBytes); + + byte[] lengthBytes = new byte[UefiConstants.SIZE_4]; + System.arraycopy(dSEDbytes, UefiConstants.OFFSET_20, lengthBytes, 0, + UefiConstants.SIZE_4); + length = HexUtils.byteArrayToHexString(lengthBytes); + + byte[] spdmHashAlgoBytes = new byte[UefiConstants.SIZE_8]; + System.arraycopy(dSEDbytes, UefiConstants.OFFSET_24, spdmHashAlgoBytes, 0, + UefiConstants.SIZE_4); + spdmHashAlgo = HexUtils.byteArrayToHexString(spdmHashAlgoBytes); + + byte[] deviceTypeBytes = new byte[UefiConstants.SIZE_8]; + System.arraycopy(dSEDbytes, UefiConstants.OFFSET_24, deviceTypeBytes, 0, + UefiConstants.SIZE_4); + deviceType = HexUtils.byteArrayToHexString(deviceTypeBytes); + // byte[] specVersionMajorBytes = new byte[1]; // System.arraycopy(efiSpecId, UefiConstants.OFFSET_21, specVersionMajorBytes, 0, 1); // versionMajor = HexUtils.byteArrayToHexString(specVersionMajorBytes); From 49108ab144d7ef04715e6b127db3d53010d38c5d Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Tue, 16 Apr 2024 19:38:32 -0400 Subject: [PATCH 09/31] spdm processing --- ...os_measurements_addEvt11asSPDMFirmwareBlob | Bin 0 -> 23866 bytes .../hirs/utils/tpm/eventlog/TpmPcrEvent.java | 4 ++ .../events/DeviceSecurityEventData.java | 46 +++++++++++++----- .../events/EvEfiSpdmFirmwareBlob.java | 1 + 4 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 0_temp/binary_bios_measurements_addEvt11asSPDMFirmwareBlob diff --git a/0_temp/binary_bios_measurements_addEvt11asSPDMFirmwareBlob b/0_temp/binary_bios_measurements_addEvt11asSPDMFirmwareBlob new file mode 100644 index 0000000000000000000000000000000000000000..1feda691732602357492bc27fd0bdcec33f33edd GIT binary patch literal 23866 zcmd_S1zc2Jy9YXScPauyC=D}oDxK1eGz>7*(4k0&f+zx_peQ90l8Ur63P>X%AS$3p z2$CWKcW*#n9evODefPZQ{Lb&*4SUb5J^%HrXFY2@wRS)t5C|5q|7l|ZPU?Fg?4W9j zP$fTvyAMq05QYiC!~nh#L7<0aJmBN-#N3D1$)#geg>$K*rgK*x7(VSLRjVO-;f{Qs zA1=>oImrMZ<xwafsEV(RmpxPyVdL%Vg|LU}^C{>VXdY0*|3PfXi%6D0A)KlT%P5p? z8;jtK%Y5wPi<~l#c-#w@YCjv214yPF7XxBOL)n}nt@Q@FDoKz8$jTu*BE)R1-ixt0 zFU7ipnKB&<FnREy;i~CHA@lDV^B>@ofD|C)$M(Sw2*l#xc+{EDLkbjTc^u;}b`%F_ zi|+QmGOC}qC5k3Ye)_U9>q5;5P0UddppMPdOk8Ku07U@_<jpNCo-2e0bPjm{zv@E} z5Icx3#0&V8hoFEz9|+{vX1E(ZMw=nzFdvo)kS)*hwe~Ue$R<#eFUS;?uy8=KDnA2b zgx(D1Q8V2~<EI1BfMl9B-k(W+pdM3ENMp{k;`RNvG62(~Y2@)OZCWepTXKrp$c#BG z94j3bjv1AKg^7WQNv@Mw9~JxINu4ZTXF&IWQzncAmw-E3HF}E#1A_<$0&|2D!3c1% z46$*kFb(zLq%dNzfKQBLfC#YhhEu^Pz%m{&p&rWD-5#okvU7n`!pOmsgv11j2v=9A zn!6o8oEgRlp2H%h{c#Se<7(sMfbw#KY9In(Omrl0QJ5$UE(jBZ!NknyNQB^rMIjhW z)a-wck#G#wpM`*d1HlT%AcMfdF$gikF)$!yP)XTK3yvmil#0aAr6&c7$6gJJ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--Lb2uSE5al{g@!y z6!!`)Pj|2wk493<(ok~6b4I<ylKpvV{D}3S`hh^c<OU`iz8-+x28_2a!U4(Wfb??n zxA8(iFAx$q_#gaAco9v4nb~u7*{`n5mpzcET&KB7XG6`3te>5XP7r;fZbw_k0A6kW zX)^v@f?x+^Y$&%sMgU3SZO6-FRFyU@_f{Ms8g+!bN(qTMcU@Nu9uI0DZpvw(wQ&BA zi4G{U{}+uLN4t!t?X+7g=d4*HBh;)~GDWTV&Zt)vJjkn5&%5FCi|;r{gZu!kMWG4l zADU(hT`U8)EZDTn8eF2}uIQ4}+MPD(`G&vKwR<}ET~4glFY(KfeYA0PwfYlF>j@oA z7QLj$iY?eI-l}ojkGXaB7#u@ozwGKKtT)DO%1l2?71V!6hX5d+3<Ucq<AOkVpmnj? z5bMT7?V={0HldQ=E>{f|c8%x8;N=q}(d^gKQ`^>m$%Bq~b3Bhkm(;GWN6~X~+!uUT z3k|zZ$gYiDBiypMut*nKM~M*?Q~RXgXSQ6C?!cQ=zNfW<TmpV>;HmTfRr>b7>EXaN zw4V}xRP1ZhwwE_W6p{nf4Q|?AyE{3g{`hv_eDPI$O-Cvsh94q2=og@Xz{{UNXNxB3 zK<}|9w<BLGysEp`NTIr7`dJW@rk}LkaPg{JI{jo+QptA_9lC08837=O_`fWtUl&Lc zZEtbJk_)WeeIn#ru7by%znFiwhc5lg4Jh_S*bG&P()SL63nYhG$<LiTIAh}mgrWaM z7SE4#b3_{++k0={F8hkjzaF98>C-IE4zA$7Z%(vZ%TM^_6P4_Tu-}JA?I0t9{6EYv Ba-jeK literal 0 HcmV?d00001 diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java index d2f685ba..f921ee4d 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java @@ -5,6 +5,7 @@ import hirs.utils.tpm.eventlog.events.EvCompactHash; 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.EvEfiSpdmFirmwareBlob; import hirs.utils.tpm.eventlog.events.EvEfiSpecIdEvent; import hirs.utils.tpm.eventlog.events.EvEventTag; import hirs.utils.tpm.eventlog.events.EvIPL; @@ -534,6 +535,8 @@ public class TpmPcrEvent { description += "Event Content:\n" + new UefiVariable(content).toString(); break; case EvConstants.EV_EFI_SPDM_FIRMWARE_BLOB: + EvEfiSpdmFirmwareBlob efiSpdmFwBlob = new EvEfiSpdmFirmwareBlob(content); + description += "Event Content:\n" + efiSpdmFwBlob.toString(); default: description += " Unknown Event found" + "\n"; } @@ -549,6 +552,7 @@ public class TpmPcrEvent { */ private static String eventString(final long event) { + System.out.println("XXXX " + event); if (event == EvConstants.EV_PREBOOT_CERT) { return "EV_PREBOOT_CERT"; } else if (event == EvConstants.EV_POST_CODE) { diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java index 779d2c3e..560965ee 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java @@ -113,18 +113,38 @@ public class DeviceSecurityEventData { } dSEDdeviceContext = new DeviceSecurityEventDataDeviceContext(dSEDbytes, byteOffset); - if (version == "1") { - dSEDinfo =+ - dSEDataHeader.getDSEDheaderInfo(); - dSEDinfo =+ - dSEDdeviceContext.getdSEDdeviceContextInfo(); - } else if (version == "2") { - dSEDinfo =+ - dSEDheader.getDSEDheaderInfo(); - dSEDinfo =+ - dSEDsubHeader.getDSEDsubHeaderInfo(); - dSEDinfo =+ - dSEDdeviceContext.getDSEDdeviceContextInfo(); - } +// if (version == "1") { +// dSEDinfo =+ +// dSEDataHeader.getDSEDheaderInfo(); +// dSEDinfo =+ +// dSEDdeviceContext.getdSEDdeviceContextInfo(); +// } else if (version == "2") { +// dSEDinfo =+ +// dSEDheader.getDSEDheaderInfo(); +// dSEDinfo =+ +// dSEDsubHeader.getDSEDsubHeaderInfo(); +// dSEDinfo =+ +// dSEDdeviceContext.getDSEDdeviceContextInfo(); +// } + } + + public String toString() { + String specInfo = ""; + + specInfo += " Signature = SPDM Device Sec : "; +// if (specIDEvent.isCryptoAgile()) { +// specInfo += "Log format is Crypto Agile\n"; +// } else { +// specInfo += "Log format is SHA 1 (NOT Crypto Agile)\n"; +// } +// specInfo += " Platform Profile Specification version = " +// + specIDEvent.getVersionMajor() + "." + specIDEvent.getVersionMinor() +// + " using errata version " + specIDEvent.getErrata(); +// specInfo += DeviceSecurityEventData.toString(); +// } else { +// specInfo = "EV_EFI_SPDM_FIRMWARE_BLOB event named " + signature +// + " encountered but support for processing it has not been added to this application.\n"; +// } + return specInfo; } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java index f5c49860..89863723 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java @@ -91,6 +91,7 @@ public class EvEfiSpdmFirmwareBlob { // specInfo += " Platform Profile Specification version = " // + specIDEvent.getVersionMajor() + "." + specIDEvent.getVersionMinor() // + " using errata version " + specIDEvent.getErrata(); +// specInfo += DeviceSecurityEventData.toString(); } else { specInfo = "EV_EFI_SPDM_FIRMWARE_BLOB event named " + signature + " encountered but support for processing it has not been added to this application.\n"; From 4547998384ceb8264b91b92cf98624aba38d8a4f Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Wed, 17 Apr 2024 17:28:17 -0400 Subject: [PATCH 10/31] spdm initial output --- ...s_addEvt11asSPDMFirmwareBlob_origVersion0} | Bin ...ements_addEvt11asSPDMFirmwareBlob_version1 | Bin 0 -> 23866 bytes .../events/DeviceSecurityEventData.java | 89 ++++++++------ .../events/DeviceSecurityEventDataHeader.java | 116 ++++++++++-------- .../events/EvEfiSpdmFirmwareBlob.java | 18 +-- .../tpm/eventlog/spdm/SpdmMeasurement.java | 13 ++ .../eventlog/spdm/SpdmMeasurementBlock.java | 13 ++ 7 files changed, 147 insertions(+), 102 deletions(-) rename 0_temp/{binary_bios_measurements_addEvt11asSPDMFirmwareBlob => binary_bios_measurements_addEvt11asSPDMFirmwareBlob_origVersion0} (100%) create mode 100644 0_temp/binary_bios_measurements_addEvt11asSPDMFirmwareBlob_version1 create mode 100644 HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurement.java create mode 100644 HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurementBlock.java diff --git a/0_temp/binary_bios_measurements_addEvt11asSPDMFirmwareBlob b/0_temp/binary_bios_measurements_addEvt11asSPDMFirmwareBlob_origVersion0 similarity index 100% rename from 0_temp/binary_bios_measurements_addEvt11asSPDMFirmwareBlob rename to 0_temp/binary_bios_measurements_addEvt11asSPDMFirmwareBlob_origVersion0 diff --git a/0_temp/binary_bios_measurements_addEvt11asSPDMFirmwareBlob_version1 b/0_temp/binary_bios_measurements_addEvt11asSPDMFirmwareBlob_version1 new file mode 100644 index 0000000000000000000000000000000000000000..3d1b3dbd4a122cfa9619f6c1c0c4e879c3777286 GIT binary patch literal 23866 zcmd_S1zc2Jy9YXScPauyC=D}oDxK1eGz>7*(4k0&f+zx_peQ90l8Ur63P>X%AS$3p z2$CWKcW*#n9evODefPZQ{Lb&*4SUb5J^%HrXFY2@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X_y5zKWr%igk;qP?qp3Z%j6RY)0{BmR;ZCqWg{>0LHLPwKD zFX^#j3pR_lY8>}tZk;^_$57cXyZQ<1jd7bY)6Y@`_21DU0Ej08!9L2kAP^pCU2HbQ zx-n6^sEMadsN}cHRYQec<GC?-`2<Nc`?d7cw)J1~pd;QK&m++#wd?Cq^qd^`1>e;| z!|oHZYh%|4w=6C!(nZ!$VnoH%J}LN_Emx#F@Ftb-X{{iafS((9>imC|zWr}{IB*T^ zr^Fu>``Wba<xLTV<N$Spo3_{PP7bL*z8yGUd=+2Qk&1}nhlmdP1t=i!@+Z*QqDeZ? zd+f>W$kz(5>h3jCsIHiP7R03KCv7)eyy})tKN*!&@?AuSt{PlM00<)fFU#rI1(HPD zTO6_E0&91l2>F();Bn_K=HKn1OaF2MihU6_Lsg>my@TKa$zfLVbLS4u*th{<=zo#L z^CR6H(T2zN-rKj!zGCyQM`(BYG>fx?E4c5Q6YbXW6Mp$bCHo=l_u)}H$cP~S5AB0; Aq5uE@ literal 0 HcmV?d00001 diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java index 560965ee..710598a4 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java @@ -63,26 +63,26 @@ public class DeviceSecurityEventData { */ @Getter private String version = ""; - /** - * Contains the human-readable info inside the Device Security Event. - */ - @Getter - private String dSEDinfo = ""; +// /** +// * Contains the human-readable info inside the Device Security Event. +// */ +// @Getter +// private String dsedInfo = ""; /** * DeviceSecurityEventDataHeader Object. */ @Getter - private DeviceSecurityEventDataHeader dSEDheader = null; + private DeviceSecurityEventDataHeader dsedHeader = null; /** * DeviceSecurityEventDataSubHeader Object. */ - @Getter - private DeviceSecurityEventDataHeader dSEDsubHeader = null; +// @Getter +// private DeviceSecurityEventDataSubHeader dsedSubHeader = null; /** * DeviceSecurityEventDataDeviceContext Object. */ @Getter - private DeviceSecurityEventDataDeviceContext dSEDdeviceContext = null; + private DeviceSecurityEventDataDeviceContext dsedDeviceContext = null; /** * DeviceSecurityEventData Constructor. @@ -95,56 +95,65 @@ public class DeviceSecurityEventData { System.arraycopy(dSEDbytes, 0, signatureBytes, 0, UefiConstants.SIZE_16); //signature = HexUtils.byteArrayToHexString(signatureBytes); signature = new String(signatureBytes, StandardCharsets.UTF_8) - .substring(0, UefiConstants.SIZE_15); + .substring(0, UefiConstants.SIZE_15); // size 15 bc last letter is a 00 (null) - byte[] versionBytes = new byte[UefiConstants.SIZE_4]; + byte[] versionBytes = new byte[UefiConstants.SIZE_2]; System.arraycopy(dSEDbytes, UefiConstants.OFFSET_16, versionBytes, 0, - UefiConstants.SIZE_4); + UefiConstants.SIZE_2); version = HexUtils.byteArrayToHexString(versionBytes); +// int byteOffset = 0; +// byteOffset = dsedHeader.getDsedHeaderByteSize(); + // If version is 0x01, the event is a DEVICE_SECURITY_EVENT_DATA // If version is 0x02, the event is a DEVICE_SECURITY_EVENT_DATA2 - int byteOffset = 0; - dSEDheader = new DeviceSecurityEventDataHeader(dSEDbytes); - byteOffset = dSEDheader.getDSEDheaderByteSize(); - if (version == "2") { -// dSEDsubHeader = new DeviceSecurityEventDataSubHeader(dSEDbytes,byteOffset); -// byteOffset = dSEDheader.getDSEDsubHeaderByteSize(); - } - dSEDdeviceContext = new DeviceSecurityEventDataDeviceContext(dSEDbytes, byteOffset); + switch (version) { + case "0100": + dsedHeader = new DeviceSecurityEventDataHeader(dSEDbytes); +// dsedDeviceContext = new DeviceSecurityEventDataDeviceContext(dSEDbytes, +// dsedHeader.getDSEDheaderByteSize()); + break; + case "0200": + dsedHeader = new DeviceSecurityEventDataHeader(dSEDbytes); +// dsedSubHeader = new DeviceSecurityEventDataSubHeader(dSEDbytes,byteOffset); +// byteOffset = dsedHeader.getDSEDsubHeaderByteSize(); +// dsedDeviceContext = new DeviceSecurityEventDataDeviceContext(dSEDbytes, byteOffset); + break; + default: + break; + // if (version == "1") { // dSEDinfo =+ // dSEDataHeader.getDSEDheaderInfo(); // dSEDinfo =+ -// dSEDdeviceContext.getdSEDdeviceContextInfo(); +// dsedDeviceContext.getdSEDdeviceContextInfo(); // } else if (version == "2") { // dSEDinfo =+ // dSEDheader.getDSEDheaderInfo(); // dSEDinfo =+ -// dSEDsubHeader.getDSEDsubHeaderInfo(); +// dsedSubHeader.getDSEDsubHeaderInfo(); // dSEDinfo =+ -// dSEDdeviceContext.getDSEDdeviceContextInfo(); +// dsedDeviceContext.getDSEDdeviceContextInfo(); // } + } } public String toString() { - String specInfo = ""; - - specInfo += " Signature = SPDM Device Sec : "; -// if (specIDEvent.isCryptoAgile()) { -// specInfo += "Log format is Crypto Agile\n"; -// } else { -// specInfo += "Log format is SHA 1 (NOT Crypto Agile)\n"; -// } -// specInfo += " Platform Profile Specification version = " -// + specIDEvent.getVersionMajor() + "." + specIDEvent.getVersionMinor() -// + " using errata version " + specIDEvent.getErrata(); -// specInfo += DeviceSecurityEventData.toString(); -// } else { -// specInfo = "EV_EFI_SPDM_FIRMWARE_BLOB event named " + signature -// + " encountered but support for processing it has not been added to this application.\n"; -// } - return specInfo; + String dsedInfo = ""; + switch (version) { + case "0100": + dsedInfo += dsedHeader.toString(); +// dsedInfo += dsedDeviceContext.toString(); + break; + case "0200": +// dsedInfo += dsedHeader.toString(); +// dsedInfo += dsedSubHeader.toString(); +// dsedInfo += dsedDeviceContext.toString(); + break; + default: + dsedInfo += " Unknown SPDM Device Security Event Data version " + version + " found" + "\n"; + } + return dsedInfo; } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java index 772b766e..4c3c81f0 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java @@ -30,7 +30,7 @@ import java.util.List; * UNIT8 DevicePath[DevicePathLength] * } DEVICE_SECURITY_EVENT_DATA_HEADER; * <p> - * typedef struct tdDEVICE_SECURITY_EVENT_DATA_HEADER2 { + * typedef struct tdDEVICE_SECURITY_EVENT_DATA_HEADER2 { - NOT IMPLEMENTED YET * UINT8 Signature[16]; * UINT16 Version; * UINT8 AuthState; @@ -73,11 +73,14 @@ import java.util.List; */ public class DeviceSecurityEventDataHeader { - /** - * Contains the human-readable info inside the Device Security Event. +// /** +// * Contains the human-readable info inside the Device Security Event. +// */ +// @Getter +// private String dSEDheaderInfo = ""; + + /** ----------- Variables common to all Header Types ----------- */ - @Getter - private String dSEDheaderInfo = ""; /** * Contains the size (in bytes) of the Header. */ @@ -94,21 +97,42 @@ public class DeviceSecurityEventDataHeader { */ @Getter private String version = ""; - /** - * Event data length. - */ - @Getter - private String length = ""; - /** - * SPDM hash algorithm. - */ - @Getter - private String spdmHashAlgo = ""; /** * Device type. */ @Getter private String deviceType = ""; + /** + * Device path length. + */ + @Getter + private String devicePathLength = ""; + /** + * Device path. + */ + @Getter + private String devicePath = ""; + + /** ----------- Variables specific to Header Type 1 ----------- + /** + * Type Header 1 event data length. + */ + @Getter + private String h1Length = ""; + /** + * Type Header 1 SPDM hash algorithm. + */ + @Getter + private String h1SpdmHashAlgo = ""; + /** + * Type Header 1 SPDM measurement block. + */ + @Getter + private String h1SpdmMeasurementBlock = ""; + + /** ----------- Variables specific to Header Type 2 ----------- + */ + // TBD /** * DeviceSecurityEventDataHeader Constructor. @@ -123,33 +147,26 @@ public class DeviceSecurityEventDataHeader { signature = new String(signatureBytes, StandardCharsets.UTF_8) .substring(0, UefiConstants.SIZE_15); - byte[] versionBytes = new byte[UefiConstants.SIZE_4]; + byte[] versionBytes = new byte[UefiConstants.SIZE_2]; System.arraycopy(dSEDbytes, UefiConstants.OFFSET_16, versionBytes, 0, - UefiConstants.SIZE_4); + UefiConstants.SIZE_2); version = HexUtils.byteArrayToHexString(versionBytes); - byte[] lengthBytes = new byte[UefiConstants.SIZE_4]; - System.arraycopy(dSEDbytes, UefiConstants.OFFSET_20, lengthBytes, 0, - UefiConstants.SIZE_4); - length = HexUtils.byteArrayToHexString(lengthBytes); + byte[] lengthBytes = new byte[UefiConstants.SIZE_2]; + System.arraycopy(dSEDbytes, 18, lengthBytes, 0, + UefiConstants.SIZE_2); + h1Length = HexUtils.byteArrayToHexString(lengthBytes); - byte[] spdmHashAlgoBytes = new byte[UefiConstants.SIZE_8]; - System.arraycopy(dSEDbytes, UefiConstants.OFFSET_24, spdmHashAlgoBytes, 0, + byte[] spdmHashAlgoBytes = new byte[UefiConstants.SIZE_4]; + System.arraycopy(dSEDbytes, UefiConstants.OFFSET_20, spdmHashAlgoBytes, 0, UefiConstants.SIZE_4); - spdmHashAlgo = HexUtils.byteArrayToHexString(spdmHashAlgoBytes); + h1SpdmHashAlgo = HexUtils.byteArrayToHexString(spdmHashAlgoBytes); - byte[] deviceTypeBytes = new byte[UefiConstants.SIZE_8]; + byte[] deviceTypeBytes = new byte[UefiConstants.SIZE_4]; System.arraycopy(dSEDbytes, UefiConstants.OFFSET_24, deviceTypeBytes, 0, UefiConstants.SIZE_4); deviceType = HexUtils.byteArrayToHexString(deviceTypeBytes); -// byte[] specVersionMajorBytes = new byte[1]; -// System.arraycopy(efiSpecId, UefiConstants.OFFSET_21, specVersionMajorBytes, 0, 1); -// versionMajor = HexUtils.byteArrayToHexString(specVersionMajorBytes); -// -// byte[] specErrataBytes = new byte[1]; -// System.arraycopy(efiSpecId, UefiConstants.OFFSET_22, specErrataBytes, 0, 1); -// errata = HexUtils.byteArrayToHexString(specErrataBytes); // // byte[] numberOfAlgBytes = new byte[UefiConstants.SIZE_4]; // System.arraycopy(efiSpecId, UefiConstants.OFFSET_24, numberOfAlgBytes, 0, @@ -170,23 +187,24 @@ public class DeviceSecurityEventDataHeader { // cryptoAgile = true; // } } -// -// /** -// * Returns a human readable description of the data within this event. -// * -// * @return a description of this event.. -// */ -// public String toString() { -// String specInfo = ""; -// if (signature.equals("Spec ID Event#")) { -// specInfo += "Platform Profile Specification version = " + versionMajor + "." + versionMinor -// + " using errata version" + errata; -// } else { -// specInfo = "EV_NO_ACTION event named " + signature -// + " encountered but support for processing it has not been added to this application"; -// } -// return specInfo; -// } + /** + * Returns a human readable description of the data within this event. + * + * @return a description of this event.. + */ + public String toString() { + String dsedHeaderInfo = ""; + if (version.equals("0100")) { + dsedHeaderInfo += "\n SPDM hash algorithm = " + h1SpdmHashAlgo; + dsedHeaderInfo += "\n SPDM Device"; + dsedHeaderInfo += "\n Device Type: " + deviceType; + dsedHeaderInfo += "\n Device Path: " + devicePath; + dsedHeaderInfo += "\n SPDM Measurement Block " + h1SpdmMeasurementBlock; + } else if(version.equals("0200")) { + dsedHeaderInfo = "tbd"; + } + return dsedHeaderInfo; + } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java index 89863723..c0a7d6c5 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java @@ -80,22 +80,14 @@ public class EvEfiSpdmFirmwareBlob { * @return Human readable description of this event. */ public String toString() { - String specInfo = ""; + String spdmInfo = ""; if (bDeviceSecurityEventData) { - specInfo += " Signature = SPDM Device Sec : "; -// if (specIDEvent.isCryptoAgile()) { -// specInfo += "Log format is Crypto Agile\n"; -// } else { -// specInfo += "Log format is SHA 1 (NOT Crypto Agile)\n"; -// } -// specInfo += " Platform Profile Specification version = " -// + specIDEvent.getVersionMajor() + "." + specIDEvent.getVersionMinor() -// + " using errata version " + specIDEvent.getErrata(); -// specInfo += DeviceSecurityEventData.toString(); + spdmInfo += " Signature = SPDM Device Sec"; + spdmInfo += deviceSecurityEventData.toString(); } else { - specInfo = "EV_EFI_SPDM_FIRMWARE_BLOB event named " + signature + spdmInfo = "EV_EFI_SPDM_FIRMWARE_BLOB event named " + signature + " encountered but support for processing it has not been added to this application.\n"; } - return specInfo; + return spdmInfo; } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurement.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurement.java new file mode 100644 index 00000000..4dd82a4e --- /dev/null +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurement.java @@ -0,0 +1,13 @@ +package hirs.utils.tpm.eventlog.spdm; + +public class SpdmMeasurement { + + public SpdmMeasurement(final byte[] spdmMeasBytes) { + + } + + + public String toString() { + return "TEMP TEST SpdmMeasurement"; + } +} diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurementBlock.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurementBlock.java new file mode 100644 index 00000000..00cd926d --- /dev/null +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurementBlock.java @@ -0,0 +1,13 @@ +package hirs.utils.tpm.eventlog.spdm; + +public class SpdmMeasurementBlock { + + public SpdmMeasurementBlock(final byte[] spdmMeasBlockBytes) { + + } + + public String toString() { + return "TEMP TEST spdmMeasBlockBytes"; + } + +} From e8bcb0ec0d877dd0e48347ab35c0ffea0648fac3 Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Wed, 17 Apr 2024 17:49:14 -0400 Subject: [PATCH 11/31] spdm initial output --- .../events/DeviceSecurityEventDataHeader.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java index 4c3c81f0..36671287 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java @@ -114,11 +114,11 @@ public class DeviceSecurityEventDataHeader { private String devicePath = ""; /** ----------- Variables specific to Header Type 1 ----------- - /** - * Type Header 1 event data length. - */ - @Getter - private String h1Length = ""; +// /** +// * Type Header 1 event data length. +// */ +// @Getter +// private String h1Length = ""; /** * Type Header 1 SPDM hash algorithm. */ @@ -155,17 +155,19 @@ public class DeviceSecurityEventDataHeader { byte[] lengthBytes = new byte[UefiConstants.SIZE_2]; System.arraycopy(dSEDbytes, 18, lengthBytes, 0, UefiConstants.SIZE_2); - h1Length = HexUtils.byteArrayToHexString(lengthBytes); + int h1Length = HexUtils.leReverseInt(lengthBytes); byte[] spdmHashAlgoBytes = new byte[UefiConstants.SIZE_4]; System.arraycopy(dSEDbytes, UefiConstants.OFFSET_20, spdmHashAlgoBytes, 0, UefiConstants.SIZE_4); - h1SpdmHashAlgo = HexUtils.byteArrayToHexString(spdmHashAlgoBytes); + int h1SpdmHashAlgoInt = HexUtils.leReverseInt(spdmHashAlgoBytes); + h1SpdmHashAlgo = "to do - get hash alg"; byte[] deviceTypeBytes = new byte[UefiConstants.SIZE_4]; System.arraycopy(dSEDbytes, UefiConstants.OFFSET_24, deviceTypeBytes, 0, UefiConstants.SIZE_4); - deviceType = HexUtils.byteArrayToHexString(deviceTypeBytes); + int deviceTypeInt = HexUtils.leReverseInt(deviceTypeBytes); + deviceType = "to do - get device type"; // // byte[] numberOfAlgBytes = new byte[UefiConstants.SIZE_4]; From 1b6109c107e6efcbce7d3a249cae35cb4a2c2185 Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Thu, 18 Apr 2024 12:27:44 -0400 Subject: [PATCH 12/31] spdm processing --- .../events/DeviceSecurityEventDataHeader.java | 46 +++++++++- .../hirs/utils/tpm/eventlog/spdm/SpdmHa.java | 85 +++++++++++++++++++ 2 files changed, 127 insertions(+), 4 deletions(-) create mode 100644 HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmHa.java diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java index 36671287..c7d5f344 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java @@ -2,6 +2,7 @@ package hirs.utils.tpm.eventlog.events; import hirs.utils.HexUtils; import hirs.utils.tpm.eventlog.TcgTpmtHa; +import hirs.utils.tpm.eventlog.spdm.SpdmHa; import hirs.utils.tpm.eventlog.uefi.UefiConstants; import lombok.Getter; @@ -113,6 +114,19 @@ public class DeviceSecurityEventDataHeader { @Getter private String devicePath = ""; + /** + * 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; + /** ----------- Variables specific to Header Type 1 ----------- // /** // * Type Header 1 event data length. @@ -140,10 +154,9 @@ public class DeviceSecurityEventDataHeader { * @param dSEDbytes byte array holding the DeviceSecurityEventData. */ public DeviceSecurityEventDataHeader(final byte[] dSEDbytes) { -// algList = new ArrayList<>(); + byte[] signatureBytes = new byte[UefiConstants.SIZE_16]; System.arraycopy(dSEDbytes, 0, signatureBytes, 0, UefiConstants.SIZE_16); - //signature = HexUtils.byteArrayToHexString(signatureBytes); signature = new String(signatureBytes, StandardCharsets.UTF_8) .substring(0, UefiConstants.SIZE_15); @@ -161,13 +174,13 @@ public class DeviceSecurityEventDataHeader { System.arraycopy(dSEDbytes, UefiConstants.OFFSET_20, spdmHashAlgoBytes, 0, UefiConstants.SIZE_4); int h1SpdmHashAlgoInt = HexUtils.leReverseInt(spdmHashAlgoBytes); - h1SpdmHashAlgo = "to do - get hash alg"; + h1SpdmHashAlgo = SpdmHa.tcgAlgIdToString(h1SpdmHashAlgoInt); byte[] deviceTypeBytes = new byte[UefiConstants.SIZE_4]; System.arraycopy(dSEDbytes, UefiConstants.OFFSET_24, deviceTypeBytes, 0, UefiConstants.SIZE_4); int deviceTypeInt = HexUtils.leReverseInt(deviceTypeBytes); - deviceType = "to do - get device type"; + deviceType = deviceTypeToString(deviceTypeInt); // // byte[] numberOfAlgBytes = new byte[UefiConstants.SIZE_4]; @@ -190,6 +203,31 @@ public class DeviceSecurityEventDataHeader { // } } + /** + * Returns the device type via a lookup. + * Lookup based upon section 10.2.7.2, Table 19, in the PFP 1.06 v52 spec. + * + * @param deviceTypeInt int to convert to string + * @return name of the device type + */ + public String deviceTypeToString(final int deviceTypeInt) { + String deviceTypeStr; + switch (deviceTypeInt) { + case DEVICE_TYPE_NONE: + deviceTypeStr = "No device type"; + break; + case DEVICE_TYPE_PCI: + deviceTypeStr = "PCI"; + break; + case DEVICE_TYPE_USB: + deviceTypeStr = "USB"; + break; + default: + deviceTypeStr = "Unknown or invalid Device Type"; + } + return deviceTypeStr; + } + /** * Returns a human readable description of the data within this event. * diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmHa.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmHa.java new file mode 100644 index 00000000..ce6a2fb1 --- /dev/null +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmHa.java @@ -0,0 +1,85 @@ +package hirs.utils.tpm.eventlog.spdm; + +import hirs.utils.HexUtils; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; + +/** + * Class for defining constants referenced in the DMTF + * SPDM specification. + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public class SpdmHa { + + + /** + * ------------------- SPDM Spec: MeasurementHashAlgo ------------------- + * SPDM 1.3.0, Table 21 + */ + /** + * Spdm Hash Alg = Raw bit stream + */ + public static final int TPM_ALG_RAW = 1; + /** + * Spdm Hash Alg = TPM_ALG_SHA_256. + */ + public static final int TPM_ALG_SHA_256 = 2; + /** + * Spdm Hash Alg = TPM_ALG_SHA_384. + */ + public static final int TPM_ALG_SHA_384 = 4; + /** + * Spdm Hash Alg = TPM_ALG_SHA_512. + */ + public static final int TPM_ALG_SHA_512 = 8; + /** + * Spdm Hash Alg = TPM_ALG_SHA3_256. + */ + public static final int TPM_ALG_SHA3_256 = 16; + /** + * Spdm Hash Alg = TPM_ALG_SHA3_384. + */ + public static final int TPM_ALG_SHA3_384 = 32; + /** + * Spdm Hash Alg = TPM_ALG_SHA3_512. + */ + public static final int TPM_ALG_SHA3_512 = 64; + + /** + * Returns the hash name via a lookup. + * Lookup based upon section 10.4 for the SPDM v1.03 document. + * + * @param algId int to convert to string + * @return name of the algorithm + */ + public static String tcgAlgIdToString(final int algId) { + String alg; + switch (algId) { + case TPM_ALG_RAW: + alg = "Raw Bit Stream"; + break; + case TPM_ALG_SHA_256: + alg = "TPM_ALG_SHA_256"; + break; + case TPM_ALG_SHA_384: + alg = "TPM_ALG_SHA_384"; + break; + case TPM_ALG_SHA_512: + alg = "TPM_ALG_SHA_512"; + break; + case TPM_ALG_SHA3_256: + alg = "TPM_ALG_SHA3_256"; + break; + case TPM_ALG_SHA3_384: + alg = "TPM_ALG_SHA3_384"; + break; + case TPM_ALG_SHA3_512: + alg = "TPM_ALG_SHA3_512"; + break; + default: + alg = "Unknown or invalid Hash"; + } + return alg; + } + +} From 26c102c2054ee5f3543e7ce92fe0ed5d35077d64 Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Thu, 18 Apr 2024 17:08:36 -0400 Subject: [PATCH 13/31] spdm processing --- .../events/DeviceSecurityEventDataHeader.java | 68 ++++++++++++------- .../eventlog/spdm/SpdmMeasurementBlock.java | 19 ++++++ 2 files changed, 63 insertions(+), 24 deletions(-) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java index c7d5f344..2d46bdc2 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java @@ -3,6 +3,7 @@ package hirs.utils.tpm.eventlog.events; import hirs.utils.HexUtils; import hirs.utils.tpm.eventlog.TcgTpmtHa; import hirs.utils.tpm.eventlog.spdm.SpdmHa; +import hirs.utils.tpm.eventlog.spdm.SpdmMeasurementBlock; import hirs.utils.tpm.eventlog.uefi.UefiConstants; import lombok.Getter; @@ -138,11 +139,14 @@ public class DeviceSecurityEventDataHeader { */ @Getter private String h1SpdmHashAlgo = ""; +// /** +// * Type Header 1 SPDM Measurement Block list. +// */ +// private List<SpdmMeasurementBlock> h1SpdmMeasurementBlockList; /** - * Type Header 1 SPDM measurement block. + * Type Header 1 SPDM Measurement Block. */ - @Getter - private String h1SpdmMeasurementBlock = ""; + private SpdmMeasurementBlock h1SpdmMeasurementBlock; /** ----------- Variables specific to Header Type 2 ----------- */ @@ -155,6 +159,8 @@ public class DeviceSecurityEventDataHeader { */ public DeviceSecurityEventDataHeader(final byte[] dSEDbytes) { +// spdmMeasurementBlockList = new ArrayList<>(); + byte[] signatureBytes = new byte[UefiConstants.SIZE_16]; System.arraycopy(dSEDbytes, 0, signatureBytes, 0, UefiConstants.SIZE_16); signature = new String(signatureBytes, StandardCharsets.UTF_8) @@ -165,29 +171,41 @@ public class DeviceSecurityEventDataHeader { UefiConstants.SIZE_2); version = HexUtils.byteArrayToHexString(versionBytes); - byte[] lengthBytes = new byte[UefiConstants.SIZE_2]; - System.arraycopy(dSEDbytes, 18, lengthBytes, 0, - UefiConstants.SIZE_2); - int h1Length = HexUtils.leReverseInt(lengthBytes); +// if(version == "0100") { + if (version.equals("0100")) { - byte[] spdmHashAlgoBytes = new byte[UefiConstants.SIZE_4]; - System.arraycopy(dSEDbytes, UefiConstants.OFFSET_20, spdmHashAlgoBytes, 0, - UefiConstants.SIZE_4); - int h1SpdmHashAlgoInt = HexUtils.leReverseInt(spdmHashAlgoBytes); - h1SpdmHashAlgo = SpdmHa.tcgAlgIdToString(h1SpdmHashAlgoInt); + byte[] lengthBytes = new byte[UefiConstants.SIZE_2]; + System.arraycopy(dSEDbytes, 18, lengthBytes, 0, + UefiConstants.SIZE_2); + int h1Length = HexUtils.leReverseInt(lengthBytes); - byte[] deviceTypeBytes = new byte[UefiConstants.SIZE_4]; - System.arraycopy(dSEDbytes, UefiConstants.OFFSET_24, deviceTypeBytes, 0, - UefiConstants.SIZE_4); - int deviceTypeInt = HexUtils.leReverseInt(deviceTypeBytes); - deviceType = deviceTypeToString(deviceTypeInt); + byte[] spdmHashAlgoBytes = new byte[UefiConstants.SIZE_4]; + System.arraycopy(dSEDbytes, UefiConstants.OFFSET_20, spdmHashAlgoBytes, 0, + UefiConstants.SIZE_4); + int h1SpdmHashAlgoInt = HexUtils.leReverseInt(spdmHashAlgoBytes); + h1SpdmHashAlgo = SpdmHa.tcgAlgIdToString(h1SpdmHashAlgoInt); + + byte[] deviceTypeBytes = new byte[UefiConstants.SIZE_4]; + System.arraycopy(dSEDbytes, UefiConstants.OFFSET_24, deviceTypeBytes, 0, + UefiConstants.SIZE_4); + int deviceTypeInt = HexUtils.leReverseInt(deviceTypeBytes); + deviceType = deviceTypeToString(deviceTypeInt); + + // For each measurement block, create a SpdmMeasurementBlock object (can there be many blocks ?) + + // get the size of the SPDM Measurement Block + byte[] sizeOfSpdmMeasBlockBytes = new byte[UefiConstants.SIZE_2]; + System.arraycopy(dSEDbytes, 30, sizeOfSpdmMeasBlockBytes, 0, + UefiConstants.SIZE_2); + int sizeOfSpdmMeas = HexUtils.leReverseInt(sizeOfSpdmMeasBlockBytes); + int sizeOfSpdmMeasBlock = sizeOfSpdmMeas + 4; + + // extract the bytes from the SPDM Measurement Block + byte[] spdmMeasBlockBytes = new byte[sizeOfSpdmMeasBlock]; + System.arraycopy(dSEDbytes, 28, spdmMeasBlockBytes, 0, + sizeOfSpdmMeasBlock); + h1SpdmMeasurementBlock = new SpdmMeasurementBlock(spdmMeasBlockBytes); -// -// byte[] numberOfAlgBytes = new byte[UefiConstants.SIZE_4]; -// System.arraycopy(efiSpecId, UefiConstants.OFFSET_24, numberOfAlgBytes, 0, -// UefiConstants.SIZE_4); -// numberOfAlg = HexUtils.leReverseInt(numberOfAlgBytes); -// // byte[] algorithmIDBytes = new byte[UefiConstants.SIZE_2]; // int algLocation = UefiConstants.SIZE_28; // for (int i = 0; i < numberOfAlg; i++) { @@ -201,6 +219,8 @@ public class DeviceSecurityEventDataHeader { // } else { // cryptoAgile = true; // } + + } } /** @@ -240,7 +260,7 @@ public class DeviceSecurityEventDataHeader { dsedHeaderInfo += "\n SPDM Device"; dsedHeaderInfo += "\n Device Type: " + deviceType; dsedHeaderInfo += "\n Device Path: " + devicePath; - dsedHeaderInfo += "\n SPDM Measurement Block " + h1SpdmMeasurementBlock; + dsedHeaderInfo += "\n SPDM Measurement Block " + h1SpdmMeasurementBlock.toString(); } else if(version.equals("0200")) { dsedHeaderInfo = "tbd"; } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurementBlock.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurementBlock.java index 00cd926d..af8c95a4 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurementBlock.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurementBlock.java @@ -1,9 +1,28 @@ package hirs.utils.tpm.eventlog.spdm; +import lombok.Getter; + public class SpdmMeasurementBlock { + /** + * Measurement Spec. + */ + @Getter + private String measurementSpec = ""; + /** + * Measurement value type (such as mutable firmware, etc). + */ + @Getter + private String dmtfSpecMeasurementValueType = ""; + /** + * Measurement value (digest). + */ + @Getter + private String dmtfSpecMeasurementValue = ""; + public SpdmMeasurementBlock(final byte[] spdmMeasBlockBytes) { + } public String toString() { From 53267ec381c900233eed4920b39cf48d507907a0 Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Fri, 19 Apr 2024 17:21:30 -0400 Subject: [PATCH 14/31] spdm processing --- .../events/DeviceSecurityEventData.java | 142 +-------- .../events/DeviceSecurityEventData2.java | 13 + .../events/DeviceSecurityEventDataBase.java | 157 ++++++++++ .../events/DeviceSecurityEventDataHeader.java | 263 +---------------- .../DeviceSecurityEventDataHeader2.java | 8 + .../DeviceSecurityEventDataHeaderBase.java | 272 ++++++++++++++++++ .../events/EvEfiSpdmFirmwareBlob.java | 34 ++- 7 files changed, 480 insertions(+), 409 deletions(-) create mode 100644 HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData2.java create mode 100644 HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java create mode 100644 HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader2.java create mode 100644 HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java index 710598a4..570d0eb7 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java @@ -1,88 +1,15 @@ package hirs.utils.tpm.eventlog.events; -import hirs.utils.HexUtils; -import hirs.utils.tpm.eventlog.TcgTpmtHa; -import hirs.utils.tpm.eventlog.uefi.UefiConstants; -import jakarta.persistence.criteria.CriteriaBuilder; + import lombok.Getter; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; +public class DeviceSecurityEventData extends DeviceSecurityEventDataBase { - -/** - * Class to process the DEVICE_SECURITY_EVENT_DATA or ..DATA2 event per PFP. - * The event data comes in 2 forms: - * 1) DEVICE_SECURITY_EVENT_DATA or - * 2) DEVICE_SECURITY_EVENT_DATA2 - * The first 16 bytes of the event data header MUST be a String based identifier (Signature), - * NUL-terminated, per PFP. The only currently defined Signature is "SPDM Device Sec", which - * implies the data is a DEVICE_SECURITY_EVENT_DATA or ..DATA2. The Version field in the HEADER - * or HEADER2 indicates whether the Device Security Event is ..DATA or ..DATA2. - * - * DEVICE SECURITY EVENT structures defined by PFP v1.06 Rev 52: - * <p> - * typedef struct tdDEVICE_SECURITY_EVENT_DATA { - * DEVICE_SECURITY_EVENT_DATA_HEADER EventDataHeader; - * DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT DeviceContext; - * } DEVICE_SECURITY_EVENT_DATA; - * <p> - * typedef struct tdDEVICE_SECURITY_EVENT_DATA2 { - * DEVICE_SECURITY_EVENT_DATA_HEADER2 EventDataHeader; - * DEVICE_SECURITY_EVENT_DATA_SUB_HEADER EventDataSubHeader; - * DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT DeviceContext; - * } DEVICE_SECURITY_EVENT_DATA; - * <p> - * typedef struct tdDEVICE_SECURITY_EVENT_DATA_HEADER or HEADER2 { - * UINT8 Signature[16]; - * UINT16 Version; - * ... ... - * } - * <p> - * typedef struct tdDEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT { - * DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT PciContext; - * DEVICE_SECURITY_EVENT_DATA_USB_CONTEXT UsbContext; - * } DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT; - * <p> - * Notes: Parses event data for an DEVICE_SECURITY_EVENT_DATA per PFP v1.06 Rev52 Table 20. - * 1. Has an EventType of EV_EFI_SPDM_FIRMWARE_BLOB (0x800000E1) - * 2. Digest of 48 bytes - * 3. Event content defined as DEVICE_SECURITY_EVENT_DATA Struct. - * 4. First 16 bytes of the structure header is an ASCII "SPDM Device Sec" - */ -public class DeviceSecurityEventData { - - /** - * Signature (text) data. - */ - @Getter - private String signature = ""; - /** - * Version determines data structure used (..DATA or ..DATA2). - */ - @Getter - private String version = ""; -// /** -// * Contains the human-readable info inside the Device Security Event. -// */ -// @Getter -// private String dsedInfo = ""; /** * DeviceSecurityEventDataHeader Object. */ @Getter private DeviceSecurityEventDataHeader dsedHeader = null; - /** - * DeviceSecurityEventDataSubHeader Object. - */ -// @Getter -// private DeviceSecurityEventDataSubHeader dsedSubHeader = null; - /** - * DeviceSecurityEventDataDeviceContext Object. - */ - @Getter - private DeviceSecurityEventDataDeviceContext dsedDeviceContext = null; /** * DeviceSecurityEventData Constructor. @@ -91,69 +18,6 @@ public class DeviceSecurityEventData { */ public DeviceSecurityEventData(final byte[] dSEDbytes) { - byte[] signatureBytes = new byte[UefiConstants.SIZE_16]; - System.arraycopy(dSEDbytes, 0, signatureBytes, 0, UefiConstants.SIZE_16); - //signature = HexUtils.byteArrayToHexString(signatureBytes); - signature = new String(signatureBytes, StandardCharsets.UTF_8) - .substring(0, UefiConstants.SIZE_15); // size 15 bc last letter is a 00 (null) - - byte[] versionBytes = new byte[UefiConstants.SIZE_2]; - System.arraycopy(dSEDbytes, UefiConstants.OFFSET_16, versionBytes, 0, - UefiConstants.SIZE_2); - version = HexUtils.byteArrayToHexString(versionBytes); - -// int byteOffset = 0; -// byteOffset = dsedHeader.getDsedHeaderByteSize(); - - // If version is 0x01, the event is a DEVICE_SECURITY_EVENT_DATA - // If version is 0x02, the event is a DEVICE_SECURITY_EVENT_DATA2 - switch (version) { - case "0100": - dsedHeader = new DeviceSecurityEventDataHeader(dSEDbytes); -// dsedDeviceContext = new DeviceSecurityEventDataDeviceContext(dSEDbytes, -// dsedHeader.getDSEDheaderByteSize()); - break; - case "0200": - dsedHeader = new DeviceSecurityEventDataHeader(dSEDbytes); -// dsedSubHeader = new DeviceSecurityEventDataSubHeader(dSEDbytes,byteOffset); -// byteOffset = dsedHeader.getDSEDsubHeaderByteSize(); -// dsedDeviceContext = new DeviceSecurityEventDataDeviceContext(dSEDbytes, byteOffset); - break; - default: - break; - - -// if (version == "1") { -// dSEDinfo =+ -// dSEDataHeader.getDSEDheaderInfo(); -// dSEDinfo =+ -// dsedDeviceContext.getdSEDdeviceContextInfo(); -// } else if (version == "2") { -// dSEDinfo =+ -// dSEDheader.getDSEDheaderInfo(); -// dSEDinfo =+ -// dsedSubHeader.getDSEDsubHeaderInfo(); -// dSEDinfo =+ -// dsedDeviceContext.getDSEDdeviceContextInfo(); -// } - } - } - - public String toString() { - String dsedInfo = ""; - switch (version) { - case "0100": - dsedInfo += dsedHeader.toString(); -// dsedInfo += dsedDeviceContext.toString(); - break; - case "0200": -// dsedInfo += dsedHeader.toString(); -// dsedInfo += dsedSubHeader.toString(); -// dsedInfo += dsedDeviceContext.toString(); - break; - default: - dsedInfo += " Unknown SPDM Device Security Event Data version " + version + " found" + "\n"; - } - return dsedInfo; + dsedHeader = new DeviceSecurityEventDataHeader(dSEDbytes); } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData2.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData2.java new file mode 100644 index 00000000..61370781 --- /dev/null +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData2.java @@ -0,0 +1,13 @@ +package hirs.utils.tpm.eventlog.events; + +public class DeviceSecurityEventData2 extends DeviceSecurityEventDataBase { + + /** + * DeviceSecurityEventData2 Constructor. + * + * @param dSEDbytes byte array holding the DeviceSecurityEventData. + */ + public DeviceSecurityEventData2(final byte[] dSEDbytes) { + + } +} diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java new file mode 100644 index 00000000..ad66297e --- /dev/null +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java @@ -0,0 +1,157 @@ +package hirs.utils.tpm.eventlog.events; + +import hirs.utils.HexUtils; +import hirs.utils.tpm.eventlog.uefi.UefiConstants; +import lombok.Getter; + +import java.nio.charset.StandardCharsets; + + +/** + * Abstract base class to process the DEVICE_SECURITY_EVENT_DATA or ..DATA2 event per PFP. + * The event data comes in 2 forms: + * 1) DEVICE_SECURITY_EVENT_DATA or + * 2) DEVICE_SECURITY_EVENT_DATA2 + * The first 2 fields of the respective headers are the same in both ..DATA and ..DATA2. + * Field 1: + * The first 16 bytes of the event data header MUST be a String based identifier (Signature), + * NUL-terminated, per PFP. The only currently defined Signature is "SPDM Device Sec", which + * implies the data is a DEVICE_SECURITY_EVENT_DATA or ..DATA2. + * Field 2: + * The Version field indicates whether the Device Security Event is ..DATA or ..DATA2. + * + * DEVICE SECURITY EVENT structures defined by PFP v1.06 Rev 52: + * <p> + * typedef struct tdDEVICE_SECURITY_EVENT_DATA { + * DEVICE_SECURITY_EVENT_DATA_HEADER EventDataHeader; + * DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT DeviceContext; + * } DEVICE_SECURITY_EVENT_DATA; + * <p> + * typedef struct tdDEVICE_SECURITY_EVENT_DATA2 { + * DEVICE_SECURITY_EVENT_DATA_HEADER2 EventDataHeader; + * DEVICE_SECURITY_EVENT_DATA_SUB_HEADER EventDataSubHeader; + * DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT DeviceContext; + * } DEVICE_SECURITY_EVENT_DATA; + * <p> + * typedef struct tdDEVICE_SECURITY_EVENT_DATA_HEADER or HEADER2 { + * UINT8 Signature[16]; + * UINT16 Version; + * ... ... + * } + * <p> + * Notes: Parses event data for an DEVICE_SECURITY_EVENT_DATA per PFP v1.06 Rev52 Table 20. + * 1. Has an EventType of EV_EFI_SPDM_FIRMWARE_BLOB (0x800000E1) + * 2. Digest of 48 bytes + * 3. Event content defined as DEVICE_SECURITY_EVENT_DATA Struct. + * 4. First 16 bytes of the structure header is an ASCII "SPDM Device Sec" + */ +public abstract class DeviceSecurityEventDataBase { + + /** + * Signature (text) data. + */ + @Getter + private String signature = ""; + /** + * Version determines data structure used (..DATA or ..DATA2). + */ + @Getter + private String version = ""; +// /** +// * Contains the human-readable info inside the Device Security Event. +// */ +// @Getter +// private String dsedInfo = ""; +// /** +// * DeviceSecurityEventDataHeader Object. +// */ +// @Getter +// private DeviceSecurityEventDataHeader dsedHeader = null; + /** + * DeviceSecurityEventDataSubHeader Object. + */ +// @Getter +// private DeviceSecurityEventDataSubHeader dsedSubHeader = null; + /** + * DeviceSecurityEventDataDeviceContext Object. + */ + @Getter + private DeviceSecurityEventDataDeviceContext dsedDeviceContext = null; + + public DeviceSecurityEventDataBase() { + + } + + /** + * DeviceSecurityEventData Constructor. + * + * @param dSEDbytes byte array holding the DeviceSecurityEventData. + */ + public DeviceSecurityEventDataBase(final byte[] dSEDbytes) { + + byte[] signatureBytes = new byte[UefiConstants.SIZE_16]; + System.arraycopy(dSEDbytes, 0, signatureBytes, 0, UefiConstants.SIZE_16); + //signature = HexUtils.byteArrayToHexString(signatureBytes); + signature = new String(signatureBytes, StandardCharsets.UTF_8) + .substring(0, UefiConstants.SIZE_15); // size 15 bc last letter is a 00 (null) + + byte[] versionBytes = new byte[UefiConstants.SIZE_2]; + System.arraycopy(dSEDbytes, UefiConstants.OFFSET_16, versionBytes, 0, + UefiConstants.SIZE_2); + version = HexUtils.byteArrayToHexString(versionBytes); + +// int byteOffset = 0; +// byteOffset = dsedHeader.getDsedHeaderByteSize(); + + // If version is 0x01, the event is a DEVICE_SECURITY_EVENT_DATA + // If version is 0x02, the event is a DEVICE_SECURITY_EVENT_DATA2 +// switch (version) { +// case "0100": +// dsedHeader = new DeviceSecurityEventDataHeader(dSEDbytes); +//// dsedDeviceContext = new DeviceSecurityEventDataDeviceContext(dSEDbytes, +//// dsedHeader.getDSEDheaderByteSize()); +// break; +// case "0200": +// dsedHeader = new DeviceSecurityEventDataHeader(dSEDbytes); +//// dsedSubHeader = new DeviceSecurityEventDataSubHeader(dSEDbytes,byteOffset); +//// byteOffset = dsedHeader.getDSEDsubHeaderByteSize(); +//// dsedDeviceContext = new DeviceSecurityEventDataDeviceContext(dSEDbytes, byteOffset); +// break; +// default: +// break; + + +// if (version == "1") { +// dSEDinfo =+ +// dSEDataHeader.getDSEDheaderInfo(); +// dSEDinfo =+ +// dsedDeviceContext.getdSEDdeviceContextInfo(); +// } else if (version == "2") { +// dSEDinfo =+ +// dSEDheader.getDSEDheaderInfo(); +// dSEDinfo =+ +// dsedSubHeader.getDSEDsubHeaderInfo(); +// dSEDinfo =+ +// dsedDeviceContext.getDSEDdeviceContextInfo(); +// } + } + } + + public String toString() { + String dsedInfo = ""; + switch (version) { + case "0100": + dsedInfo += dsedHeader.toString(); +// dsedInfo += dsedDeviceContext.toString(); + break; + case "0200": +// dsedInfo += dsedHeader.toString(); +// dsedInfo += dsedSubHeader.toString(); +// dsedInfo += dsedDeviceContext.toString(); + break; + default: + dsedInfo += " Unknown SPDM Device Security Event Data version " + version + " found" + "\n"; + } + return dsedInfo; + } +} diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java index 2d46bdc2..1cbaf229 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java @@ -1,270 +1,9 @@ package hirs.utils.tpm.eventlog.events; -import hirs.utils.HexUtils; -import hirs.utils.tpm.eventlog.TcgTpmtHa; -import hirs.utils.tpm.eventlog.spdm.SpdmHa; -import hirs.utils.tpm.eventlog.spdm.SpdmMeasurementBlock; -import hirs.utils.tpm.eventlog.uefi.UefiConstants; -import lombok.Getter; +public class DeviceSecurityEventDataHeader extends DeviceSecurityEventDataHeaderBase { -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; -/** - * Class to process the DEVICE_SECURITY_EVENT_DATA_HEADER or ..HEADER2 per PFP. - * The first 16 bytes of the event data header MUST be a String based identifier (Signature), - * NUL-terminated, per PFP. The only currently defined Signature is "SPDM Device Sec", - * which implies the data is a DEVICE_SECURITY_EVENT_DATA or ..DATA2. - * DEVICE_SECURITY_EVENT_DATA_HEADER contains the measurement(s) and hash algorithm identifier - * returned by the SPDM "GET_MEASUREMENTS" function. - * - * HEADERS defined by PFP v1.06 Rev 52: - * <p> - * typedef struct tdDEVICE_SECURITY_EVENT_DATA_HEADER { - * UINT8 Signature[16]; - * UINT16 Version; - * UINT16 Length; - * UINT32 SpdmHashAlg; - * UINT32 DeviceType; - * SPDM_MEASUREMENT_BLOCK SpdmMeasurementBlock; - * UINT64 DevicePathLength; - * UNIT8 DevicePath[DevicePathLength] - * } DEVICE_SECURITY_EVENT_DATA_HEADER; - * <p> - * typedef struct tdDEVICE_SECURITY_EVENT_DATA_HEADER2 { - NOT IMPLEMENTED YET - * UINT8 Signature[16]; - * UINT16 Version; - * UINT8 AuthState; - * UINT8 Reserved; - * UINT32 Length; - * UINT32 DeviceType; - * UINT32 SubHeaderType; - * UINT32 SubHeaderLength; - * UINT32 SubHeaderUID; - * UINT64 DevicePathLength; - * UNIT8 DevicePath[DevicePathLength] - * } DEVICE_SECURITY_EVENT_DATA_HEADER2; - * - * SPDM_MEASUREMENT_BLOCK and contents defined by SPDM v1.03, Sect 10.11.1, Table 53 and 54: - * <p> - * Measurement block format { - * Index 1 byte; - * MeasurementSpec 1 byte; - * MeasurementSize 2 bytes; - * Measurement <MeasurementSize> bytes; - * } - * <p> - * DMTF measurement spec format { - * DMTFSpecMeasurementValueType 1 byte; - * DMTFSpecMeasurementValueSize 2 bytes; - * DMTFSpecMeasurementValue <DMTFSpecMeasurementValueSize> bytes; - * } - * <p> - * DMTFSpecMeasurementValueType[7] - * Indicates how bits [0:6] are represented - * Bit = 0: Digest - * Bit = 1: Raw bit stream - * DMTFSpecMeasurementValueType[6:0] - * Immutable ROM 0x0 - * Mutable firmware 0x1 - * Hardware configuration 0x2 - * Firmware configuration 0x3 - * etc. - * <p> - */ -public class DeviceSecurityEventDataHeader { - -// /** -// * Contains the human-readable info inside the Device Security Event. -// */ -// @Getter -// private String dSEDheaderInfo = ""; - - /** ----------- Variables common to all Header Types ----------- - */ - /** - * Contains the size (in bytes) of the Header. - */ - @Getter - private Integer dSEDheaderByteSize = 0; - /** - * Signature (text) data. - */ - @Getter - private String signature = ""; - /** - * Version determines data structure used (..DATA or ..DATA2), - * which determines whether ..HEADER or ..HEADER2 is used - */ - @Getter - private String version = ""; - /** - * Device type. - */ - @Getter - private String deviceType = ""; - /** - * Device path length. - */ - @Getter - private String devicePathLength = ""; - /** - * Device path. - */ - @Getter - private String devicePath = ""; - - /** - * 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; - - /** ----------- Variables specific to Header Type 1 ----------- -// /** -// * Type Header 1 event data length. -// */ -// @Getter -// private String h1Length = ""; - /** - * Type Header 1 SPDM hash algorithm. - */ - @Getter - private String h1SpdmHashAlgo = ""; -// /** -// * Type Header 1 SPDM Measurement Block list. -// */ -// private List<SpdmMeasurementBlock> h1SpdmMeasurementBlockList; - /** - * Type Header 1 SPDM Measurement Block. - */ - private SpdmMeasurementBlock h1SpdmMeasurementBlock; - - /** ----------- Variables specific to Header Type 2 ----------- - */ - // TBD - - /** - * DeviceSecurityEventDataHeader Constructor. - * - * @param dSEDbytes byte array holding the DeviceSecurityEventData. - */ public DeviceSecurityEventDataHeader(final byte[] dSEDbytes) { -// spdmMeasurementBlockList = new ArrayList<>(); - - byte[] signatureBytes = new byte[UefiConstants.SIZE_16]; - System.arraycopy(dSEDbytes, 0, signatureBytes, 0, UefiConstants.SIZE_16); - signature = new String(signatureBytes, StandardCharsets.UTF_8) - .substring(0, UefiConstants.SIZE_15); - - byte[] versionBytes = new byte[UefiConstants.SIZE_2]; - System.arraycopy(dSEDbytes, UefiConstants.OFFSET_16, versionBytes, 0, - UefiConstants.SIZE_2); - version = HexUtils.byteArrayToHexString(versionBytes); - -// if(version == "0100") { - if (version.equals("0100")) { - - byte[] lengthBytes = new byte[UefiConstants.SIZE_2]; - System.arraycopy(dSEDbytes, 18, lengthBytes, 0, - UefiConstants.SIZE_2); - int h1Length = HexUtils.leReverseInt(lengthBytes); - - byte[] spdmHashAlgoBytes = new byte[UefiConstants.SIZE_4]; - System.arraycopy(dSEDbytes, UefiConstants.OFFSET_20, spdmHashAlgoBytes, 0, - UefiConstants.SIZE_4); - int h1SpdmHashAlgoInt = HexUtils.leReverseInt(spdmHashAlgoBytes); - h1SpdmHashAlgo = SpdmHa.tcgAlgIdToString(h1SpdmHashAlgoInt); - - byte[] deviceTypeBytes = new byte[UefiConstants.SIZE_4]; - System.arraycopy(dSEDbytes, UefiConstants.OFFSET_24, deviceTypeBytes, 0, - UefiConstants.SIZE_4); - int deviceTypeInt = HexUtils.leReverseInt(deviceTypeBytes); - deviceType = deviceTypeToString(deviceTypeInt); - - // For each measurement block, create a SpdmMeasurementBlock object (can there be many blocks ?) - - // get the size of the SPDM Measurement Block - byte[] sizeOfSpdmMeasBlockBytes = new byte[UefiConstants.SIZE_2]; - System.arraycopy(dSEDbytes, 30, sizeOfSpdmMeasBlockBytes, 0, - UefiConstants.SIZE_2); - int sizeOfSpdmMeas = HexUtils.leReverseInt(sizeOfSpdmMeasBlockBytes); - int sizeOfSpdmMeasBlock = sizeOfSpdmMeas + 4; - - // extract the bytes from the SPDM Measurement Block - byte[] spdmMeasBlockBytes = new byte[sizeOfSpdmMeasBlock]; - System.arraycopy(dSEDbytes, 28, spdmMeasBlockBytes, 0, - sizeOfSpdmMeasBlock); - h1SpdmMeasurementBlock = new SpdmMeasurementBlock(spdmMeasBlockBytes); - -// byte[] algorithmIDBytes = new byte[UefiConstants.SIZE_2]; -// int algLocation = UefiConstants.SIZE_28; -// for (int i = 0; i < numberOfAlg; i++) { -// System.arraycopy(efiSpecId, algLocation + UefiConstants.OFFSET_4 * i, algorithmIDBytes, -// 0, UefiConstants.SIZE_2); -// String alg = TcgTpmtHa.tcgAlgIdToString(HexUtils.leReverseInt(algorithmIDBytes)); -// algList.add(alg); -// } -// if ((algList.size() == 1) && (algList.get(0).compareTo("SHA1") == 0)) { -// cryptoAgile = false; -// } else { -// cryptoAgile = true; -// } - - } } - - /** - * Returns the device type via a lookup. - * Lookup based upon section 10.2.7.2, Table 19, in the PFP 1.06 v52 spec. - * - * @param deviceTypeInt int to convert to string - * @return name of the device type - */ - public String deviceTypeToString(final int deviceTypeInt) { - String deviceTypeStr; - switch (deviceTypeInt) { - case DEVICE_TYPE_NONE: - deviceTypeStr = "No device type"; - break; - case DEVICE_TYPE_PCI: - deviceTypeStr = "PCI"; - break; - case DEVICE_TYPE_USB: - deviceTypeStr = "USB"; - break; - default: - deviceTypeStr = "Unknown or invalid Device Type"; - } - return deviceTypeStr; - } - - /** - * Returns a human readable description of the data within this event. - * - * @return a description of this event.. - */ - public String toString() { - String dsedHeaderInfo = ""; - if (version.equals("0100")) { - dsedHeaderInfo += "\n SPDM hash algorithm = " + h1SpdmHashAlgo; - dsedHeaderInfo += "\n SPDM Device"; - dsedHeaderInfo += "\n Device Type: " + deviceType; - dsedHeaderInfo += "\n Device Path: " + devicePath; - dsedHeaderInfo += "\n SPDM Measurement Block " + h1SpdmMeasurementBlock.toString(); - } else if(version.equals("0200")) { - dsedHeaderInfo = "tbd"; - } - return dsedHeaderInfo; - } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader2.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader2.java new file mode 100644 index 00000000..c129ec30 --- /dev/null +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader2.java @@ -0,0 +1,8 @@ +package hirs.utils.tpm.eventlog.events; + +public class DeviceSecurityEventDataHeader2 extends DeviceSecurityEventDataHeaderBase { + + public DeviceSecurityEventDataHeader2(final byte[] dSEDbytes) { + + } +} diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java new file mode 100644 index 00000000..4eed7d27 --- /dev/null +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java @@ -0,0 +1,272 @@ +package hirs.utils.tpm.eventlog.events; + +import hirs.utils.HexUtils; +import hirs.utils.tpm.eventlog.spdm.SpdmHa; +import hirs.utils.tpm.eventlog.spdm.SpdmMeasurementBlock; +import hirs.utils.tpm.eventlog.uefi.UefiConstants; +import lombok.Getter; + +import java.nio.charset.StandardCharsets; + +/** + * Class to process the DEVICE_SECURITY_EVENT_DATA_HEADER or ..HEADER2 per PFP. + * The first 16 bytes of the event data header MUST be a String based identifier (Signature), + * NUL-terminated, per PFP. The only currently defined Signature is "SPDM Device Sec", + * which implies the data is a DEVICE_SECURITY_EVENT_DATA or ..DATA2. + * DEVICE_SECURITY_EVENT_DATA_HEADER contains the measurement(s) and hash algorithm identifier + * returned by the SPDM "GET_MEASUREMENTS" function. + * + * HEADERS defined by PFP v1.06 Rev 52: + * <p> + * typedef struct tdDEVICE_SECURITY_EVENT_DATA_HEADER { + * UINT8 Signature[16]; + * UINT16 Version; + * UINT16 Length; + * UINT32 SpdmHashAlg; + * UINT32 DeviceType; + * SPDM_MEASUREMENT_BLOCK SpdmMeasurementBlock; + * UINT64 DevicePathLength; + * UNIT8 DevicePath[DevicePathLength] + * } DEVICE_SECURITY_EVENT_DATA_HEADER; + * <p> + * typedef struct tdDEVICE_SECURITY_EVENT_DATA_HEADER2 { - NOT IMPLEMENTED YET + * UINT8 Signature[16]; + * UINT16 Version; + * UINT8 AuthState; + * UINT8 Reserved; + * UINT32 Length; + * UINT32 DeviceType; + * UINT32 SubHeaderType; + * UINT32 SubHeaderLength; + * UINT32 SubHeaderUID; + * UINT64 DevicePathLength; + * UNIT8 DevicePath[DevicePathLength] + * } DEVICE_SECURITY_EVENT_DATA_HEADER2; + * + * SPDM_MEASUREMENT_BLOCK and contents defined by SPDM v1.03, Sect 10.11.1, Table 53 and 54: + * <p> + * Measurement block format { + * Index 1 byte; + * MeasurementSpec 1 byte; + * MeasurementSize 2 bytes; + * Measurement <MeasurementSize> bytes; + * } + * <p> + * DMTF measurement spec format { + * DMTFSpecMeasurementValueType 1 byte; + * DMTFSpecMeasurementValueSize 2 bytes; + * DMTFSpecMeasurementValue <DMTFSpecMeasurementValueSize> bytes; + * } + * <p> + * DMTFSpecMeasurementValueType[7] + * Indicates how bits [0:6] are represented + * Bit = 0: Digest + * Bit = 1: Raw bit stream + * DMTFSpecMeasurementValueType[6:0] + * Immutable ROM 0x0 + * Mutable firmware 0x1 + * Hardware configuration 0x2 + * Firmware configuration 0x3 + * etc. + * <p> + */ +public abstract class DeviceSecurityEventDataHeaderBase { + +// /** +// * Contains the human-readable info inside the Device Security Event. +// */ +// @Getter +// private String dSEDheaderInfo = ""; + + /** ----------- Variables common to all Header Types ----------- + */ + /** + * Contains the size (in bytes) of the Header. + */ + @Getter + private Integer dSEDheaderByteSize = 0; + /** + * Signature (text) data. + */ + @Getter + private String signature = ""; + /** + * Version determines data structure used (..DATA or ..DATA2), + * which determines whether ..HEADER or ..HEADER2 is used + */ + @Getter + private String version = ""; + /** + * Device type. + */ + @Getter + private String deviceType = ""; + /** + * Device path length. + */ + @Getter + private String devicePathLength = ""; + /** + * Device path. + */ + @Getter + private String devicePath = ""; + + /** + * 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; + + /** ----------- Variables specific to Header Type 1 ----------- +// /** +// * Type Header 1 event data length. +// */ +// @Getter +// private String h1Length = ""; + /** + * Type Header 1 SPDM hash algorithm. + */ + @Getter + private String h1SpdmHashAlgo = ""; +// /** +// * Type Header 1 SPDM Measurement Block list. +// */ +// private List<SpdmMeasurementBlock> h1SpdmMeasurementBlockList; + /** + * Type Header 1 SPDM Measurement Block. + */ + private SpdmMeasurementBlock h1SpdmMeasurementBlock; + + /** ----------- Variables specific to Header Type 2 ----------- + */ + // TBD + + public DeviceSecurityEventDataHeaderBase() { + + } + + + /** + * DeviceSecurityEventDataHeader Constructor. + * + * @param dSEDbytes byte array holding the DeviceSecurityEventData. + */ + public DeviceSecurityEventDataHeaderBase(final byte[] dSEDbytes) { + +// spdmMeasurementBlockList = new ArrayList<>(); + + byte[] signatureBytes = new byte[UefiConstants.SIZE_16]; + System.arraycopy(dSEDbytes, 0, signatureBytes, 0, UefiConstants.SIZE_16); + signature = new String(signatureBytes, StandardCharsets.UTF_8) + .substring(0, UefiConstants.SIZE_15); + + byte[] versionBytes = new byte[UefiConstants.SIZE_2]; + System.arraycopy(dSEDbytes, UefiConstants.OFFSET_16, versionBytes, 0, + UefiConstants.SIZE_2); + version = HexUtils.byteArrayToHexString(versionBytes); + +// if(version == "0100") { + if (version.equals("0100")) { + + byte[] lengthBytes = new byte[UefiConstants.SIZE_2]; + System.arraycopy(dSEDbytes, 18, lengthBytes, 0, + UefiConstants.SIZE_2); + int h1Length = HexUtils.leReverseInt(lengthBytes); + + byte[] spdmHashAlgoBytes = new byte[UefiConstants.SIZE_4]; + System.arraycopy(dSEDbytes, UefiConstants.OFFSET_20, spdmHashAlgoBytes, 0, + UefiConstants.SIZE_4); + int h1SpdmHashAlgoInt = HexUtils.leReverseInt(spdmHashAlgoBytes); + h1SpdmHashAlgo = SpdmHa.tcgAlgIdToString(h1SpdmHashAlgoInt); + + byte[] deviceTypeBytes = new byte[UefiConstants.SIZE_4]; + System.arraycopy(dSEDbytes, UefiConstants.OFFSET_24, deviceTypeBytes, 0, + UefiConstants.SIZE_4); + int deviceTypeInt = HexUtils.leReverseInt(deviceTypeBytes); + deviceType = deviceTypeToString(deviceTypeInt); + + // For each measurement block, create a SpdmMeasurementBlock object (can there be many blocks ?) + + // get the size of the SPDM Measurement Block + byte[] sizeOfSpdmMeasBlockBytes = new byte[UefiConstants.SIZE_2]; + System.arraycopy(dSEDbytes, 30, sizeOfSpdmMeasBlockBytes, 0, + UefiConstants.SIZE_2); + int sizeOfSpdmMeas = HexUtils.leReverseInt(sizeOfSpdmMeasBlockBytes); + int sizeOfSpdmMeasBlock = sizeOfSpdmMeas + 4; + + // extract the bytes from the SPDM Measurement Block + byte[] spdmMeasBlockBytes = new byte[sizeOfSpdmMeasBlock]; + System.arraycopy(dSEDbytes, 28, spdmMeasBlockBytes, 0, + sizeOfSpdmMeasBlock); + h1SpdmMeasurementBlock = new SpdmMeasurementBlock(spdmMeasBlockBytes); + +// byte[] algorithmIDBytes = new byte[UefiConstants.SIZE_2]; +// int algLocation = UefiConstants.SIZE_28; +// for (int i = 0; i < numberOfAlg; i++) { +// System.arraycopy(efiSpecId, algLocation + UefiConstants.OFFSET_4 * i, algorithmIDBytes, +// 0, UefiConstants.SIZE_2); +// String alg = TcgTpmtHa.tcgAlgIdToString(HexUtils.leReverseInt(algorithmIDBytes)); +// algList.add(alg); +// } +// if ((algList.size() == 1) && (algList.get(0).compareTo("SHA1") == 0)) { +// cryptoAgile = false; +// } else { +// cryptoAgile = true; +// } + + } + } + + /** + * Returns the device type via a lookup. + * Lookup based upon section 10.2.7.2, Table 19, in the PFP 1.06 v52 spec. + * + * @param deviceTypeInt int to convert to string + * @return name of the device type + */ + public String deviceTypeToString(final int deviceTypeInt) { + String deviceTypeStr; + switch (deviceTypeInt) { + case DEVICE_TYPE_NONE: + deviceTypeStr = "No device type"; + break; + case DEVICE_TYPE_PCI: + deviceTypeStr = "PCI"; + break; + case DEVICE_TYPE_USB: + deviceTypeStr = "USB"; + break; + default: + deviceTypeStr = "Unknown or invalid Device Type"; + } + return deviceTypeStr; + } + + /** + * Returns a human readable description of the data within this event. + * + * @return a description of this event.. + */ + public String toString() { + String dsedHeaderInfo = ""; + if (version.equals("0100")) { + dsedHeaderInfo += "\n SPDM hash algorithm = " + h1SpdmHashAlgo; + dsedHeaderInfo += "\n SPDM Device"; + dsedHeaderInfo += "\n Device Type: " + deviceType; + dsedHeaderInfo += "\n Device Path: " + devicePath; + dsedHeaderInfo += "\n SPDM Measurement Block " + h1SpdmMeasurementBlock.toString(); + } else if(version.equals("0200")) { + dsedHeaderInfo = "tbd"; + } + return dsedHeaderInfo; + } + +} diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java index c0a7d6c5..17f46239 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java @@ -39,14 +39,13 @@ public class EvEfiSpdmFirmwareBlob { */ private String signature = ""; /** - * True if the event is a DEVICE_SECURITY_EVENT_DATA. + * True if the event is a DEVICE_SECURITY_EVENT_DATA or ..DATA2. */ private boolean bDeviceSecurityEventData = false; /** - * DeviceSecurityEventData Object. + * Human readable description of the data within this DEVICE_SECURITY_EVENT_DATA/..DATA2 event. */ - @Getter - private DeviceSecurityEventData deviceSecurityEventData = null; + String spdmInfo = ""; /** * EvEfiSpdmFirmwareBlob constructor. @@ -55,13 +54,31 @@ public class EvEfiSpdmFirmwareBlob { * @throws java.io.UnsupportedEncodingException if input fails to parse. */ public EvEfiSpdmFirmwareBlob(final byte[] eventData) throws UnsupportedEncodingException { + byte[] signatureBytes = new byte[UefiConstants.SIZE_15]; System.arraycopy(eventData, 0, signatureBytes, 0, UefiConstants.SIZE_15); signature = new String(signatureBytes, StandardCharsets.UTF_8); signature = signature.replaceAll("[^\\P{C}\t\r\n]", ""); // remove null characters + if (signature.contains("SPDM Device Sec")) { // implies Device Security event - deviceSecurityEventData = new DeviceSecurityEventData(eventData); bDeviceSecurityEventData = true; + + byte[] versionBytes = new byte[UefiConstants.SIZE_2]; + System.arraycopy(eventData, UefiConstants.OFFSET_16, versionBytes, 0, + UefiConstants.SIZE_2); + String version = HexUtils.byteArrayToHexString(versionBytes); + + if (version.equals("0100")) { + DeviceSecurityEventData dSED = new DeviceSecurityEventData(eventData); + spdmInfo = dSED.toString(); + } + else if (version.equals("0200")) { + DeviceSecurityEventData2 dSED2 = new DeviceSecurityEventData2(eventData); + spdmInfo = dSED2.toString(); + } + else { + spdmInfo = " Unknown version of DeviceSecurityEventData structure"; + } } } @@ -80,10 +97,11 @@ public class EvEfiSpdmFirmwareBlob { * @return Human readable description of this event. */ public String toString() { - String spdmInfo = ""; +// String spdmInfo = ""; if (bDeviceSecurityEventData) { - spdmInfo += " Signature = SPDM Device Sec"; - spdmInfo += deviceSecurityEventData.toString(); + spdmInfo = " Signature = SPDM Device Sec" + spdmInfo; +// spdmInfo += " Signature = SPDM Device Sec"; +// spdmInfo += deviceSecurityEventData.toString(); } else { spdmInfo = "EV_EFI_SPDM_FIRMWARE_BLOB event named " + signature + " encountered but support for processing it has not been added to this application.\n"; From 605dbe536a940afa18e579485dae4a56830f247f Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Fri, 19 Apr 2024 18:07:00 -0400 Subject: [PATCH 15/31] spdm processing --- .../events/DeviceSecurityEventData.java | 9 +- .../events/DeviceSecurityEventData2.java | 21 ++++ .../events/DeviceSecurityEventDataBase.java | 71 +++++++------- .../events/DeviceSecurityEventDataHeader.java | 85 ++++++++++++++++ .../DeviceSecurityEventDataHeaderBase.java | 98 +++---------------- 5 files changed, 161 insertions(+), 123 deletions(-) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java index 570d0eb7..9e3098ab 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java @@ -17,7 +17,14 @@ public class DeviceSecurityEventData extends DeviceSecurityEventDataBase { * @param dSEDbytes byte array holding the DeviceSecurityEventData. */ public DeviceSecurityEventData(final byte[] dSEDbytes) { - + super(dSEDbytes); dsedHeader = new DeviceSecurityEventDataHeader(dSEDbytes); } + + public String toString() { + String dsedInfo = ""; + dsedInfo += dsedHeader.toString(); +// dsedInfo += dsedDeviceContext.toString(); + return dsedInfo; + } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData2.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData2.java index 61370781..89154120 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData2.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData2.java @@ -1,7 +1,20 @@ package hirs.utils.tpm.eventlog.events; +import lombok.Getter; + public class DeviceSecurityEventData2 extends DeviceSecurityEventDataBase { + /** + * DeviceSecurityEventDataHeader2 Object. + */ + @Getter + private DeviceSecurityEventDataHeader2 dsedHeader2 = null; +// /** +// * DeviceSecurityEventDataSubHeader Object. +// */ +// @Getter +// private DeviceSecurityEventDataSubHeader dsedSubHeader = null; + /** * DeviceSecurityEventData2 Constructor. * @@ -10,4 +23,12 @@ public class DeviceSecurityEventData2 extends DeviceSecurityEventDataBase { public DeviceSecurityEventData2(final byte[] dSEDbytes) { } + + public String toString() { + String dsedInfo = ""; +// dsedInfo += dsedHeader2.toString(); +// dsedInfo += dsedSubHeader.toString(); +// dsedInfo += dsedDeviceContext.toString(); + return dsedInfo; + } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java index ad66297e..3e7b8a1f 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java @@ -47,16 +47,16 @@ import java.nio.charset.StandardCharsets; */ public abstract class DeviceSecurityEventDataBase { - /** - * Signature (text) data. - */ - @Getter - private String signature = ""; - /** - * Version determines data structure used (..DATA or ..DATA2). - */ - @Getter - private String version = ""; +// /** +// * Signature (text) data. +// */ +// @Getter +// private String signature = ""; +// /** +// * Version determines data structure used (..DATA or ..DATA2). +// */ +// @Getter +// private String version = ""; // /** // * Contains the human-readable info inside the Device Security Event. // */ @@ -67,11 +67,6 @@ public abstract class DeviceSecurityEventDataBase { // */ // @Getter // private DeviceSecurityEventDataHeader dsedHeader = null; - /** - * DeviceSecurityEventDataSubHeader Object. - */ -// @Getter -// private DeviceSecurityEventDataSubHeader dsedSubHeader = null; /** * DeviceSecurityEventDataDeviceContext Object. */ @@ -89,16 +84,16 @@ public abstract class DeviceSecurityEventDataBase { */ public DeviceSecurityEventDataBase(final byte[] dSEDbytes) { - byte[] signatureBytes = new byte[UefiConstants.SIZE_16]; - System.arraycopy(dSEDbytes, 0, signatureBytes, 0, UefiConstants.SIZE_16); - //signature = HexUtils.byteArrayToHexString(signatureBytes); - signature = new String(signatureBytes, StandardCharsets.UTF_8) - .substring(0, UefiConstants.SIZE_15); // size 15 bc last letter is a 00 (null) - - byte[] versionBytes = new byte[UefiConstants.SIZE_2]; - System.arraycopy(dSEDbytes, UefiConstants.OFFSET_16, versionBytes, 0, - UefiConstants.SIZE_2); - version = HexUtils.byteArrayToHexString(versionBytes); +// byte[] signatureBytes = new byte[UefiConstants.SIZE_16]; +// System.arraycopy(dSEDbytes, 0, signatureBytes, 0, UefiConstants.SIZE_16); +// //signature = HexUtils.byteArrayToHexString(signatureBytes); +// signature = new String(signatureBytes, StandardCharsets.UTF_8) +// .substring(0, UefiConstants.SIZE_15); // size 15 bc last letter is a 00 (null) +// +// byte[] versionBytes = new byte[UefiConstants.SIZE_2]; +// System.arraycopy(dSEDbytes, UefiConstants.OFFSET_16, versionBytes, 0, +// UefiConstants.SIZE_2); +// version = HexUtils.byteArrayToHexString(versionBytes); // int byteOffset = 0; // byteOffset = dsedHeader.getDsedHeaderByteSize(); @@ -134,24 +129,24 @@ public abstract class DeviceSecurityEventDataBase { // dSEDinfo =+ // dsedDeviceContext.getDSEDdeviceContextInfo(); // } - } +// } } public String toString() { String dsedInfo = ""; - switch (version) { - case "0100": - dsedInfo += dsedHeader.toString(); -// dsedInfo += dsedDeviceContext.toString(); - break; - case "0200": +// switch (version) { +// case "0100": // dsedInfo += dsedHeader.toString(); -// dsedInfo += dsedSubHeader.toString(); -// dsedInfo += dsedDeviceContext.toString(); - break; - default: - dsedInfo += " Unknown SPDM Device Security Event Data version " + version + " found" + "\n"; - } +//// dsedInfo += dsedDeviceContext.toString(); +// break; +// case "0200": +//// dsedInfo += dsedHeader.toString(); +//// dsedInfo += dsedSubHeader.toString(); +//// dsedInfo += dsedDeviceContext.toString(); +// break; +// default: +// dsedInfo += " Unknown SPDM Device Security Event Data version " + version + " found" + "\n"; +// } return dsedInfo; } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java index 1cbaf229..f655a807 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java @@ -1,9 +1,94 @@ package hirs.utils.tpm.eventlog.events; +import hirs.utils.HexUtils; +import hirs.utils.tpm.eventlog.spdm.SpdmHa; +import hirs.utils.tpm.eventlog.spdm.SpdmMeasurementBlock; +import hirs.utils.tpm.eventlog.uefi.UefiConstants; +import lombok.Getter; + public class DeviceSecurityEventDataHeader extends DeviceSecurityEventDataHeaderBase { + /** ----------- Variables specific to Header Type 1 ----------- + // /** + // * Type Header 1 event data length. + // */ +// @Getter +// private String h1Length = ""; + /** + * Type Header 1 SPDM hash algorithm. + */ + @Getter + private String h1SpdmHashAlgo = ""; +// /** +// * Type Header 1 SPDM Measurement Block list. +// */ +// private List<SpdmMeasurementBlock> h1SpdmMeasurementBlockList; + /** + * Type Header 1 SPDM Measurement Block. + */ + private SpdmMeasurementBlock h1SpdmMeasurementBlock; public DeviceSecurityEventDataHeader(final byte[] dSEDbytes) { + byte[] lengthBytes = new byte[UefiConstants.SIZE_2]; + System.arraycopy(dSEDbytes, 18, lengthBytes, 0, + UefiConstants.SIZE_2); + int h1Length = HexUtils.leReverseInt(lengthBytes); + + byte[] spdmHashAlgoBytes = new byte[UefiConstants.SIZE_4]; + System.arraycopy(dSEDbytes, UefiConstants.OFFSET_20, spdmHashAlgoBytes, 0, + UefiConstants.SIZE_4); + int h1SpdmHashAlgoInt = HexUtils.leReverseInt(spdmHashAlgoBytes); + h1SpdmHashAlgo = SpdmHa.tcgAlgIdToString(h1SpdmHashAlgoInt); + + byte[] deviceTypeBytes = new byte[UefiConstants.SIZE_4]; + System.arraycopy(dSEDbytes, UefiConstants.OFFSET_24, deviceTypeBytes, 0, + UefiConstants.SIZE_4); + int deviceTypeInt = HexUtils.leReverseInt(deviceTypeBytes); + deviceType = deviceTypeToString(deviceTypeInt); + + // For each measurement block, create a SpdmMeasurementBlock object (can there be many blocks ?) + + // get the size of the SPDM Measurement Block + byte[] sizeOfSpdmMeasBlockBytes = new byte[UefiConstants.SIZE_2]; + System.arraycopy(dSEDbytes, 30, sizeOfSpdmMeasBlockBytes, 0, + UefiConstants.SIZE_2); + int sizeOfSpdmMeas = HexUtils.leReverseInt(sizeOfSpdmMeasBlockBytes); + int sizeOfSpdmMeasBlock = sizeOfSpdmMeas + 4; + + // extract the bytes from the SPDM Measurement Block + byte[] spdmMeasBlockBytes = new byte[sizeOfSpdmMeasBlock]; + System.arraycopy(dSEDbytes, 28, spdmMeasBlockBytes, 0, + sizeOfSpdmMeasBlock); + h1SpdmMeasurementBlock = new SpdmMeasurementBlock(spdmMeasBlockBytes); + +// byte[] algorithmIDBytes = new byte[UefiConstants.SIZE_2]; +// int algLocation = UefiConstants.SIZE_28; +// for (int i = 0; i < numberOfAlg; i++) { +// System.arraycopy(efiSpecId, algLocation + UefiConstants.OFFSET_4 * i, algorithmIDBytes, +// 0, UefiConstants.SIZE_2); +// String alg = TcgTpmtHa.tcgAlgIdToString(HexUtils.leReverseInt(algorithmIDBytes)); +// algList.add(alg); +// } +// if ((algList.size() == 1) && (algList.get(0).compareTo("SHA1") == 0)) { +// cryptoAgile = false; +// } else { +// cryptoAgile = true; +// } + + } + + + /** + * Returns a human readable description of the data within this event. + * + * @return a description of this event.. + */ + public String toString() { + String dsedHeaderInfo = ""; + dsedHeaderInfo += "\n SPDM hash algorithm = " + h1SpdmHashAlgo; + dsedHeaderInfo += "\n SPDM Measurement Block " + h1SpdmMeasurementBlock.toString(); + + return dsedHeaderInfo; } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java index 4eed7d27..0782a308 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java @@ -78,8 +78,6 @@ public abstract class DeviceSecurityEventDataHeaderBase { // @Getter // private String dSEDheaderInfo = ""; - /** ----------- Variables common to all Header Types ----------- - */ /** * Contains the size (in bytes) of the Header. */ @@ -125,29 +123,6 @@ public abstract class DeviceSecurityEventDataHeaderBase { */ public static final int DEVICE_TYPE_USB = 2; - /** ----------- Variables specific to Header Type 1 ----------- -// /** -// * Type Header 1 event data length. -// */ -// @Getter -// private String h1Length = ""; - /** - * Type Header 1 SPDM hash algorithm. - */ - @Getter - private String h1SpdmHashAlgo = ""; -// /** -// * Type Header 1 SPDM Measurement Block list. -// */ -// private List<SpdmMeasurementBlock> h1SpdmMeasurementBlockList; - /** - * Type Header 1 SPDM Measurement Block. - */ - private SpdmMeasurementBlock h1SpdmMeasurementBlock; - - /** ----------- Variables specific to Header Type 2 ----------- - */ - // TBD public DeviceSecurityEventDataHeaderBase() { @@ -173,56 +148,6 @@ public abstract class DeviceSecurityEventDataHeaderBase { UefiConstants.SIZE_2); version = HexUtils.byteArrayToHexString(versionBytes); -// if(version == "0100") { - if (version.equals("0100")) { - - byte[] lengthBytes = new byte[UefiConstants.SIZE_2]; - System.arraycopy(dSEDbytes, 18, lengthBytes, 0, - UefiConstants.SIZE_2); - int h1Length = HexUtils.leReverseInt(lengthBytes); - - byte[] spdmHashAlgoBytes = new byte[UefiConstants.SIZE_4]; - System.arraycopy(dSEDbytes, UefiConstants.OFFSET_20, spdmHashAlgoBytes, 0, - UefiConstants.SIZE_4); - int h1SpdmHashAlgoInt = HexUtils.leReverseInt(spdmHashAlgoBytes); - h1SpdmHashAlgo = SpdmHa.tcgAlgIdToString(h1SpdmHashAlgoInt); - - byte[] deviceTypeBytes = new byte[UefiConstants.SIZE_4]; - System.arraycopy(dSEDbytes, UefiConstants.OFFSET_24, deviceTypeBytes, 0, - UefiConstants.SIZE_4); - int deviceTypeInt = HexUtils.leReverseInt(deviceTypeBytes); - deviceType = deviceTypeToString(deviceTypeInt); - - // For each measurement block, create a SpdmMeasurementBlock object (can there be many blocks ?) - - // get the size of the SPDM Measurement Block - byte[] sizeOfSpdmMeasBlockBytes = new byte[UefiConstants.SIZE_2]; - System.arraycopy(dSEDbytes, 30, sizeOfSpdmMeasBlockBytes, 0, - UefiConstants.SIZE_2); - int sizeOfSpdmMeas = HexUtils.leReverseInt(sizeOfSpdmMeasBlockBytes); - int sizeOfSpdmMeasBlock = sizeOfSpdmMeas + 4; - - // extract the bytes from the SPDM Measurement Block - byte[] spdmMeasBlockBytes = new byte[sizeOfSpdmMeasBlock]; - System.arraycopy(dSEDbytes, 28, spdmMeasBlockBytes, 0, - sizeOfSpdmMeasBlock); - h1SpdmMeasurementBlock = new SpdmMeasurementBlock(spdmMeasBlockBytes); - -// byte[] algorithmIDBytes = new byte[UefiConstants.SIZE_2]; -// int algLocation = UefiConstants.SIZE_28; -// for (int i = 0; i < numberOfAlg; i++) { -// System.arraycopy(efiSpecId, algLocation + UefiConstants.OFFSET_4 * i, algorithmIDBytes, -// 0, UefiConstants.SIZE_2); -// String alg = TcgTpmtHa.tcgAlgIdToString(HexUtils.leReverseInt(algorithmIDBytes)); -// algList.add(alg); -// } -// if ((algList.size() == 1) && (algList.get(0).compareTo("SHA1") == 0)) { -// cryptoAgile = false; -// } else { -// cryptoAgile = true; -// } - - } } /** @@ -257,15 +182,20 @@ public abstract class DeviceSecurityEventDataHeaderBase { */ public String toString() { String dsedHeaderInfo = ""; - if (version.equals("0100")) { - dsedHeaderInfo += "\n SPDM hash algorithm = " + h1SpdmHashAlgo; - dsedHeaderInfo += "\n SPDM Device"; - dsedHeaderInfo += "\n Device Type: " + deviceType; - dsedHeaderInfo += "\n Device Path: " + devicePath; - dsedHeaderInfo += "\n SPDM Measurement Block " + h1SpdmMeasurementBlock.toString(); - } else if(version.equals("0200")) { - dsedHeaderInfo = "tbd"; - } + + dsedHeaderInfo += "\n SPDM Device"; + dsedHeaderInfo += "\n Device Type: " + deviceType; + dsedHeaderInfo += "\n Device Path: " + devicePath; + +// if (version.equals("0100")) { +// dsedHeaderInfo += "\n SPDM hash algorithm = " + h1SpdmHashAlgo; +// dsedHeaderInfo += "\n SPDM Device"; +// dsedHeaderInfo += "\n Device Type: " + deviceType; +// dsedHeaderInfo += "\n Device Path: " + devicePath; +// dsedHeaderInfo += "\n SPDM Measurement Block " + h1SpdmMeasurementBlock.toString(); +// } else if(version.equals("0200")) { +// dsedHeaderInfo = "tbd"; +// } return dsedHeaderInfo; } From c12952276870035f4eaea54efb6f5a3e3f217e02 Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Fri, 19 Apr 2024 18:32:59 -0400 Subject: [PATCH 16/31] spdm processing --- .../events/DeviceSecurityEventDataHeader.java | 2 ++ .../DeviceSecurityEventDataHeaderBase.java | 29 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java index f655a807..f3ad0ae4 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java @@ -30,6 +30,8 @@ public class DeviceSecurityEventDataHeader extends DeviceSecurityEventDataHeader public DeviceSecurityEventDataHeader(final byte[] dSEDbytes) { + super(dSEDbytes); + byte[] lengthBytes = new byte[UefiConstants.SIZE_2]; System.arraycopy(dSEDbytes, 18, lengthBytes, 0, UefiConstants.SIZE_2); diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java index 0782a308..27df6267 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java @@ -150,6 +150,35 @@ public abstract class DeviceSecurityEventDataHeaderBase { } + public int getDeviceTypeId(final byte[] dSEDbytes, int startByte) { + + // get the device type ID + byte[] deviceTypeBytes = new byte[UefiConstants.SIZE_4]; + System.arraycopy(dSEDbytes, startByte, deviceTypeBytes, 0, + UefiConstants.SIZE_4); + int deviceTypeId = HexUtils.leReverseInt(deviceTypeBytes); + return deviceTypeId; + } + + public String getDevicePathString(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); + int deviceTypeLength = HexUtils.leReverseInt(devicePathLengthBytes); + + // TO DO: how to interpret this?? i'ts not ascii + + // get the device path + startByte = startByte + UefiConstants.SIZE_8; + byte[] devicePathBytes = new byte[UefiConstants.SIZE_16]; + System.arraycopy(dSEDbytes, startByte, devicePathBytes, 0, + deviceTypeLength); + + return ""; + } + /** * Returns the device type via a lookup. * Lookup based upon section 10.2.7.2, Table 19, in the PFP 1.06 v52 spec. From f4c52271f593afae23875d7530622b718f62852b Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Fri, 19 Apr 2024 18:36:58 -0400 Subject: [PATCH 17/31] spdm processing --- .../events/DeviceSecurityEventDataHeader.java | 10 +++++----- .../DeviceSecurityEventDataHeaderBase.java | 18 +++++++++++------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java index f3ad0ae4..5073a1d2 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java @@ -43,11 +43,11 @@ public class DeviceSecurityEventDataHeader extends DeviceSecurityEventDataHeader int h1SpdmHashAlgoInt = HexUtils.leReverseInt(spdmHashAlgoBytes); h1SpdmHashAlgo = SpdmHa.tcgAlgIdToString(h1SpdmHashAlgoInt); - byte[] deviceTypeBytes = new byte[UefiConstants.SIZE_4]; - System.arraycopy(dSEDbytes, UefiConstants.OFFSET_24, deviceTypeBytes, 0, - UefiConstants.SIZE_4); - int deviceTypeInt = HexUtils.leReverseInt(deviceTypeBytes); - deviceType = deviceTypeToString(deviceTypeInt); +// byte[] deviceTypeBytes = new byte[UefiConstants.SIZE_4]; +// System.arraycopy(dSEDbytes, UefiConstants.OFFSET_24, deviceTypeBytes, 0, +// UefiConstants.SIZE_4); +// int deviceTypeInt = HexUtils.leReverseInt(deviceTypeBytes); +// deviceType = deviceTypeToString(deviceTypeInt); // For each measurement block, create a SpdmMeasurementBlock object (can there be many blocks ?) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java index 27df6267..ad4b93da 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java @@ -98,7 +98,12 @@ public abstract class DeviceSecurityEventDataHeaderBase { * Device type. */ @Getter - private String deviceType = ""; + private int deviceTypeId = -1; +// /** +// * Device type. +// */ +// @Getter +// private String deviceType = ""; /** * Device path length. */ @@ -150,17 +155,16 @@ public abstract class DeviceSecurityEventDataHeaderBase { } - public int getDeviceTypeId(final byte[] dSEDbytes, int startByte) { + public void extractDeviceTypeId(final byte[] dSEDbytes, int startByte) { // get the device type ID byte[] deviceTypeBytes = new byte[UefiConstants.SIZE_4]; System.arraycopy(dSEDbytes, startByte, deviceTypeBytes, 0, UefiConstants.SIZE_4); - int deviceTypeId = HexUtils.leReverseInt(deviceTypeBytes); - return deviceTypeId; + deviceTypeId = HexUtils.leReverseInt(deviceTypeBytes); } - public String getDevicePathString(final byte[] dSEDbytes, int startByte) { + public void extractDevicePathString(final byte[] dSEDbytes, int startByte) { // get the device path length byte[] devicePathLengthBytes = new byte[UefiConstants.SIZE_8]; @@ -168,7 +172,7 @@ public abstract class DeviceSecurityEventDataHeaderBase { UefiConstants.SIZE_8); int deviceTypeLength = HexUtils.leReverseInt(devicePathLengthBytes); - // TO DO: how to interpret this?? i'ts not ascii + // TODO: how to interpret this?? i'ts not ascii // get the device path startByte = startByte + UefiConstants.SIZE_8; @@ -176,7 +180,7 @@ public abstract class DeviceSecurityEventDataHeaderBase { System.arraycopy(dSEDbytes, startByte, devicePathBytes, 0, deviceTypeLength); - return ""; + // TODO: store device path length } /** From 13b90c09f5e5a463b40c69cb2de7026b0fc2364b Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Fri, 19 Apr 2024 18:38:25 -0400 Subject: [PATCH 18/31] spdm processing --- .../tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java index ad4b93da..ee0ee8ba 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java @@ -217,7 +217,7 @@ public abstract class DeviceSecurityEventDataHeaderBase { String dsedHeaderInfo = ""; dsedHeaderInfo += "\n SPDM Device"; - dsedHeaderInfo += "\n Device Type: " + deviceType; + dsedHeaderInfo += "\n Device Type: " + deviceTypeToString(deviceTypeId); dsedHeaderInfo += "\n Device Path: " + devicePath; // if (version.equals("0100")) { From a2737f59d04055e9cf50c2b206706fd84b50e78b Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Mon, 22 Apr 2024 14:35:58 -0400 Subject: [PATCH 19/31] spdm processing - output is complete --- .../hirs/utils/tpm/eventlog/TpmPcrEvent.java | 8 +- .../events/DeviceSecurityEventData.java | 4 +- .../events/DeviceSecurityEventDataBase.java | 4 + .../events/DeviceSecurityEventDataHeader.java | 88 ++++++++----- .../DeviceSecurityEventDataHeaderBase.java | 121 +++++++----------- .../hirs/utils/tpm/eventlog/spdm/SpdmHa.java | 3 +- .../tpm/eventlog/spdm/SpdmMeasurement.java | 105 ++++++++++++++- .../eventlog/spdm/SpdmMeasurementBlock.java | 64 +++++++-- 8 files changed, 273 insertions(+), 124 deletions(-) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java index f921ee4d..c6027fbf 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java @@ -376,6 +376,13 @@ public class TpmPcrEvent { case EvConstants.EV_EFI_HCRTM_EVENT: break; case EvConstants.EV_EFI_SPDM_FIRMWARE_BLOB: + try { + sb.append(new EvEfiSpdmFirmwareBlob(eventContent).toString()); + } catch (UnsupportedEncodingException ueEx) { + log.error(ueEx); + sb.append(ueEx.toString()); + } + break; default: sb.append("Unknown Event found\n"); } @@ -552,7 +559,6 @@ public class TpmPcrEvent { */ private static String eventString(final long event) { - System.out.println("XXXX " + event); if (event == EvConstants.EV_PREBOOT_CERT) { return "EV_PREBOOT_CERT"; } else if (event == EvConstants.EV_POST_CODE) { diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java index 9e3098ab..f7c4d8b6 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java @@ -3,6 +3,8 @@ package hirs.utils.tpm.eventlog.events; import lombok.Getter; +import java.io.UnsupportedEncodingException; + public class DeviceSecurityEventData extends DeviceSecurityEventDataBase { /** @@ -16,7 +18,7 @@ public class DeviceSecurityEventData extends DeviceSecurityEventDataBase { * * @param dSEDbytes byte array holding the DeviceSecurityEventData. */ - public DeviceSecurityEventData(final byte[] dSEDbytes) { + public DeviceSecurityEventData(final byte[] dSEDbytes) throws UnsupportedEncodingException { super(dSEDbytes); dsedHeader = new DeviceSecurityEventDataHeader(dSEDbytes); } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java index 3e7b8a1f..46f3bdba 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java @@ -44,6 +44,10 @@ import java.nio.charset.StandardCharsets; * 2. Digest of 48 bytes * 3. Event content defined as DEVICE_SECURITY_EVENT_DATA Struct. * 4. First 16 bytes of the structure header is an ASCII "SPDM Device Sec" + * <p> + * Only a few of the Device Security Event Data events have been implemented as there are many, + * but only those that were reported using the test devices at hand. + * Without test patterns, the processing may lead to an un-handled exception. */ public abstract class DeviceSecurityEventDataBase { diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java index 5073a1d2..955a353c 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java @@ -6,63 +6,81 @@ import hirs.utils.tpm.eventlog.spdm.SpdmMeasurementBlock; import hirs.utils.tpm.eventlog.uefi.UefiConstants; import lombok.Getter; +import java.io.UnsupportedEncodingException; + + +/** + * Class to process the DEVICE_SECURITY_EVENT_DATA_HEADER. + * DEVICE_SECURITY_EVENT_DATA_HEADER contains the measurement(s) and hash algorithm identifier + * returned by the SPDM "GET_MEASUREMENTS" function. + * + * HEADERS defined by PFP v1.06 Rev 52: + * <p> + * typedef struct tdDEVICE_SECURITY_EVENT_DATA_HEADER { + * UINT8 Signature[16]; + * UINT16 Version; + * UINT16 Length; + * UINT32 SpdmHashAlg; + * UINT32 DeviceType; + * SPDM_MEASUREMENT_BLOCK SpdmMeasurementBlock; + * UINT64 DevicePathLength; + * UNIT8 DevicePath[DevicePathLength] + * } DEVICE_SECURITY_EVENT_DATA_HEADER; + * <p> + * Assumption: there is only 1 SpdmMeasurementBlock per event. Need more test patterns to verify. + */ public class DeviceSecurityEventDataHeader extends DeviceSecurityEventDataHeaderBase { - /** ----------- Variables specific to Header Type 1 ----------- - // /** - // * Type Header 1 event data length. - // */ -// @Getter -// private String h1Length = ""; /** - * Type Header 1 SPDM hash algorithm. + * Event data length. */ @Getter - private String h1SpdmHashAlgo = ""; -// /** -// * Type Header 1 SPDM Measurement Block list. -// */ -// private List<SpdmMeasurementBlock> h1SpdmMeasurementBlockList; + private int length = 0; /** - * Type Header 1 SPDM Measurement Block. + * SPDM hash algorithm. */ - private SpdmMeasurementBlock h1SpdmMeasurementBlock; + @Getter + private int spdmHashAlgo = -1; + /** + * SPDM Measurement Block list. -implement this if there can be multiple SPDM blocks in one event + */ + //private List<SpdmMeasurementBlock> spdmMeasurementBlockList; + /** + * SPDM Measurement Block. + */ + private SpdmMeasurementBlock spdmMeasurementBlock; - public DeviceSecurityEventDataHeader(final byte[] dSEDbytes) { + public DeviceSecurityEventDataHeader(final byte[] dSEDbytes) throws UnsupportedEncodingException { super(dSEDbytes); byte[] lengthBytes = new byte[UefiConstants.SIZE_2]; System.arraycopy(dSEDbytes, 18, lengthBytes, 0, UefiConstants.SIZE_2); - int h1Length = HexUtils.leReverseInt(lengthBytes); + length = HexUtils.leReverseInt(lengthBytes); byte[] spdmHashAlgoBytes = new byte[UefiConstants.SIZE_4]; System.arraycopy(dSEDbytes, UefiConstants.OFFSET_20, spdmHashAlgoBytes, 0, UefiConstants.SIZE_4); - int h1SpdmHashAlgoInt = HexUtils.leReverseInt(spdmHashAlgoBytes); - h1SpdmHashAlgo = SpdmHa.tcgAlgIdToString(h1SpdmHashAlgoInt); + spdmHashAlgo = HexUtils.leReverseInt(spdmHashAlgoBytes); -// byte[] deviceTypeBytes = new byte[UefiConstants.SIZE_4]; -// System.arraycopy(dSEDbytes, UefiConstants.OFFSET_24, deviceTypeBytes, 0, -// UefiConstants.SIZE_4); -// int deviceTypeInt = HexUtils.leReverseInt(deviceTypeBytes); -// deviceType = deviceTypeToString(deviceTypeInt); - - // For each measurement block, create a SpdmMeasurementBlock object (can there be many blocks ?) + extractDeviceType(dSEDbytes, 24); // get the size of the SPDM Measurement Block byte[] sizeOfSpdmMeasBlockBytes = new byte[UefiConstants.SIZE_2]; System.arraycopy(dSEDbytes, 30, sizeOfSpdmMeasBlockBytes, 0, UefiConstants.SIZE_2); int sizeOfSpdmMeas = HexUtils.leReverseInt(sizeOfSpdmMeasBlockBytes); - int sizeOfSpdmMeasBlock = sizeOfSpdmMeas + 4; + int sizeOfSpdmMeasBlock = sizeOfSpdmMeas + 4; // header is 4 bytes // extract the bytes from the SPDM Measurement Block byte[] spdmMeasBlockBytes = new byte[sizeOfSpdmMeasBlock]; System.arraycopy(dSEDbytes, 28, spdmMeasBlockBytes, 0, sizeOfSpdmMeasBlock); - h1SpdmMeasurementBlock = new SpdmMeasurementBlock(spdmMeasBlockBytes); + spdmMeasurementBlock = new SpdmMeasurementBlock(spdmMeasBlockBytes); + + + // (can there be many >1 spdm block per event ?) // byte[] algorithmIDBytes = new byte[UefiConstants.SIZE_2]; // int algLocation = UefiConstants.SIZE_28; @@ -72,11 +90,9 @@ public class DeviceSecurityEventDataHeader extends DeviceSecurityEventDataHeader // String alg = TcgTpmtHa.tcgAlgIdToString(HexUtils.leReverseInt(algorithmIDBytes)); // algList.add(alg); // } -// if ((algList.size() == 1) && (algList.get(0).compareTo("SHA1") == 0)) { -// cryptoAgile = false; -// } else { -// cryptoAgile = true; -// } + + int devPathLenStartByte = 28 + sizeOfSpdmMeasBlock; + extractDevicePath(dSEDbytes, devPathLenStartByte); } @@ -88,8 +104,12 @@ public class DeviceSecurityEventDataHeader extends DeviceSecurityEventDataHeader */ public String toString() { String dsedHeaderInfo = ""; - dsedHeaderInfo += "\n SPDM hash algorithm = " + h1SpdmHashAlgo; - dsedHeaderInfo += "\n SPDM Measurement Block " + h1SpdmMeasurementBlock.toString(); + + dsedHeaderInfo += headerBaseToString(); + String spdmHashAlgoStr = SpdmHa.tcgAlgIdToString(spdmHashAlgo); + dsedHeaderInfo += "\n SPDM Hash Algorithm = " + spdmHashAlgoStr; + dsedHeaderInfo += "\n SPDM Measurement Block:"; + dsedHeaderInfo += spdmMeasurementBlock.toString(); return dsedHeaderInfo; } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java index ee0ee8ba..763a163f 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java @@ -4,70 +4,45 @@ import hirs.utils.HexUtils; import hirs.utils.tpm.eventlog.spdm.SpdmHa; import hirs.utils.tpm.eventlog.spdm.SpdmMeasurementBlock; 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; /** - * Class to process the DEVICE_SECURITY_EVENT_DATA_HEADER or ..HEADER2 per PFP. + * Abstract class to process the DEVICE_SECURITY_EVENT_DATA_HEADER or ..HEADER2 per PFP. * The first 16 bytes of the event data header MUST be a String based identifier (Signature), * NUL-terminated, per PFP. The only currently defined Signature is "SPDM Device Sec", * which implies the data is a DEVICE_SECURITY_EVENT_DATA or ..DATA2. - * DEVICE_SECURITY_EVENT_DATA_HEADER contains the measurement(s) and hash algorithm identifier - * returned by the SPDM "GET_MEASUREMENTS" function. * - * HEADERS defined by PFP v1.06 Rev 52: + * HEADERS defined by PFP v1.06 Rev 52. + * The ** indicates fields that are common to both ..HEADER and ..HEADER2. * <p> * typedef struct tdDEVICE_SECURITY_EVENT_DATA_HEADER { - * UINT8 Signature[16]; - * UINT16 Version; + * UINT8 ** Signature[16]; + * UINT16 ** Version; * UINT16 Length; * UINT32 SpdmHashAlg; - * UINT32 DeviceType; + * UINT32 ** DeviceType; * SPDM_MEASUREMENT_BLOCK SpdmMeasurementBlock; - * UINT64 DevicePathLength; - * UNIT8 DevicePath[DevicePathLength] + * UINT64 ** DevicePathLength; + * UNIT8 ** DevicePath[DevicePathLength] * } DEVICE_SECURITY_EVENT_DATA_HEADER; * <p> * typedef struct tdDEVICE_SECURITY_EVENT_DATA_HEADER2 { - NOT IMPLEMENTED YET - * UINT8 Signature[16]; - * UINT16 Version; + * UINT8 ** Signature[16]; + * UINT16 ** Version; * UINT8 AuthState; * UINT8 Reserved; * UINT32 Length; - * UINT32 DeviceType; + * UINT32 ** DeviceType; * UINT32 SubHeaderType; * UINT32 SubHeaderLength; * UINT32 SubHeaderUID; - * UINT64 DevicePathLength; - * UNIT8 DevicePath[DevicePathLength] + * UINT64 ** DevicePathLength; + * UNIT8 ** DevicePath[DevicePathLength] * } DEVICE_SECURITY_EVENT_DATA_HEADER2; - * - * SPDM_MEASUREMENT_BLOCK and contents defined by SPDM v1.03, Sect 10.11.1, Table 53 and 54: - * <p> - * Measurement block format { - * Index 1 byte; - * MeasurementSpec 1 byte; - * MeasurementSize 2 bytes; - * Measurement <MeasurementSize> bytes; - * } - * <p> - * DMTF measurement spec format { - * DMTFSpecMeasurementValueType 1 byte; - * DMTFSpecMeasurementValueSize 2 bytes; - * DMTFSpecMeasurementValue <DMTFSpecMeasurementValueSize> bytes; - * } - * <p> - * DMTFSpecMeasurementValueType[7] - * Indicates how bits [0:6] are represented - * Bit = 0: Digest - * Bit = 1: Raw bit stream - * DMTFSpecMeasurementValueType[6:0] - * Immutable ROM 0x0 - * Mutable firmware 0x1 - * Hardware configuration 0x2 - * Firmware configuration 0x3 - * etc. * <p> */ public abstract class DeviceSecurityEventDataHeaderBase { @@ -98,22 +73,21 @@ public abstract class DeviceSecurityEventDataHeaderBase { * Device type. */ @Getter - private int deviceTypeId = -1; -// /** -// * Device type. -// */ -// @Getter -// private String deviceType = ""; + private int deviceType = -1; /** - * Device path length. + * UEFI Device Path Length. */ @Getter - private String devicePathLength = ""; + private int devicePathLength = 0; /** - * Device path. + * UEFI Device path. */ @Getter - private String devicePath = ""; + private UefiDevicePath devicePath = null; + /** + * Is the Device Path Valid. + */ + private boolean devicePathValid = false; /** * Device Security Event Data Device Type = no device type. @@ -155,32 +129,33 @@ public abstract class DeviceSecurityEventDataHeaderBase { } - public void extractDeviceTypeId(final byte[] dSEDbytes, int startByte) { + public void extractDeviceType(final byte[] dSEDbytes, int startByte) { // get the device type ID byte[] deviceTypeBytes = new byte[UefiConstants.SIZE_4]; System.arraycopy(dSEDbytes, startByte, deviceTypeBytes, 0, UefiConstants.SIZE_4); - deviceTypeId = HexUtils.leReverseInt(deviceTypeBytes); + deviceType = HexUtils.leReverseInt(deviceTypeBytes); } - public void extractDevicePathString(final byte[] dSEDbytes, int startByte) { + public void extractDevicePath(final byte[] dSEDbytes, int startByte) + throws UnsupportedEncodingException { // get the device path length byte[] devicePathLengthBytes = new byte[UefiConstants.SIZE_8]; System.arraycopy(dSEDbytes, startByte, devicePathLengthBytes, 0, UefiConstants.SIZE_8); - int deviceTypeLength = HexUtils.leReverseInt(devicePathLengthBytes); - - // TODO: how to interpret this?? i'ts not ascii + int devicePathLength = HexUtils.leReverseInt(devicePathLengthBytes); // get the device path - startByte = startByte + UefiConstants.SIZE_8; - byte[] devicePathBytes = new byte[UefiConstants.SIZE_16]; - System.arraycopy(dSEDbytes, startByte, devicePathBytes, 0, - deviceTypeLength); - - // TODO: store device path length + if (devicePathLength != 0) { + startByte = startByte + UefiConstants.SIZE_8; + byte[] devPathBytes = new byte[devicePathLength]; + System.arraycopy(dSEDbytes, startByte, devPathBytes, + 0, devicePathLength); + devicePath = new UefiDevicePath(devPathBytes); + devicePathValid = true; + } } /** @@ -213,22 +188,18 @@ public abstract class DeviceSecurityEventDataHeaderBase { * * @return a description of this event.. */ - public String toString() { + public String headerBaseToString() { String dsedHeaderInfo = ""; - dsedHeaderInfo += "\n SPDM Device"; - dsedHeaderInfo += "\n Device Type: " + deviceTypeToString(deviceTypeId); - dsedHeaderInfo += "\n Device Path: " + devicePath; + dsedHeaderInfo += "\n SPDM Device Type = " + deviceTypeToString(deviceType); + if (devicePathValid) { + dsedHeaderInfo += "\n SPDM Device Path =\n"; + dsedHeaderInfo += devicePath; + } + else { + dsedHeaderInfo += "\n SPDM Device Path = Uknown or invalid"; + } -// if (version.equals("0100")) { -// dsedHeaderInfo += "\n SPDM hash algorithm = " + h1SpdmHashAlgo; -// dsedHeaderInfo += "\n SPDM Device"; -// dsedHeaderInfo += "\n Device Type: " + deviceType; -// dsedHeaderInfo += "\n Device Path: " + devicePath; -// dsedHeaderInfo += "\n SPDM Measurement Block " + h1SpdmMeasurementBlock.toString(); -// } else if(version.equals("0200")) { -// dsedHeaderInfo = "tbd"; -// } return dsedHeaderInfo; } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmHa.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmHa.java index ce6a2fb1..3195896f 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmHa.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmHa.java @@ -5,8 +5,7 @@ import lombok.AccessLevel; import lombok.NoArgsConstructor; /** - * Class for defining constants referenced in the DMTF - * SPDM specification. + * Class for defining constants referenced in the DMTF SPDM specification. */ @NoArgsConstructor(access = AccessLevel.PRIVATE) public class SpdmHa { diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurement.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurement.java index 4dd82a4e..1555d4aa 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurement.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurement.java @@ -1,13 +1,116 @@ package hirs.utils.tpm.eventlog.spdm; +import hirs.utils.HexUtils; +import lombok.AccessLevel; +import lombok.Getter; + +/** + * Class to process the SpdmMeasurement. + * <p> + * Measurement, defined by SPDM v1.03, Sect 10.11.1, Table 54: + * DMTF measurement spec format { + * DMTFSpecMeasurementValueType 1 byte; + * DMTFSpecMeasurementValueSize 2 bytes; + * DMTFSpecMeasurementValue <DMTFSpecMeasurementValueSize> bytes; + * } + * <p> + * DMTFSpecMeasurementValueType[7] + * Indicates how bits [0:6] are represented + * Bit = 0: Digest + * Bit = 1: Raw bit stream + * DMTFSpecMeasurementValueType[6:0] (see SPDM Spec, Table 55 "DMTFSpecMeasurementValueType[6:0]") + * Immutable ROM 0x0 + * Mutable firmware 0x1 + * Hardware configuration 0x2 + * Firmware configuration 0x3 + * etc. + * <p> + */ public class SpdmMeasurement { + /** + * Measurement value type (such as mutable firmware, etc). + */ + @Getter + private int dmtfSpecMeasurementValueType = 0; + /** + * Measurement value (digest). + */ + @Getter + private byte[] dmtfSpecMeasurementValue = null; + + @Getter(value = AccessLevel.PROTECTED) + private byte[] digest = null; + public SpdmMeasurement(final byte[] spdmMeasBytes) { + byte[] dmtfSpecMeasurementValueTypeBytes = new byte[1]; + System.arraycopy(spdmMeasBytes, 0, dmtfSpecMeasurementValueTypeBytes, 0, + 1); + dmtfSpecMeasurementValueType = HexUtils.leReverseInt(dmtfSpecMeasurementValueTypeBytes); + + // in future, can crosscheck this value size + 3 with the spdm block MeasurementSize size + byte[] dmtfSpecMeasurementValueSizeBytes = new byte[2]; + System.arraycopy(spdmMeasBytes, 1, dmtfSpecMeasurementValueSizeBytes, 0, + 2); + int dmtfSpecMeasurementValueSize = HexUtils.leReverseInt(dmtfSpecMeasurementValueSizeBytes); + + dmtfSpecMeasurementValue = new byte[dmtfSpecMeasurementValueSize]; + System.arraycopy(spdmMeasBytes, 3, dmtfSpecMeasurementValue, 0, + dmtfSpecMeasurementValueSize); } + public String dmtfSpecMeasurementValueTypeToString(final int measValType) { + + String measValTypeStr; + switch (measValType) { + case 0: + measValTypeStr = "Immutable ROM"; + break; + case 1: + measValTypeStr = "Mutable firmware"; + break; + case 2: + measValTypeStr = "Hardware configuration"; + break; + case 3: + measValTypeStr = "Firmware configuration"; + break; + case 4: + measValTypeStr = "Freeform measurement manifest"; + break; + case 5: + measValTypeStr = "Structured representation of debug and device mode"; + break; + case 6: + measValTypeStr = "Mutable firmware's version number"; + break; + case 7: + measValTypeStr = "Mutable firmware's security verison number"; + break; + case 8: + measValTypeStr = "Hash-extended measurement"; + break; + case 9: + measValTypeStr = "Informational"; + break; + case 10: + measValTypeStr = "Structured measurement manifest"; + break; + default: + measValTypeStr = "Unknown or invalid DMTF Spec Measurement Value Type"; + } + return measValTypeStr; + } public String toString() { - return "TEMP TEST SpdmMeasurement"; + String spdmMeasInfo = ""; + + spdmMeasInfo += "\n SPDM Measurement Value Type = " + + dmtfSpecMeasurementValueTypeToString(dmtfSpecMeasurementValueType); + spdmMeasInfo += "\n SPDM Measurement Value = " + + HexUtils.byteArrayToHexString(dmtfSpecMeasurementValue); + + return spdmMeasInfo; } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurementBlock.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurementBlock.java index af8c95a4..ff2ac9ea 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurementBlock.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurementBlock.java @@ -1,32 +1,76 @@ package hirs.utils.tpm.eventlog.spdm; +import hirs.utils.HexUtils; +import hirs.utils.tpm.eventlog.uefi.UefiConstants; import lombok.Getter; +/** + * Class to process the SpdmMeasurementBlock. + * <p> + * Measurement block format, defined by SPDM v1.03, Sect 10.11.1, Table 53: + * Measurement block format { + * Index 1 byte; + * MeasurementSpec 1 byte; + * MeasurementSize 2 bytes; + * Measurement <MeasurementSize> bytes; + * } + * <p> + * Index: index of the measurement block, as there can be more than one + * MeasurementSpec: bit mask; the measurement specification that the requested Measurement follows + * See "MeasurementSpecificationSel" in Table 21. See Tables 29, 53, 54 + * Bit 0: DMTFmeasSpec, per Table 54 + * Bit 1-7: Reserved + * Measurement: the digest + */ public class SpdmMeasurementBlock { + /** + * Measurement block index, as an SPDM measurement exchange can contain several measurements. + */ + @Getter + private int index = 0; /** * Measurement Spec. */ @Getter - private String measurementSpec = ""; + private int measurementSpec = 0; /** - * Measurement value type (such as mutable firmware, etc). + * SPDM Measurement. */ - @Getter - private String dmtfSpecMeasurementValueType = ""; - /** - * Measurement value (digest). - */ - @Getter - private String dmtfSpecMeasurementValue = ""; + private SpdmMeasurement spdmMeasurement; public SpdmMeasurementBlock(final byte[] spdmMeasBlockBytes) { + byte[] indexBytes = new byte[1]; + System.arraycopy(spdmMeasBlockBytes, 0, indexBytes, 0, + 1); + index = HexUtils.leReverseInt(indexBytes); + byte[] measurementSpecBytes = new byte[1]; + System.arraycopy(spdmMeasBlockBytes, 1, measurementSpecBytes, 0, + 1); + measurementSpec = HexUtils.leReverseInt(measurementSpecBytes); + + // in future, can crosscheck this measurement size with the MeasurementSpec hash alg size + byte[] measurementSizeBytes = new byte[2]; + System.arraycopy(spdmMeasBlockBytes, 2, measurementSizeBytes, 0, + 2); + int measurementSize = HexUtils.leReverseInt(measurementSizeBytes); + + byte[] measurementBytes = new byte[measurementSize]; + System.arraycopy(spdmMeasBlockBytes, 4, measurementBytes, 0, + measurementSize); + spdmMeasurement = new SpdmMeasurement(measurementBytes); } public String toString() { - return "TEMP TEST spdmMeasBlockBytes"; + String spdmMeasBlockInfo = ""; + + spdmMeasBlockInfo += "\n Index = " + index; + spdmMeasBlockInfo += "\n MeasurementSpec = " + measurementSpec; + spdmMeasBlockInfo += spdmMeasurement.toString(); + + return spdmMeasBlockInfo; } } From 8558546ff56e87124d9bac4f094040b074e543d8 Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Mon, 22 Apr 2024 19:09:01 -0400 Subject: [PATCH 20/31] spdm processing - added Device Security Event Data Pci Context --- .../events/DeviceSecurityEventData.java | 9 +- .../events/DeviceSecurityEventDataBase.java | 111 +++--------------- .../DeviceSecurityEventDataDeviceContext.java | 48 ++++---- .../events/DeviceSecurityEventDataHeader.java | 13 +- .../DeviceSecurityEventDataHeaderBase.java | 13 +- .../DeviceSecurityEventDataPciContext.java | 111 ++++++++++++++++++ .../events/EvEfiSpdmFirmwareBlob.java | 3 - 7 files changed, 176 insertions(+), 132 deletions(-) create mode 100644 HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataPciContext.java diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java index f7c4d8b6..68f55960 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java @@ -19,14 +19,19 @@ public class DeviceSecurityEventData extends DeviceSecurityEventDataBase { * @param dSEDbytes byte array holding the DeviceSecurityEventData. */ public DeviceSecurityEventData(final byte[] dSEDbytes) throws UnsupportedEncodingException { - super(dSEDbytes); dsedHeader = new DeviceSecurityEventDataHeader(dSEDbytes); + extractDeviceContext(dSEDbytes, dsedHeader.getDSEDheaderByteSize()); } + /** + * Returns a human readable description of the data within this structure. + * + * @return a description of this structure. + */ public String toString() { String dsedInfo = ""; dsedInfo += dsedHeader.toString(); -// dsedInfo += dsedDeviceContext.toString(); + dsedInfo += getDsedDeviceContext().toString(); return dsedInfo; } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java index 46f3bdba..1481d6aa 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java @@ -8,7 +8,8 @@ import java.nio.charset.StandardCharsets; /** - * Abstract base class to process the DEVICE_SECURITY_EVENT_DATA or ..DATA2 event per PFP. + * Abstract base class to process the DEVICE_SECURITY_EVENT_DATA or ..DATA2 event. + * Parses event data for DEVICE_SECURITY_EVENT_DATA per PFP v1.06 Rev52 Table 20. * The event data comes in 2 forms: * 1) DEVICE_SECURITY_EVENT_DATA or * 2) DEVICE_SECURITY_EVENT_DATA2 @@ -39,118 +40,44 @@ import java.nio.charset.StandardCharsets; * ... ... * } * <p> - * Notes: Parses event data for an DEVICE_SECURITY_EVENT_DATA per PFP v1.06 Rev52 Table 20. + * Notes: * 1. Has an EventType of EV_EFI_SPDM_FIRMWARE_BLOB (0x800000E1) - * 2. Digest of 48 bytes - * 3. Event content defined as DEVICE_SECURITY_EVENT_DATA Struct. - * 4. First 16 bytes of the structure header is an ASCII "SPDM Device Sec" + * 2. Event content defined as DEVICE_SECURITY_EVENT_DATA Struct. + * 3. First 16 bytes of the structure header is an ASCII "SPDM Device Sec" * <p> * Only a few of the Device Security Event Data events have been implemented as there are many, * but only those that were reported using the test devices at hand. * Without test patterns, the processing may lead to an un-handled exception. + * For now, the only test pattern uses ..DeviceContext with PCI only, without USB -> assume only 1 + * even though the spec says both are in the data structure. If it is only 1, though, there's no + * method to tell them apart. */ public abstract class DeviceSecurityEventDataBase { -// /** -// * Signature (text) data. -// */ -// @Getter -// private String signature = ""; -// /** -// * Version determines data structure used (..DATA or ..DATA2). -// */ -// @Getter -// private String version = ""; -// /** -// * Contains the human-readable info inside the Device Security Event. -// */ -// @Getter -// private String dsedInfo = ""; -// /** -// * DeviceSecurityEventDataHeader Object. -// */ -// @Getter -// private DeviceSecurityEventDataHeader dsedHeader = null; /** * DeviceSecurityEventDataDeviceContext Object. */ @Getter private DeviceSecurityEventDataDeviceContext dsedDeviceContext = null; + /** + * DeviceSecurityEventData Default Constructor. + * + */ public DeviceSecurityEventDataBase() { } - /** - * DeviceSecurityEventData Constructor. - * - * @param dSEDbytes byte array holding the DeviceSecurityEventData. - */ - public DeviceSecurityEventDataBase(final byte[] dSEDbytes) { + public void extractDeviceContext(final byte[] dSEDbytes, int startByte) { -// byte[] signatureBytes = new byte[UefiConstants.SIZE_16]; -// System.arraycopy(dSEDbytes, 0, signatureBytes, 0, UefiConstants.SIZE_16); -// //signature = HexUtils.byteArrayToHexString(signatureBytes); -// signature = new String(signatureBytes, StandardCharsets.UTF_8) -// .substring(0, UefiConstants.SIZE_15); // size 15 bc last letter is a 00 (null) -// -// byte[] versionBytes = new byte[UefiConstants.SIZE_2]; -// System.arraycopy(dSEDbytes, UefiConstants.OFFSET_16, versionBytes, 0, -// UefiConstants.SIZE_2); -// version = HexUtils.byteArrayToHexString(versionBytes); + int deviceContextLength = dSEDbytes.length - startByte; -// int byteOffset = 0; -// byteOffset = dsedHeader.getDsedHeaderByteSize(); + // get the device type ID + byte[] deviceContextBytes = new byte[deviceContextLength]; + System.arraycopy(dSEDbytes, startByte, deviceContextBytes, 0, + deviceContextLength); + dsedDeviceContext = new DeviceSecurityEventDataDeviceContext(deviceContextBytes); - // If version is 0x01, the event is a DEVICE_SECURITY_EVENT_DATA - // If version is 0x02, the event is a DEVICE_SECURITY_EVENT_DATA2 -// switch (version) { -// case "0100": -// dsedHeader = new DeviceSecurityEventDataHeader(dSEDbytes); -//// dsedDeviceContext = new DeviceSecurityEventDataDeviceContext(dSEDbytes, -//// dsedHeader.getDSEDheaderByteSize()); -// break; -// case "0200": -// dsedHeader = new DeviceSecurityEventDataHeader(dSEDbytes); -//// dsedSubHeader = new DeviceSecurityEventDataSubHeader(dSEDbytes,byteOffset); -//// byteOffset = dsedHeader.getDSEDsubHeaderByteSize(); -//// dsedDeviceContext = new DeviceSecurityEventDataDeviceContext(dSEDbytes, byteOffset); -// break; -// default: -// break; - - -// if (version == "1") { -// dSEDinfo =+ -// dSEDataHeader.getDSEDheaderInfo(); -// dSEDinfo =+ -// dsedDeviceContext.getdSEDdeviceContextInfo(); -// } else if (version == "2") { -// dSEDinfo =+ -// dSEDheader.getDSEDheaderInfo(); -// dSEDinfo =+ -// dsedSubHeader.getDSEDsubHeaderInfo(); -// dSEDinfo =+ -// dsedDeviceContext.getDSEDdeviceContextInfo(); -// } -// } } - public String toString() { - String dsedInfo = ""; -// switch (version) { -// case "0100": -// dsedInfo += dsedHeader.toString(); -//// dsedInfo += dsedDeviceContext.toString(); -// break; -// case "0200": -//// dsedInfo += dsedHeader.toString(); -//// dsedInfo += dsedSubHeader.toString(); -//// dsedInfo += dsedDeviceContext.toString(); -// break; -// default: -// dsedInfo += " Unknown SPDM Device Security Event Data version " + version + " found" + "\n"; -// } - return dsedInfo; - } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java index 34bdd300..81d6c6bb 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java @@ -1,6 +1,7 @@ package hirs.utils.tpm.eventlog.events; import hirs.utils.HexUtils; +import hirs.utils.tpm.eventlog.spdm.SpdmMeasurementBlock; import hirs.utils.tpm.eventlog.uefi.UefiConstants; import lombok.Getter; @@ -21,42 +22,39 @@ import java.nio.charset.StandardCharsets; public class DeviceSecurityEventDataDeviceContext { /** - * Contains the human-readable info inside the Device Security Event Data Device Context structure. + * SPDM Measurement Block. */ - @Getter - private String dSEDdeviceContextInfo = ""; - /** - * PCI Version. - */ - @Getter - private String pciVersion = ""; - /** - * PCI Length. - */ - @Getter - private String pciLength = ""; + private DeviceSecurityEventDataPciContext deviceSecurityEventDataPciContext = null; /** * DeviceSecurityEventDataDeviceContext Constructor. * - * @param dSEDbytes byte array holding the DeviceSecurityEventData. + * @param dSEDdeviceContextBytes byte array holding the DeviceSecurityEventData. */ - public DeviceSecurityEventDataDeviceContext(final byte[] dSEDbytes, int byteStartOffset) { + public DeviceSecurityEventDataDeviceContext(final byte[] dSEDdeviceContextBytes) { - int byteOffset = byteStartOffset; + byte[] dSEDpciContextLengthBytes = new byte[2]; + System.arraycopy(dSEDdeviceContextBytes, 2, dSEDpciContextLengthBytes, 0, 2); + int dSEDpciContextLength = HexUtils.leReverseInt(dSEDpciContextLengthBytes); - byte[] pciVersionBytes = new byte[UefiConstants.SIZE_16]; - System.arraycopy(dSEDbytes, byteOffset, pciVersionBytes, 0, UefiConstants.SIZE_16); - pciVersion = new String(pciVersionBytes, StandardCharsets.UTF_8) - .substring(0, UefiConstants.SIZE_15); + byte[] dSEDpciContextBytes = new byte[dSEDpciContextLength]; + System.arraycopy(dSEDdeviceContextBytes, 0, dSEDpciContextBytes, 0, dSEDpciContextLength); + deviceSecurityEventDataPciContext = new DeviceSecurityEventDataPciContext(dSEDpciContextBytes); - byteOffset += UefiConstants.SIZE_16; - byte[] pciLengthBytes = new byte[UefiConstants.SIZE_4]; - System.arraycopy(dSEDbytes, byteOffset, pciLengthBytes, 0, - UefiConstants.SIZE_16); - pciLength = HexUtils.byteArrayToHexString(pciLengthBytes); + //TODO add USB context + } + /** + * Returns a human readable description of the data within this structure. + * + * @return a description of this structure.. + */ + public String toString() { + String dSEDdeviceContextInfo = ""; + dSEDdeviceContextInfo += deviceSecurityEventDataPciContext.toString(); + + return dSEDdeviceContextInfo; } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java index 955a353c..c8a9ecf7 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java @@ -48,8 +48,13 @@ public class DeviceSecurityEventDataHeader extends DeviceSecurityEventDataHeader /** * SPDM Measurement Block. */ - private SpdmMeasurementBlock spdmMeasurementBlock; + private SpdmMeasurementBlock spdmMeasurementBlock = null; + /** + * DeviceSecurityEventDataHeader Constructor. + * + * @param dSEDbytes byte array holding the DeviceSecurityEventData. + */ public DeviceSecurityEventDataHeader(final byte[] dSEDbytes) throws UnsupportedEncodingException { super(dSEDbytes); @@ -92,15 +97,15 @@ public class DeviceSecurityEventDataHeader extends DeviceSecurityEventDataHeader // } int devPathLenStartByte = 28 + sizeOfSpdmMeasBlock; - extractDevicePath(dSEDbytes, devPathLenStartByte); + extractDevicePathAndFinalSize(dSEDbytes, devPathLenStartByte); } /** - * Returns a human readable description of the data within this event. + * Returns a human readable description of the data within this structure. * - * @return a description of this event.. + * @return a description of this structure. */ public String toString() { String dsedHeaderInfo = ""; diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java index 763a163f..3dfe8c42 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java @@ -107,9 +107,8 @@ public abstract class DeviceSecurityEventDataHeaderBase { } - /** - * DeviceSecurityEventDataHeader Constructor. + * DeviceSecurityEventDataHeaderBase Constructor. * * @param dSEDbytes byte array holding the DeviceSecurityEventData. */ @@ -138,7 +137,7 @@ public abstract class DeviceSecurityEventDataHeaderBase { deviceType = HexUtils.leReverseInt(deviceTypeBytes); } - public void extractDevicePath(final byte[] dSEDbytes, int startByte) + public void extractDevicePathAndFinalSize(final byte[] dSEDbytes, int startByte) throws UnsupportedEncodingException { // get the device path length @@ -156,6 +155,8 @@ public abstract class DeviceSecurityEventDataHeaderBase { devicePath = new UefiDevicePath(devPathBytes); devicePathValid = true; } + + dSEDheaderByteSize = startByte + devicePathLength; } /** @@ -184,9 +185,9 @@ public abstract class DeviceSecurityEventDataHeaderBase { } /** - * Returns a human readable description of the data within this event. + * Returns a human readable description of the data within this structure. * - * @return a description of this event.. + * @return a description of this structure. */ public String headerBaseToString() { String dsedHeaderInfo = ""; @@ -197,7 +198,7 @@ public abstract class DeviceSecurityEventDataHeaderBase { dsedHeaderInfo += devicePath; } else { - dsedHeaderInfo += "\n SPDM Device Path = Uknown or invalid"; + dsedHeaderInfo += "\n SPDM Device Path = Unknown or invalid"; } return dsedHeaderInfo; 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 new file mode 100644 index 00000000..e312b7a3 --- /dev/null +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataPciContext.java @@ -0,0 +1,111 @@ +package hirs.utils.tpm.eventlog.events; + +import hirs.utils.HexUtils; +import hirs.utils.tpm.eventlog.spdm.SpdmHa; +import lombok.Getter; + +public class DeviceSecurityEventDataPciContext { + + /** + * PCI Version. + */ + @Getter + private int pciVersion = 0; + /** + * PCI Length. + */ + @Getter + private int pciLength = 0; + /** + * PCI Vendor ID. + */ + @Getter + private int pciVendorId = 0; + /** + * PCI Device ID. + */ + @Getter + private int pciDeviceId = 0; + /** + * PCI Revision ID. + */ + @Getter + private int pciRevisionId = 0; + /** + * PCI Class Code. + */ + @Getter + private int pciClassCode = 0; + /** + * PCI Subsystem Vendor ID. + */ + @Getter + private int pciSubsystemVendorId = 0; + /** + * PCI Subsystem ID. + */ + @Getter + private int pciSubsystemId = 0; + + /** + * DeviceSecurityEventDataPciContext Constructor. + * + * @param dSEDpciContextBytes byte array holding the DeviceSecurityEventDataPciContext. + */ + public DeviceSecurityEventDataPciContext(final byte[] dSEDpciContextBytes) { + + byte[] pciVersionBytes = new byte[2]; + System.arraycopy(dSEDpciContextBytes, 0, pciVersionBytes, 0, 2); + pciVersion = HexUtils.leReverseInt(pciVersionBytes); + + byte[] pciLengthBytes = new byte[2]; + System.arraycopy(dSEDpciContextBytes, 2, pciLengthBytes, 0, 2); + pciLength = HexUtils.leReverseInt(pciLengthBytes); + + byte[] pciVendorIdBytes = new byte[2]; + System.arraycopy(dSEDpciContextBytes, 4, pciVendorIdBytes, 0, 2); + pciVendorId = HexUtils.leReverseInt(pciVendorIdBytes); + + byte[] pciDeviceIdBytes = new byte[2]; + System.arraycopy(dSEDpciContextBytes, 6, pciDeviceIdBytes, 0, 2); + pciDeviceId = HexUtils.leReverseInt(pciDeviceIdBytes); + + byte[] pciRevisionIdBytes = new byte[1]; + System.arraycopy(dSEDpciContextBytes, 8, pciRevisionIdBytes, 0, 1); + pciRevisionId = HexUtils.leReverseInt(pciRevisionIdBytes); + + byte[] pciClassCodeBytes = new byte[3]; + System.arraycopy(dSEDpciContextBytes, 9, pciClassCodeBytes, 0, 3); + pciClassCode = HexUtils.leReverseInt(pciClassCodeBytes); + + byte[] pciSubsystemVendorIdBytes = new byte[2]; + System.arraycopy(dSEDpciContextBytes, 12, pciSubsystemVendorIdBytes, 0, 2); + pciSubsystemVendorId = HexUtils.leReverseInt(pciSubsystemVendorIdBytes); + + byte[] pciSubsystemIdBytes = new byte[2]; + System.arraycopy(dSEDpciContextBytes, 14, pciSubsystemIdBytes, 0, 2); + pciSubsystemId = HexUtils.leReverseInt(pciSubsystemIdBytes); + + } + + /** + * Returns a human readable description of the data within this structure. + * + * @return a description of this structure.. + */ + public String toString() { + String dSEDpciContextInfo = ""; + + dSEDpciContextInfo += "\n DeviceSecurityEventData - PCI Context"; + dSEDpciContextInfo += "\n Version = " + pciVersion; + dSEDpciContextInfo += "\n Length = " + pciLength; + dSEDpciContextInfo += "\n VendorID = " + pciVendorId; + dSEDpciContextInfo += "\n DeviceID = " + pciDeviceId; + dSEDpciContextInfo += "\n RevisionID = " + pciRevisionId; + dSEDpciContextInfo += "\n ClassCode = " + pciClassCode; + dSEDpciContextInfo += "\n SubsystemVendorID = " + pciSubsystemVendorId; + dSEDpciContextInfo += "\n SubsystemID = " + pciSubsystemId; + + return dSEDpciContextInfo; + } +} diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java index 17f46239..f0eb9e4c 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java @@ -97,11 +97,8 @@ public class EvEfiSpdmFirmwareBlob { * @return Human readable description of this event. */ public String toString() { -// String spdmInfo = ""; if (bDeviceSecurityEventData) { spdmInfo = " Signature = SPDM Device Sec" + spdmInfo; -// spdmInfo += " Signature = SPDM Device Sec"; -// spdmInfo += deviceSecurityEventData.toString(); } else { spdmInfo = "EV_EFI_SPDM_FIRMWARE_BLOB event named " + signature + " encountered but support for processing it has not been added to this application.\n"; From d6a255012a094d60d1cfbc35796ca28662aad1c0 Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Tue, 23 Apr 2024 17:08:10 -0400 Subject: [PATCH 21/31] temporarily add test vendorid/deviceid --- .../DeviceSecurityEventDataDeviceContext.java | 2 +- .../DeviceSecurityEventDataPciContext.java | 156 ++++++++++++++++-- 2 files changed, 139 insertions(+), 19 deletions(-) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java index 81d6c6bb..4d8c5d0b 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java @@ -16,7 +16,7 @@ import java.nio.charset.StandardCharsets; * typedef struct tdDEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT { * DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT PciContext; * DEVICE_SECURITY_EVENT_DATA_USB_CONTEXT UsbContext; - * } tdDEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT; + * } DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT; * <p> */ public class DeviceSecurityEventDataDeviceContext { 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 e312b7a3..2140b7bf 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 @@ -1,9 +1,51 @@ package hirs.utils.tpm.eventlog.events; +//import hirs.attestationca.persist.util.PciIds; +import com.google.common.base.Strings; import hirs.utils.HexUtils; import hirs.utils.tpm.eventlog.spdm.SpdmHa; import lombok.Getter; + +import com.github.marandus.pciid.model.Device; +import com.github.marandus.pciid.model.Vendor; +import com.github.marandus.pciid.service.PciIdsDatabase; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * Class to process the DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT event per PFP. + * <p> + * typedef struct tdDEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT { + * UINT16 Version; + * UINT16 Length; + * UINT16 VendorId; + * UINT16 DeviceId; + * UINT16 RevisionId; + * UINT16 ClassCode[3]; + * UINT16 SubsystemVendorId; + * UINT16 SubsystemId; + * <p> + * The following fields are defined by the PCI Express Base Specification rev4.0 v1.0. + * VendorId + * DeviceId + * RevisionId + * ClassCode + * SubsystemVendorId + * SubsystemId + * Vendor id and device id are registered to specific manufacturers. + * https://admin.pci-ids.ucw.cz/read/PC/ + * Ex. vendor id 8086 and device id 0b60: https://admin.pci-ids.ucw.cz/read/PC/8086/0b60 + * Class code can be looked up on the web. + * https://admin.pci-ids.ucw.cz/read/PD/ + * The revision ID is controlled by the vendor and cannot be looked up. + */ public class DeviceSecurityEventDataPciContext { /** @@ -20,32 +62,76 @@ public class DeviceSecurityEventDataPciContext { * PCI Vendor ID. */ @Getter - private int pciVendorId = 0; + private String pciVendorId = ""; /** * PCI Device ID. */ @Getter - private int pciDeviceId = 0; + private String pciDeviceId = ""; /** * PCI Revision ID. */ @Getter - private int pciRevisionId = 0; + private String pciRevisionId = ""; /** * PCI Class Code. */ @Getter - private int pciClassCode = 0; + private String pciClassCode = ""; /** * PCI Subsystem Vendor ID. */ @Getter - private int pciSubsystemVendorId = 0; + private String pciSubsystemVendorId = ""; /** * PCI Subsystem ID. */ @Getter - private int pciSubsystemId = 0; + private String pciSubsystemId = ""; + + + // TODO REMOVE + public static final List<String> PCI_IDS_PATH = + Collections.unmodifiableList(new ArrayList<>() { + private static final long serialVersionUID = 1L; + { + add("/usr/share/hwdata/pci.ids"); + add("/usr/share/misc/pci.ids"); + add("/tmp/pci.ids"); + } + }); + public static final PciIdsDatabase DB = new PciIdsDatabase(); + static { + if (!DB.isReady()) { + String dbFile = null; + for (final String path : PCI_IDS_PATH) { + if ((new File(path)).exists()) { +// log.info("PCI IDs file was found {}", path); + dbFile = path; + break; + } + } + if (dbFile != null) { + InputStream is = null; + try { + is = new FileInputStream(new File(dbFile)); + DB.loadStream(is); + } catch (IOException e) { + // DB will not be ready, hardware IDs will not be translated + dbFile = null; + } finally { + if (is != null) { + try { + is.close(); + } catch (IOException e) { + dbFile = null; + } + } + } + } + } + } + /** * DeviceSecurityEventDataPciContext Constructor. @@ -64,30 +150,58 @@ public class DeviceSecurityEventDataPciContext { byte[] pciVendorIdBytes = new byte[2]; System.arraycopy(dSEDpciContextBytes, 4, pciVendorIdBytes, 0, 2); - pciVendorId = HexUtils.leReverseInt(pciVendorIdBytes); + pciVendorId = HexUtils.byteArrayToHexString(HexUtils.leReverseByte(pciVendorIdBytes)); byte[] pciDeviceIdBytes = new byte[2]; System.arraycopy(dSEDpciContextBytes, 6, pciDeviceIdBytes, 0, 2); - pciDeviceId = HexUtils.leReverseInt(pciDeviceIdBytes); + pciDeviceId = HexUtils.byteArrayToHexString(HexUtils.leReverseByte(pciDeviceIdBytes)); byte[] pciRevisionIdBytes = new byte[1]; System.arraycopy(dSEDpciContextBytes, 8, pciRevisionIdBytes, 0, 1); - pciRevisionId = HexUtils.leReverseInt(pciRevisionIdBytes); + pciRevisionId = HexUtils.byteArrayToHexString(HexUtils.leReverseByte(pciRevisionIdBytes)); byte[] pciClassCodeBytes = new byte[3]; System.arraycopy(dSEDpciContextBytes, 9, pciClassCodeBytes, 0, 3); - pciClassCode = HexUtils.leReverseInt(pciClassCodeBytes); + pciClassCode = HexUtils.byteArrayToHexString(HexUtils.leReverseByte(pciClassCodeBytes)); byte[] pciSubsystemVendorIdBytes = new byte[2]; System.arraycopy(dSEDpciContextBytes, 12, pciSubsystemVendorIdBytes, 0, 2); - pciSubsystemVendorId = HexUtils.leReverseInt(pciSubsystemVendorIdBytes); + pciSubsystemVendorId = HexUtils.byteArrayToHexString(HexUtils.leReverseByte(pciSubsystemVendorIdBytes)); byte[] pciSubsystemIdBytes = new byte[2]; System.arraycopy(dSEDpciContextBytes, 14, pciSubsystemIdBytes, 0, 2); - pciSubsystemId = HexUtils.leReverseInt(pciSubsystemIdBytes); + pciSubsystemId = HexUtils.byteArrayToHexString(HexUtils.leReverseByte(pciSubsystemIdBytes)); } + //TODO REMOVE, ALONG WITH GRADLE implementation libs.pci + public static String translateVendor(final String refManufacturer) { + String manufacturer = refManufacturer; + if (manufacturer != null && manufacturer.trim().matches("^[0-9A-Fa-f]{4}$")) { + Vendor ven = DB.findVendor(manufacturer.toLowerCase()); + if (ven != null && !Strings.isNullOrEmpty(ven.getName())) { + manufacturer = ven.getName(); + } + } + return manufacturer; + } + public static String translateDevice(final String refManufacturer, + final String refModel) { + + String model = refModel; + if (refManufacturer != null + && model != null + && refManufacturer.trim().matches("^[0-9A-Fa-f]{4}$") + && model.trim().matches("^[0-9A-Fa-f]{4}$")) { + Device dev = DB.findDevice(refManufacturer.toLowerCase(), + model.toLowerCase()); + if (dev != null && !Strings.isNullOrEmpty(dev.getName())) { + model = dev.getName(); + } + } + return model; + } + /** * Returns a human readable description of the data within this structure. * @@ -99,12 +213,18 @@ public class DeviceSecurityEventDataPciContext { dSEDpciContextInfo += "\n DeviceSecurityEventData - PCI Context"; dSEDpciContextInfo += "\n Version = " + pciVersion; dSEDpciContextInfo += "\n Length = " + pciLength; - dSEDpciContextInfo += "\n VendorID = " + pciVendorId; - dSEDpciContextInfo += "\n DeviceID = " + pciDeviceId; - dSEDpciContextInfo += "\n RevisionID = " + pciRevisionId; - dSEDpciContextInfo += "\n ClassCode = " + pciClassCode; - dSEDpciContextInfo += "\n SubsystemVendorID = " + pciSubsystemVendorId; - dSEDpciContextInfo += "\n SubsystemID = " + pciSubsystemId; + dSEDpciContextInfo += "\n VendorID = 0x" + pciVendorId; + dSEDpciContextInfo += "\n DeviceID = 0x" + pciDeviceId; + dSEDpciContextInfo += "\n RevisionID = 0x" + pciRevisionId; + dSEDpciContextInfo += "\n ClassCode = 0x" + pciClassCode; + dSEDpciContextInfo += "\n SubsystemVendorID = 0x" + pciSubsystemVendorId; + dSEDpciContextInfo += "\n SubsystemID = 0x" + pciSubsystemId; + + // TODO REMOVE + String test1 = translateVendor(pciVendorId); + String test2 = translateDevice(pciVendorId, pciDeviceId); + dSEDpciContextInfo += "\n TEST1 = " + test1; + dSEDpciContextInfo += "\n TEST2 = " + test2; return dSEDpciContextInfo; } From 0f33fdf4cd61b6c9429ea637ea9e825941d7a5c6 Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Tue, 23 Apr 2024 17:12:23 -0400 Subject: [PATCH 22/31] remove tests vendorid/deviceid --- .../DeviceSecurityEventDataPciContext.java | 83 ------------------- 1 file changed, 83 deletions(-) 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 2140b7bf..02502e7c 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 @@ -6,11 +6,6 @@ import hirs.utils.HexUtils; import hirs.utils.tpm.eventlog.spdm.SpdmHa; import lombok.Getter; - -import com.github.marandus.pciid.model.Device; -import com.github.marandus.pciid.model.Vendor; -import com.github.marandus.pciid.service.PciIdsDatabase; - import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -89,50 +84,6 @@ public class DeviceSecurityEventDataPciContext { @Getter private String pciSubsystemId = ""; - - // TODO REMOVE - public static final List<String> PCI_IDS_PATH = - Collections.unmodifiableList(new ArrayList<>() { - private static final long serialVersionUID = 1L; - { - add("/usr/share/hwdata/pci.ids"); - add("/usr/share/misc/pci.ids"); - add("/tmp/pci.ids"); - } - }); - public static final PciIdsDatabase DB = new PciIdsDatabase(); - static { - if (!DB.isReady()) { - String dbFile = null; - for (final String path : PCI_IDS_PATH) { - if ((new File(path)).exists()) { -// log.info("PCI IDs file was found {}", path); - dbFile = path; - break; - } - } - if (dbFile != null) { - InputStream is = null; - try { - is = new FileInputStream(new File(dbFile)); - DB.loadStream(is); - } catch (IOException e) { - // DB will not be ready, hardware IDs will not be translated - dbFile = null; - } finally { - if (is != null) { - try { - is.close(); - } catch (IOException e) { - dbFile = null; - } - } - } - } - } - } - - /** * DeviceSecurityEventDataPciContext Constructor. * @@ -174,34 +125,6 @@ public class DeviceSecurityEventDataPciContext { } - //TODO REMOVE, ALONG WITH GRADLE implementation libs.pci - public static String translateVendor(final String refManufacturer) { - String manufacturer = refManufacturer; - if (manufacturer != null && manufacturer.trim().matches("^[0-9A-Fa-f]{4}$")) { - Vendor ven = DB.findVendor(manufacturer.toLowerCase()); - if (ven != null && !Strings.isNullOrEmpty(ven.getName())) { - manufacturer = ven.getName(); - } - } - return manufacturer; - } - public static String translateDevice(final String refManufacturer, - final String refModel) { - - String model = refModel; - if (refManufacturer != null - && model != null - && refManufacturer.trim().matches("^[0-9A-Fa-f]{4}$") - && model.trim().matches("^[0-9A-Fa-f]{4}$")) { - Device dev = DB.findDevice(refManufacturer.toLowerCase(), - model.toLowerCase()); - if (dev != null && !Strings.isNullOrEmpty(dev.getName())) { - model = dev.getName(); - } - } - return model; - } - /** * Returns a human readable description of the data within this structure. * @@ -220,12 +143,6 @@ public class DeviceSecurityEventDataPciContext { dSEDpciContextInfo += "\n SubsystemVendorID = 0x" + pciSubsystemVendorId; dSEDpciContextInfo += "\n SubsystemID = 0x" + pciSubsystemId; - // TODO REMOVE - String test1 = translateVendor(pciVendorId); - String test2 = translateDevice(pciVendorId, pciDeviceId); - dSEDpciContextInfo += "\n TEST1 = " + test1; - dSEDpciContextInfo += "\n TEST2 = " + test2; - return dSEDpciContextInfo; } } From 8b3336e565e1ffc1203765b82598368dc8b0bbda Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Wed, 24 Apr 2024 10:07:50 -0400 Subject: [PATCH 23/31] fixed DeviceContext to include either/or PCI USB --- .../events/DeviceSecurityEventData.java | 5 +-- .../events/DeviceSecurityEventDataBase.java | 33 +++++++++++--- .../DeviceSecurityEventDataDeviceContext.java | 45 ++++++++++++------- .../events/DeviceSecurityEventDataHeader.java | 2 +- .../DeviceSecurityEventDataHeaderBase.java | 14 +++--- .../DeviceSecurityEventDataPciContext.java | 25 ++--------- 6 files changed, 70 insertions(+), 54 deletions(-) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java index 68f55960..d157f987 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java @@ -2,7 +2,6 @@ package hirs.utils.tpm.eventlog.events; import lombok.Getter; - import java.io.UnsupportedEncodingException; public class DeviceSecurityEventData extends DeviceSecurityEventDataBase { @@ -20,7 +19,7 @@ public class DeviceSecurityEventData extends DeviceSecurityEventDataBase { */ public DeviceSecurityEventData(final byte[] dSEDbytes) throws UnsupportedEncodingException { dsedHeader = new DeviceSecurityEventDataHeader(dSEDbytes); - extractDeviceContext(dSEDbytes, dsedHeader.getDSEDheaderByteSize()); + parseDeviceContext(dSEDbytes, dsedHeader.getDSEDheaderByteSize(), dsedHeader.getDeviceType()); } /** @@ -31,7 +30,7 @@ public class DeviceSecurityEventData extends DeviceSecurityEventDataBase { public String toString() { String dsedInfo = ""; dsedInfo += dsedHeader.toString(); - dsedInfo += getDsedDeviceContext().toString(); + dsedInfo += getDeviceContextInfo(); return dsedInfo; } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java index 1481d6aa..a6ac0f15 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java @@ -54,11 +54,18 @@ import java.nio.charset.StandardCharsets; */ public abstract class DeviceSecurityEventDataBase { +// /** +// * DeviceSecurityEventDataDeviceContext Object. +// */ +// @Getter +// private DeviceSecurityEventDataDeviceContext dsedDeviceContext = null; + /** - * DeviceSecurityEventDataDeviceContext Object. + * Human readable description of the data within the + * DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT. DEVICE can be either PCI or USB. */ @Getter - private DeviceSecurityEventDataDeviceContext dsedDeviceContext = null; + String deviceContextInfo = ""; /** * DeviceSecurityEventData Default Constructor. @@ -68,16 +75,32 @@ public abstract class DeviceSecurityEventDataBase { } - public void extractDeviceContext(final byte[] dSEDbytes, int startByte) { + public void parseDeviceContext(final byte[] dSEDbytes, int startByte, int deviceType) { int deviceContextLength = dSEDbytes.length - startByte; - // get the device type ID + // get the device context bytes byte[] deviceContextBytes = new byte[deviceContextLength]; System.arraycopy(dSEDbytes, startByte, deviceContextBytes, 0, deviceContextLength); - dsedDeviceContext = new DeviceSecurityEventDataDeviceContext(deviceContextBytes); + if (deviceType == 0) { + deviceContextInfo = "No Device Context (indicated by device type value of 0"; + } + else if (deviceType == 1) { + DeviceSecurityEventDataPciContext dSEDpciContext + = new DeviceSecurityEventDataPciContext(deviceContextBytes); + deviceContextInfo = dSEDpciContext.toString(); + } + else if (deviceType == 2) { +// DeviceSecurityEventDataUsbContext dSEDusbContext +// = new DeviceSecurityEventDataUsbContext(deviceContextBytes); +// deviceContextInfo = dSEDusbContext.toString(); + deviceContextInfo = "Device type is USB - to be implemented in future"; + } + else { + deviceContextInfo = " Unknown device type; cannot process device context"; + } } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java index 4d8c5d0b..ed500115 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java @@ -13,18 +13,29 @@ import java.nio.charset.StandardCharsets; * identification of the device, device vendor, subsystem, etc. Device can be either a PCI * or USB connection. * <p> - * typedef struct tdDEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT { + * typedef union tdDEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT { * DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT PciContext; * DEVICE_SECURITY_EVENT_DATA_USB_CONTEXT UsbContext; * } DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT; * <p> */ -public class DeviceSecurityEventDataDeviceContext { +public abstract class DeviceSecurityEventDataDeviceContext { + +// /** +// * SPDM Measurement Block. +// */ +// private DeviceSecurityEventDataPciContext deviceSecurityEventDataPciContext = null; /** - * SPDM Measurement Block. + * PCI Version. */ - private DeviceSecurityEventDataPciContext deviceSecurityEventDataPciContext = null; + @Getter + private int version = 0; + /** + * PCI Length. + */ + @Getter + private int length = 0; /** * DeviceSecurityEventDataDeviceContext Constructor. @@ -33,28 +44,28 @@ public class DeviceSecurityEventDataDeviceContext { */ public DeviceSecurityEventDataDeviceContext(final byte[] dSEDdeviceContextBytes) { - byte[] dSEDpciContextLengthBytes = new byte[2]; - System.arraycopy(dSEDdeviceContextBytes, 2, dSEDpciContextLengthBytes, 0, 2); - int dSEDpciContextLength = HexUtils.leReverseInt(dSEDpciContextLengthBytes); + byte[] pciVersionBytes = new byte[2]; + System.arraycopy(dSEDdeviceContextBytes, 0, pciVersionBytes, 0, 2); + version = HexUtils.leReverseInt(pciVersionBytes); - byte[] dSEDpciContextBytes = new byte[dSEDpciContextLength]; - System.arraycopy(dSEDdeviceContextBytes, 0, dSEDpciContextBytes, 0, dSEDpciContextLength); - deviceSecurityEventDataPciContext = new DeviceSecurityEventDataPciContext(dSEDpciContextBytes); - - //TODO add USB context + byte[] pciLengthBytes = new byte[2]; + System.arraycopy(dSEDdeviceContextBytes, 2, pciLengthBytes, 0, 2); + length = HexUtils.leReverseInt(pciLengthBytes); } /** - * Returns a human readable description of the data within this structure. + * Returns a human readable description of the data common to device context structures. * * @return a description of this structure.. */ - public String toString() { - String dSEDdeviceContextInfo = ""; + public String deviceContextCommonInfoToString() { + String dSEDdeviceContextCommonInfo = ""; - dSEDdeviceContextInfo += deviceSecurityEventDataPciContext.toString(); + dSEDdeviceContextCommonInfo += "\n DeviceSecurityEventData - Device Info"; + dSEDdeviceContextCommonInfo += "\n Device Structure Version = " + version; - return dSEDdeviceContextInfo; + return dSEDdeviceContextCommonInfo; } + } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java index c8a9ecf7..bef56679 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java @@ -110,7 +110,7 @@ public class DeviceSecurityEventDataHeader extends DeviceSecurityEventDataHeader public String toString() { String dsedHeaderInfo = ""; - dsedHeaderInfo += headerBaseToString(); + dsedHeaderInfo += headerCommonInfoToString(); String spdmHashAlgoStr = SpdmHa.tcgAlgIdToString(spdmHashAlgo); dsedHeaderInfo += "\n SPDM Hash Algorithm = " + spdmHashAlgoStr; dsedHeaderInfo += "\n SPDM Measurement Block:"; diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java index 3dfe8c42..cc257cab 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java @@ -189,19 +189,19 @@ public abstract class DeviceSecurityEventDataHeaderBase { * * @return a description of this structure. */ - public String headerBaseToString() { - String dsedHeaderInfo = ""; + public String headerCommonInfoToString() { + String dsedHeaderCommonInfo = ""; - dsedHeaderInfo += "\n SPDM Device Type = " + deviceTypeToString(deviceType); + dsedHeaderCommonInfo += "\n SPDM Device Type = " + deviceTypeToString(deviceType); if (devicePathValid) { - dsedHeaderInfo += "\n SPDM Device Path =\n"; - dsedHeaderInfo += devicePath; + dsedHeaderCommonInfo += "\n SPDM Device Path =\n"; + dsedHeaderCommonInfo += devicePath; } else { - dsedHeaderInfo += "\n SPDM Device Path = Unknown or invalid"; + dsedHeaderCommonInfo += "\n SPDM Device Path = Unknown or invalid"; } - return dsedHeaderInfo; + return dsedHeaderCommonInfo; } } 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 02502e7c..742c8b5d 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 @@ -41,18 +41,8 @@ import java.util.List; * https://admin.pci-ids.ucw.cz/read/PD/ * The revision ID is controlled by the vendor and cannot be looked up. */ -public class DeviceSecurityEventDataPciContext { +public class DeviceSecurityEventDataPciContext extends DeviceSecurityEventDataDeviceContext { - /** - * PCI Version. - */ - @Getter - private int pciVersion = 0; - /** - * PCI Length. - */ - @Getter - private int pciLength = 0; /** * PCI Vendor ID. */ @@ -91,13 +81,7 @@ public class DeviceSecurityEventDataPciContext { */ public DeviceSecurityEventDataPciContext(final byte[] dSEDpciContextBytes) { - byte[] pciVersionBytes = new byte[2]; - System.arraycopy(dSEDpciContextBytes, 0, pciVersionBytes, 0, 2); - pciVersion = HexUtils.leReverseInt(pciVersionBytes); - - byte[] pciLengthBytes = new byte[2]; - System.arraycopy(dSEDpciContextBytes, 2, pciLengthBytes, 0, 2); - pciLength = HexUtils.leReverseInt(pciLengthBytes); + super(dSEDpciContextBytes); byte[] pciVendorIdBytes = new byte[2]; System.arraycopy(dSEDpciContextBytes, 4, pciVendorIdBytes, 0, 2); @@ -133,9 +117,8 @@ public class DeviceSecurityEventDataPciContext { public String toString() { String dSEDpciContextInfo = ""; - dSEDpciContextInfo += "\n DeviceSecurityEventData - PCI Context"; - dSEDpciContextInfo += "\n Version = " + pciVersion; - dSEDpciContextInfo += "\n Length = " + pciLength; + dSEDpciContextInfo += deviceContextCommonInfoToString(); + dSEDpciContextInfo += "\n Device Type = PCI"; dSEDpciContextInfo += "\n VendorID = 0x" + pciVendorId; dSEDpciContextInfo += "\n DeviceID = 0x" + pciDeviceId; dSEDpciContextInfo += "\n RevisionID = 0x" + pciRevisionId; From 2c3987e6bcbfbee675fee9b1a532a69698309491 Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Wed, 24 Apr 2024 10:46:32 -0400 Subject: [PATCH 24/31] cleaned up comments --- .../events/DeviceSecurityEventData.java | 11 ++++- .../events/DeviceSecurityEventData2.java | 32 +++++++++---- .../events/DeviceSecurityEventDataBase.java | 31 ++++++------ .../DeviceSecurityEventDataDeviceContext.java | 9 ---- .../events/DeviceSecurityEventDataHeader.java | 20 +------- .../DeviceSecurityEventDataHeader2.java | 1 + .../DeviceSecurityEventDataHeaderBase.java | 32 ++++++++----- .../DeviceSecurityEventDataPciContext.java | 47 +++++++------------ .../events/EvEfiSpdmFirmwareBlob.java | 14 ++---- .../hirs/utils/tpm/eventlog/spdm/SpdmHa.java | 10 +--- .../tpm/eventlog/spdm/SpdmMeasurement.java | 13 +++-- .../eventlog/spdm/SpdmMeasurementBlock.java | 10 ++++ 12 files changed, 114 insertions(+), 116 deletions(-) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java index d157f987..2abd5be3 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java @@ -1,9 +1,18 @@ package hirs.utils.tpm.eventlog.events; - import lombok.Getter; import java.io.UnsupportedEncodingException; +/** + * Class to process DEVICE_SECURITY_EVENT_DATA. + * Parses event data per PFP v1.06 Rev52 Table 20. + * <p> + * typedef struct tdDEVICE_SECURITY_EVENT_DATA { + * DEVICE_SECURITY_EVENT_DATA_HEADER EventDataHeader; + * DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT DeviceContext; + * } DEVICE_SECURITY_EVENT_DATA; + * <p> + */ public class DeviceSecurityEventData extends DeviceSecurityEventDataBase { /** diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData2.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData2.java index 89154120..076bad86 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData2.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData2.java @@ -2,33 +2,45 @@ package hirs.utils.tpm.eventlog.events; import lombok.Getter; +// TODO Placeholder class to be implemented upon getting test pattern +/** + * Class to process DEVICE_SECURITY_EVENT_DATA2. + * Parses event data per PFP v1.06 Rev52 Table 26. + * <p> + * typedef struct tdDEVICE_SECURITY_EVENT_DATA2 { + * DEVICE_SECURITY_EVENT_DATA_HEADER2 EventDataHeader; + * DEVICE_SECURITY_EVENT_DATA_SUB_HEADER EventDataSubHeader; + * DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT DeviceContext; + * } DEVICE_SECURITY_EVENT_DATA2; + * <p> + */ public class DeviceSecurityEventData2 extends DeviceSecurityEventDataBase { /** - * DeviceSecurityEventDataHeader2 Object. + * DeviceSecurityEventDataHeader Object. */ @Getter private DeviceSecurityEventDataHeader2 dsedHeader2 = null; -// /** -// * DeviceSecurityEventDataSubHeader Object. -// */ -// @Getter -// private DeviceSecurityEventDataSubHeader dsedSubHeader = null; /** * DeviceSecurityEventData2 Constructor. * - * @param dSEDbytes byte array holding the DeviceSecurityEventData. + * @param dSEDbytes byte array holding the DeviceSecurityEventData2. */ public DeviceSecurityEventData2(final byte[] dSEDbytes) { + dsedHeader2 = new DeviceSecurityEventDataHeader2(dSEDbytes); + // get subheader + parseDeviceContext(dSEDbytes, dsedHeader2.getDSEDheaderByteSize(), dsedHeader2.getDeviceType()); } + /** + * Returns a human readable description of the data within this structure. + * + * @return a description of this structure. + */ public String toString() { String dsedInfo = ""; -// dsedInfo += dsedHeader2.toString(); -// dsedInfo += dsedSubHeader.toString(); -// dsedInfo += dsedDeviceContext.toString(); return dsedInfo; } } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java index a6ac0f15..d0e2389e 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java @@ -9,7 +9,7 @@ import java.nio.charset.StandardCharsets; /** * Abstract base class to process the DEVICE_SECURITY_EVENT_DATA or ..DATA2 event. - * Parses event data for DEVICE_SECURITY_EVENT_DATA per PFP v1.06 Rev52 Table 20. + * Parses event data per PFP v1.06 Rev52 Tables 20 and 26. * The event data comes in 2 forms: * 1) DEVICE_SECURITY_EVENT_DATA or * 2) DEVICE_SECURITY_EVENT_DATA2 @@ -32,7 +32,7 @@ import java.nio.charset.StandardCharsets; * DEVICE_SECURITY_EVENT_DATA_HEADER2 EventDataHeader; * DEVICE_SECURITY_EVENT_DATA_SUB_HEADER EventDataSubHeader; * DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT DeviceContext; - * } DEVICE_SECURITY_EVENT_DATA; + * } DEVICE_SECURITY_EVENT_DATA2; * <p> * typedef struct tdDEVICE_SECURITY_EVENT_DATA_HEADER or HEADER2 { * UINT8 Signature[16]; @@ -54,12 +54,6 @@ import java.nio.charset.StandardCharsets; */ public abstract class DeviceSecurityEventDataBase { -// /** -// * DeviceSecurityEventDataDeviceContext Object. -// */ -// @Getter -// private DeviceSecurityEventDataDeviceContext dsedDeviceContext = null; - /** * Human readable description of the data within the * DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT. DEVICE can be either PCI or USB. @@ -75,6 +69,14 @@ public abstract class DeviceSecurityEventDataBase { } + /** + * Parse the Device Context structure, can be PCI or USB based on device type field. + * + * @param dSEDbytes byte array holding the DeviceSecurityEventData. + * @param startByte starting byte of the device structure (depends on length of header). + * @param deviceType device type either PCI or USB. + * + */ public void parseDeviceContext(final byte[] dSEDbytes, int startByte, int deviceType) { int deviceContextLength = dSEDbytes.length - startByte; @@ -92,15 +94,14 @@ public abstract class DeviceSecurityEventDataBase { = new DeviceSecurityEventDataPciContext(deviceContextBytes); deviceContextInfo = dSEDpciContext.toString(); } - else if (deviceType == 2) { -// DeviceSecurityEventDataUsbContext dSEDusbContext -// = new DeviceSecurityEventDataUsbContext(deviceContextBytes); -// deviceContextInfo = dSEDusbContext.toString(); - deviceContextInfo = "Device type is USB - to be implemented in future"; - } + //else if (deviceType == 2) { + //DeviceSecurityEventDataUsbContext dSEDusbContext + // = new DeviceSecurityEventDataUsbContext(deviceContextBytes); + //deviceContextInfo = dSEDusbContext.toString(); + //deviceContextInfo = "Device type is USB - to be implemented in future"; + //} else { deviceContextInfo = " Unknown device type; cannot process device context"; } } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java index ed500115..6520fd2d 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java @@ -1,12 +1,8 @@ package hirs.utils.tpm.eventlog.events; import hirs.utils.HexUtils; -import hirs.utils.tpm.eventlog.spdm.SpdmMeasurementBlock; -import hirs.utils.tpm.eventlog.uefi.UefiConstants; import lombok.Getter; -import java.nio.charset.StandardCharsets; - /** * Class to process the DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT event per PFP. * DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT is a common SPDM structure which includes the @@ -21,11 +17,6 @@ import java.nio.charset.StandardCharsets; */ public abstract class DeviceSecurityEventDataDeviceContext { -// /** -// * SPDM Measurement Block. -// */ -// private DeviceSecurityEventDataPciContext deviceSecurityEventDataPciContext = null; - /** * PCI Version. */ diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java index bef56679..e46c48ab 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java @@ -8,7 +8,6 @@ import lombok.Getter; import java.io.UnsupportedEncodingException; - /** * Class to process the DEVICE_SECURITY_EVENT_DATA_HEADER. * DEVICE_SECURITY_EVENT_DATA_HEADER contains the measurement(s) and hash algorithm identifier @@ -41,10 +40,7 @@ public class DeviceSecurityEventDataHeader extends DeviceSecurityEventDataHeader */ @Getter private int spdmHashAlgo = -1; - /** - * SPDM Measurement Block list. -implement this if there can be multiple SPDM blocks in one event - */ - //private List<SpdmMeasurementBlock> spdmMeasurementBlockList; + /** * SPDM Measurement Block. */ @@ -84,24 +80,10 @@ public class DeviceSecurityEventDataHeader extends DeviceSecurityEventDataHeader sizeOfSpdmMeasBlock); spdmMeasurementBlock = new SpdmMeasurementBlock(spdmMeasBlockBytes); - - // (can there be many >1 spdm block per event ?) - -// byte[] algorithmIDBytes = new byte[UefiConstants.SIZE_2]; -// int algLocation = UefiConstants.SIZE_28; -// for (int i = 0; i < numberOfAlg; i++) { -// System.arraycopy(efiSpecId, algLocation + UefiConstants.OFFSET_4 * i, algorithmIDBytes, -// 0, UefiConstants.SIZE_2); -// String alg = TcgTpmtHa.tcgAlgIdToString(HexUtils.leReverseInt(algorithmIDBytes)); -// algList.add(alg); -// } - int devPathLenStartByte = 28 + sizeOfSpdmMeasBlock; extractDevicePathAndFinalSize(dSEDbytes, devPathLenStartByte); - } - /** * Returns a human readable description of the data within this structure. * diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader2.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader2.java index c129ec30..bf416158 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader2.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader2.java @@ -1,5 +1,6 @@ package hirs.utils.tpm.eventlog.events; +// Placeholder for Header2 data structure. public class DeviceSecurityEventDataHeader2 extends DeviceSecurityEventDataHeaderBase { public DeviceSecurityEventDataHeader2(final byte[] dSEDbytes) { diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java index cc257cab..9c912b6b 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java @@ -1,8 +1,6 @@ package hirs.utils.tpm.eventlog.events; import hirs.utils.HexUtils; -import hirs.utils.tpm.eventlog.spdm.SpdmHa; -import hirs.utils.tpm.eventlog.spdm.SpdmMeasurementBlock; import hirs.utils.tpm.eventlog.uefi.UefiConstants; import hirs.utils.tpm.eventlog.uefi.UefiDevicePath; import lombok.Getter; @@ -47,14 +45,8 @@ import java.nio.charset.StandardCharsets; */ public abstract class DeviceSecurityEventDataHeaderBase { -// /** -// * Contains the human-readable info inside the Device Security Event. -// */ -// @Getter -// private String dSEDheaderInfo = ""; - /** - * Contains the size (in bytes) of the Header. + * Contains the size (in bytes) of the header. */ @Getter private Integer dSEDheaderByteSize = 0; @@ -103,6 +95,9 @@ public abstract class DeviceSecurityEventDataHeaderBase { public static final int DEVICE_TYPE_USB = 2; + /** + * DeviceSecurityEventDataHeaderBase Default Constructor. + */ public DeviceSecurityEventDataHeaderBase() { } @@ -114,8 +109,6 @@ public abstract class DeviceSecurityEventDataHeaderBase { */ public DeviceSecurityEventDataHeaderBase(final byte[] dSEDbytes) { -// spdmMeasurementBlockList = new ArrayList<>(); - byte[] signatureBytes = new byte[UefiConstants.SIZE_16]; System.arraycopy(dSEDbytes, 0, signatureBytes, 0, UefiConstants.SIZE_16); signature = new String(signatureBytes, StandardCharsets.UTF_8) @@ -128,6 +121,12 @@ public abstract class DeviceSecurityEventDataHeaderBase { } + /** + * Parse the device type from the Device Security Event Data Header/Header2. + * + * @param dSEDbytes byte array holding the DeviceSecurityEventData/Data2. + * @param startByte starting byte of device type (depends on header fields before it). + */ public void extractDeviceType(final byte[] dSEDbytes, int startByte) { // get the device type ID @@ -137,6 +136,13 @@ public abstract class DeviceSecurityEventDataHeaderBase { deviceType = HexUtils.leReverseInt(deviceTypeBytes); } + /** + * Parse the device path from the Device Security Event Data Header/Header2. + * Also, determine final length of header (will be used to extract the next data structure). + * + * @param dSEDbytes byte array holding the DeviceSecurityEventData/Data2. + * @param startByte starting byte of device path (depends on header fields before it). + */ public void extractDevicePathAndFinalSize(final byte[] dSEDbytes, int startByte) throws UnsupportedEncodingException { @@ -156,6 +162,7 @@ public abstract class DeviceSecurityEventDataHeaderBase { devicePathValid = true; } + // header total size dSEDheaderByteSize = startByte + devicePathLength; } @@ -185,7 +192,7 @@ public abstract class DeviceSecurityEventDataHeaderBase { } /** - * Returns a human readable description of the data within this structure. + * Returns a human readable description of the data common to header structures. * * @return a description of this structure. */ @@ -203,5 +210,4 @@ public abstract class DeviceSecurityEventDataHeaderBase { return dsedHeaderCommonInfo; } - } 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 742c8b5d..194d0e12 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 @@ -1,19 +1,8 @@ package hirs.utils.tpm.eventlog.events; -//import hirs.attestationca.persist.util.PciIds; -import com.google.common.base.Strings; import hirs.utils.HexUtils; -import hirs.utils.tpm.eventlog.spdm.SpdmHa; import lombok.Getter; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - /** * Class to process the DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT event per PFP. * <p> @@ -47,32 +36,32 @@ public class DeviceSecurityEventDataPciContext extends DeviceSecurityEventDataDe * PCI Vendor ID. */ @Getter - private String pciVendorId = ""; + private String vendorId = ""; /** * PCI Device ID. */ @Getter - private String pciDeviceId = ""; + private String deviceId = ""; /** * PCI Revision ID. */ @Getter - private String pciRevisionId = ""; + private String revisionId = ""; /** * PCI Class Code. */ @Getter - private String pciClassCode = ""; + private String classCode = ""; /** * PCI Subsystem Vendor ID. */ @Getter - private String pciSubsystemVendorId = ""; + private String subsystemVendorId = ""; /** * PCI Subsystem ID. */ @Getter - private String pciSubsystemId = ""; + private String subsystemId = ""; /** * DeviceSecurityEventDataPciContext Constructor. @@ -85,27 +74,27 @@ public class DeviceSecurityEventDataPciContext extends DeviceSecurityEventDataDe byte[] pciVendorIdBytes = new byte[2]; System.arraycopy(dSEDpciContextBytes, 4, pciVendorIdBytes, 0, 2); - pciVendorId = HexUtils.byteArrayToHexString(HexUtils.leReverseByte(pciVendorIdBytes)); + vendorId = HexUtils.byteArrayToHexString(HexUtils.leReverseByte(pciVendorIdBytes)); byte[] pciDeviceIdBytes = new byte[2]; System.arraycopy(dSEDpciContextBytes, 6, pciDeviceIdBytes, 0, 2); - pciDeviceId = HexUtils.byteArrayToHexString(HexUtils.leReverseByte(pciDeviceIdBytes)); + deviceId = HexUtils.byteArrayToHexString(HexUtils.leReverseByte(pciDeviceIdBytes)); byte[] pciRevisionIdBytes = new byte[1]; System.arraycopy(dSEDpciContextBytes, 8, pciRevisionIdBytes, 0, 1); - pciRevisionId = HexUtils.byteArrayToHexString(HexUtils.leReverseByte(pciRevisionIdBytes)); + revisionId = HexUtils.byteArrayToHexString(HexUtils.leReverseByte(pciRevisionIdBytes)); byte[] pciClassCodeBytes = new byte[3]; System.arraycopy(dSEDpciContextBytes, 9, pciClassCodeBytes, 0, 3); - pciClassCode = HexUtils.byteArrayToHexString(HexUtils.leReverseByte(pciClassCodeBytes)); + classCode = HexUtils.byteArrayToHexString(HexUtils.leReverseByte(pciClassCodeBytes)); byte[] pciSubsystemVendorIdBytes = new byte[2]; System.arraycopy(dSEDpciContextBytes, 12, pciSubsystemVendorIdBytes, 0, 2); - pciSubsystemVendorId = HexUtils.byteArrayToHexString(HexUtils.leReverseByte(pciSubsystemVendorIdBytes)); + subsystemVendorId = HexUtils.byteArrayToHexString(HexUtils.leReverseByte(pciSubsystemVendorIdBytes)); byte[] pciSubsystemIdBytes = new byte[2]; System.arraycopy(dSEDpciContextBytes, 14, pciSubsystemIdBytes, 0, 2); - pciSubsystemId = HexUtils.byteArrayToHexString(HexUtils.leReverseByte(pciSubsystemIdBytes)); + subsystemId = HexUtils.byteArrayToHexString(HexUtils.leReverseByte(pciSubsystemIdBytes)); } @@ -119,12 +108,12 @@ public class DeviceSecurityEventDataPciContext extends DeviceSecurityEventDataDe dSEDpciContextInfo += deviceContextCommonInfoToString(); dSEDpciContextInfo += "\n Device Type = PCI"; - dSEDpciContextInfo += "\n VendorID = 0x" + pciVendorId; - dSEDpciContextInfo += "\n DeviceID = 0x" + pciDeviceId; - dSEDpciContextInfo += "\n RevisionID = 0x" + pciRevisionId; - dSEDpciContextInfo += "\n ClassCode = 0x" + pciClassCode; - dSEDpciContextInfo += "\n SubsystemVendorID = 0x" + pciSubsystemVendorId; - dSEDpciContextInfo += "\n SubsystemID = 0x" + pciSubsystemId; + dSEDpciContextInfo += "\n VendorID = 0x" + vendorId; + dSEDpciContextInfo += "\n DeviceID = 0x" + deviceId; + dSEDpciContextInfo += "\n RevisionID = 0x" + revisionId; + dSEDpciContextInfo += "\n ClassCode = 0x" + classCode; + dSEDpciContextInfo += "\n SubsystemVendorID = 0x" + subsystemVendorId; + dSEDpciContextInfo += "\n SubsystemID = 0x" + subsystemId; return dSEDpciContextInfo; } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java index f0eb9e4c..da83c51f 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/EvEfiSpdmFirmwareBlob.java @@ -1,14 +1,10 @@ package hirs.utils.tpm.eventlog.events; import hirs.utils.HexUtils; -import hirs.utils.tpm.eventlog.TcgTpmtHa; import hirs.utils.tpm.eventlog.uefi.UefiConstants; -import lombok.Getter; import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; /** * Class to process the EV_EFI_SPDM_FIRMWARE_BLOB event. The event field MUST be a @@ -41,7 +37,7 @@ public class EvEfiSpdmFirmwareBlob { /** * True if the event is a DEVICE_SECURITY_EVENT_DATA or ..DATA2. */ - private boolean bDeviceSecurityEventData = false; + private boolean bSpdmDeviceSecurityEventData = false; /** * Human readable description of the data within this DEVICE_SECURITY_EVENT_DATA/..DATA2 event. */ @@ -61,7 +57,7 @@ public class EvEfiSpdmFirmwareBlob { signature = signature.replaceAll("[^\\P{C}\t\r\n]", ""); // remove null characters if (signature.contains("SPDM Device Sec")) { // implies Device Security event - bDeviceSecurityEventData = true; + bSpdmDeviceSecurityEventData = true; byte[] versionBytes = new byte[UefiConstants.SIZE_2]; System.arraycopy(eventData, UefiConstants.OFFSET_16, versionBytes, 0, @@ -87,8 +83,8 @@ public class EvEfiSpdmFirmwareBlob { * * @return true of the event is a DeviceSecurityEventData. */ - public boolean isDeviceSecurityEventData() { - return bDeviceSecurityEventData; + public boolean isSpdmDeviceSecurityEventData() { + return bSpdmDeviceSecurityEventData; } /** @@ -97,7 +93,7 @@ public class EvEfiSpdmFirmwareBlob { * @return Human readable description of this event. */ public String toString() { - if (bDeviceSecurityEventData) { + if (bSpdmDeviceSecurityEventData) { spdmInfo = " Signature = SPDM Device Sec" + spdmInfo; } else { spdmInfo = "EV_EFI_SPDM_FIRMWARE_BLOB event named " + signature diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmHa.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmHa.java index 3195896f..cf49aae4 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmHa.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmHa.java @@ -1,20 +1,15 @@ package hirs.utils.tpm.eventlog.spdm; -import hirs.utils.HexUtils; import lombok.AccessLevel; import lombok.NoArgsConstructor; /** - * Class for defining constants referenced in the DMTF SPDM specification. + * Class for defining hash algorithms referenced in the DMTF SPDM specification. + * SPDM 1.3.0, Table 21, MeasurementHashAlgo. */ @NoArgsConstructor(access = AccessLevel.PRIVATE) public class SpdmHa { - - /** - * ------------------- SPDM Spec: MeasurementHashAlgo ------------------- - * SPDM 1.3.0, Table 21 - */ /** * Spdm Hash Alg = Raw bit stream */ @@ -80,5 +75,4 @@ public class SpdmHa { } return alg; } - } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurement.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurement.java index 1555d4aa..625fdf2f 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurement.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurement.java @@ -39,9 +39,11 @@ public class SpdmMeasurement { @Getter private byte[] dmtfSpecMeasurementValue = null; - @Getter(value = AccessLevel.PROTECTED) - private byte[] digest = null; - + /** + * SpdmMeasurement Constructor. + * + * @param spdmMeasBytes byte array holding the SPDM Measurement bytes. + */ public SpdmMeasurement(final byte[] spdmMeasBytes) { byte[] dmtfSpecMeasurementValueTypeBytes = new byte[1]; @@ -60,6 +62,11 @@ public class SpdmMeasurement { dmtfSpecMeasurementValueSize); } + /** + * Returns a human readable description of the data within this structure. + * + * @return a description of this structure.. + */ public String dmtfSpecMeasurementValueTypeToString(final int measValType) { String measValTypeStr; diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurementBlock.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurementBlock.java index ff2ac9ea..4b1345eb 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurementBlock.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurementBlock.java @@ -39,6 +39,11 @@ public class SpdmMeasurementBlock { */ private SpdmMeasurement spdmMeasurement; + /** + * SpdmMeasurementBlock Constructor. + * + * @param spdmMeasBlockBytes byte array holding the SPDM Measurement Block bytes. + */ public SpdmMeasurementBlock(final byte[] spdmMeasBlockBytes) { byte[] indexBytes = new byte[1]; @@ -63,6 +68,11 @@ public class SpdmMeasurementBlock { spdmMeasurement = new SpdmMeasurement(measurementBytes); } + /** + * Returns a human readable description of the data within this structure. + * + * @return a description of this structure.. + */ public String toString() { String spdmMeasBlockInfo = ""; From e3e1e1c7b19e3bc33517236a4b6c4d8496ca61ac Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Fri, 26 Apr 2024 12:16:05 -0400 Subject: [PATCH 25/31] small fix to output --- .../src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java | 1 + .../eventlog/events/DeviceSecurityEventDataDeviceContext.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java index c6027fbf..66d2f2df 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java @@ -544,6 +544,7 @@ public class TpmPcrEvent { case EvConstants.EV_EFI_SPDM_FIRMWARE_BLOB: EvEfiSpdmFirmwareBlob efiSpdmFwBlob = new EvEfiSpdmFirmwareBlob(content); description += "Event Content:\n" + efiSpdmFwBlob.toString(); + break; default: description += " Unknown Event found" + "\n"; } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java index 6520fd2d..ce1f918e 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java @@ -52,7 +52,7 @@ public abstract class DeviceSecurityEventDataDeviceContext { public String deviceContextCommonInfoToString() { String dSEDdeviceContextCommonInfo = ""; - dSEDdeviceContextCommonInfo += "\n DeviceSecurityEventData - Device Info"; + dSEDdeviceContextCommonInfo += "\n DeviceSecurityEventData Device Info:"; dSEDdeviceContextCommonInfo += "\n Device Structure Version = " + version; return dSEDdeviceContextCommonInfo; From 1941e4dd86be75787093a851cd6067407de6f722 Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Fri, 26 Apr 2024 14:12:39 -0400 Subject: [PATCH 26/31] fixed spotbug errors --- .../main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurement.java | 1 - 1 file changed, 1 deletion(-) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurement.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurement.java index 625fdf2f..0773be82 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurement.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/spdm/SpdmMeasurement.java @@ -36,7 +36,6 @@ public class SpdmMeasurement { /** * Measurement value (digest). */ - @Getter private byte[] dmtfSpecMeasurementValue = null; /** From 018238fd2e9edebe272a552abe0d03c441a459b0 Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Fri, 26 Apr 2024 14:15:51 -0400 Subject: [PATCH 27/31] removed temporary test file folder --- ...ents_addEvt11asSPDMFirmwareBlob_origVersion0 | Bin 23866 -> 0 bytes ...urements_addEvt11asSPDMFirmwareBlob_version1 | Bin 23866 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 0_temp/binary_bios_measurements_addEvt11asSPDMFirmwareBlob_origVersion0 delete mode 100644 0_temp/binary_bios_measurements_addEvt11asSPDMFirmwareBlob_version1 diff --git a/0_temp/binary_bios_measurements_addEvt11asSPDMFirmwareBlob_origVersion0 b/0_temp/binary_bios_measurements_addEvt11asSPDMFirmwareBlob_origVersion0 deleted file mode 100644 index 1feda691732602357492bc27fd0bdcec33f33edd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 23866 zcmd_S1zc2Jy9YXScPauyC=D}oDxK1eGz>7*(4k0&f+zx_peQ90l8Ur63P>X%AS$3p z2$CWKcW*#n9evODefPZQ{Lb&*4SUb5J^%HrXFY2@wRS)t5C|5q|7l|ZPU?Fg?4W9j zP$fTvyAMq05QYiC!~nh#L7<0aJmBN-#N3D1$)#geg>$K*rgK*x7(VSLRjVO-;f{Qs zA1=>oImrMZ<xwafsEV(RmpxPyVdL%Vg|LU}^C{>VXdY0*|3PfXi%6D0A)KlT%P5p? z8;jtK%Y5wPi<~l#c-#w@YCjv214yPF7XxBOL)n}nt@Q@FDoKz8$jTu*BE)R1-ixt0 zFU7ipnKB&<FnREy;i~CHA@lDV^B>@ofD|C)$M(Sw2*l#xc+{EDLkbjTc^u;}b`%F_ zi|+QmGOC}qC5k3Ye)_U9>q5;5P0UddppMPdOk8Ku07U@_<jpNCo-2e0bPjm{zv@E} z5Icx3#0&V8hoFEz9|+{vX1E(ZMw=nzFdvo)kS)*hwe~Ue$R<#eFUS;?uy8=KDnA2b zgx(D1Q8V2~<EI1BfMl9B-k(W+pdM3ENMp{k;`RNvG62(~Y2@)OZCWepTXKrp$c#BG z94j3bjv1AKg^7WQNv@Mw9~JxINu4ZTXF&IWQzncAmw-E3HF}E#1A_<$0&|2D!3c1% z46$*kFb(zLq%dNzfKQBLfC#YhhEu^Pz%m{&p&rWD-5#okvU7n`!pOmsgv11j2v=9A zn!6o8oEgRlp2H%h{c#Se<7(sMfbw#KY9In(Omrl0QJ5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D+xQ_4BG8{n{()ySj{hO0{_n;_>(zmT z8X}bMeJr$`EPUq+->Sc*v*o+^tvSr`X4;_dhhHW>5C|W6rQau--Lb2uSE5al{g@!y z6!!`)Pj|2wk493<(ok~6b4I<ylKpvV{D}3S`hh^c<OU`iz8-+x28_2a!U4(Wfb??n zxA8(iFAx$q_#gaAco9v4nb~u7*{`n5mpzcET&KB7XG6`3te>5XP7r;fZbw_k0A6kW zX)^v@f?x+^Y$&%sMgU3SZO6-FRFyU@_f{Ms8g+!bN(qTMcU@Nu9uI0DZpvw(wQ&BA zi4G{U{}+uLN4t!t?X+7g=d4*HBh;)~GDWTV&Zt)vJjkn5&%5FCi|;r{gZu!kMWG4l zADU(hT`U8)EZDTn8eF2}uIQ4}+MPD(`G&vKwR<}ET~4glFY(KfeYA0PwfYlF>j@oA z7QLj$iY?eI-l}ojkGXaB7#u@ozwGKKtT)DO%1l2?71V!6hX5d+3<Ucq<AOkVpmnj? z5bMT7?V={0HldQ=E>{f|c8%x8;N=q}(d^gKQ`^>m$%Bq~b3Bhkm(;GWN6~X~+!uUT z3k|zZ$gYiDBiypMut*nKM~M*?Q~RXgXSQ6C?!cQ=zNfW<TmpV>;HmTfRr>b7>EXaN zw4V}xRP1ZhwwE_W6p{nf4Q|?AyE{3g{`hv_eDPI$O-Cvsh94q2=og@Xz{{UNXNxB3 zK<}|9w<BLGysEp`NTIr7`dJW@rk}LkaPg{JI{jo+QptA_9lC08837=O_`fWtUl&Lc zZEtbJk_)WeeIn#ru7by%znFiwhc5lg4Jh_S*bG&P()SL63nYhG$<LiTIAh}mgrWaM z7SE4#b3_{++k0={F8hkjzaF98>C-IE4zA$7Z%(vZ%TM^_6P4_Tu-}JA?I0t9{6EYv Ba-jeK diff --git a/0_temp/binary_bios_measurements_addEvt11asSPDMFirmwareBlob_version1 b/0_temp/binary_bios_measurements_addEvt11asSPDMFirmwareBlob_version1 deleted file mode 100644 index 3d1b3dbd4a122cfa9619f6c1c0c4e879c3777286..0000000000000000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%I%L4KvH<y@$wi|rA^Dd6-S6h9pSE0LSoKc*A;`ugBpmNavEqYod08@ z1Iq0GMdQZNF5_uC?H0>9Yu3mJHLI3PQER?4>Qw~~@+#HyZutD-I}XwyKR|0yXhQmj zrrAOl%fKxQHZ8LTmngX_y5zKWr%igk;qP?qp3Z%j6RY)0{BmR;ZCqWg{>0LHLPwKD zFX^#j3pR_lY8>}tZk;^_$57cXyZQ<1jd7bY)6Y@`_21DU0Ej08!9L2kAP^pCU2HbQ zx-n6^sEMadsN}cHRYQec<GC?-`2<Nc`?d7cw)J1~pd;QK&m++#wd?Cq^qd^`1>e;| z!|oHZYh%|4w=6C!(nZ!$VnoH%J}LN_Emx#F@Ftb-X{{iafS((9>imC|zWr}{IB*T^ zr^Fu>``Wba<xLTV<N$Spo3_{PP7bL*z8yGUd=+2Qk&1}nhlmdP1t=i!@+Z*QqDeZ? zd+f>W$kz(5>h3jCsIHiP7R03KCv7)eyy})tKN*!&@?AuSt{PlM00<)fFU#rI1(HPD zTO6_E0&91l2>F();Bn_K=HKn1OaF2MihU6_Lsg>my@TKa$zfLVbLS4u*th{<=zo#L z^CR6H(T2zN-rKj!zGCyQM`(BYG>fx?E4c5Q6YbXW6Mp$bCHo=l_u)}H$cP~S5AB0; Aq5uE@ From 9a8552d7207545332fcb2f1abf43d05f650420bb Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Fri, 26 Apr 2024 14:25:45 -0400 Subject: [PATCH 28/31] consolidated a line --- .../src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java index 66d2f2df..128e7853 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/TpmPcrEvent.java @@ -542,8 +542,7 @@ public class TpmPcrEvent { description += "Event Content:\n" + new UefiVariable(content).toString(); break; case EvConstants.EV_EFI_SPDM_FIRMWARE_BLOB: - EvEfiSpdmFirmwareBlob efiSpdmFwBlob = new EvEfiSpdmFirmwareBlob(content); - description += "Event Content:\n" + efiSpdmFwBlob.toString(); + description += "Event Content:\n" + new EvEfiSpdmFirmwareBlob(content).toString(); break; default: description += " Unknown Event found" + "\n"; From de6edaee3dcf2c7ee05f6233ae98570c2b30f743 Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Mon, 29 Apr 2024 08:49:07 -0400 Subject: [PATCH 29/31] updated comments in ..HeaderBase to be more clear --- .../DeviceSecurityEventDataHeaderBase.java | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java index 9c912b6b..818395e5 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java @@ -15,33 +15,40 @@ import java.nio.charset.StandardCharsets; * which implies the data is a DEVICE_SECURITY_EVENT_DATA or ..DATA2. * * HEADERS defined by PFP v1.06 Rev 52. - * The ** indicates fields that are common to both ..HEADER and ..HEADER2. + * Certain fields are common to both ..HEADER and ..HEADER2, and are noted below the structures. * <p> * typedef struct tdDEVICE_SECURITY_EVENT_DATA_HEADER { - * UINT8 ** Signature[16]; - * UINT16 ** Version; + * UINT8 Signature[16]; + * UINT16 Version; * UINT16 Length; * UINT32 SpdmHashAlg; - * UINT32 ** DeviceType; + * UINT32 DeviceType; * SPDM_MEASUREMENT_BLOCK SpdmMeasurementBlock; - * UINT64 ** DevicePathLength; - * UNIT8 ** DevicePath[DevicePathLength] + * UINT64 DevicePathLength; + * UNIT8 DevicePath[DevicePathLength] * } DEVICE_SECURITY_EVENT_DATA_HEADER; * <p> * typedef struct tdDEVICE_SECURITY_EVENT_DATA_HEADER2 { - NOT IMPLEMENTED YET - * UINT8 ** Signature[16]; - * UINT16 ** Version; + * UINT8 Signature[16]; + * UINT16 Version; * UINT8 AuthState; * UINT8 Reserved; * UINT32 Length; - * UINT32 ** DeviceType; + * UINT32 DeviceType; * UINT32 SubHeaderType; * UINT32 SubHeaderLength; * UINT32 SubHeaderUID; - * UINT64 ** DevicePathLength; - * UNIT8 ** DevicePath[DevicePathLength] + * UINT64 DevicePathLength; + * UNIT8 DevicePath[DevicePathLength] * } DEVICE_SECURITY_EVENT_DATA_HEADER2; * <p> + * Fields common to both ..HEADER and ..HEADER2: + * Signature + * Version + * DeviceType + * DevicePathLength + * DevicePath + * <p> */ public abstract class DeviceSecurityEventDataHeaderBase { From 766d1eb3e0e6b52e95ae4a9301db5b419f0b0a00 Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Mon, 29 Apr 2024 09:17:18 -0400 Subject: [PATCH 30/31] changed name of DeviceSecurityEventData parent and ..HEADER parent to make the naming more clear --- ...ecurityEventDataBase.java => DeviceSecurityEvent.java} | 8 ++------ .../tpm/eventlog/events/DeviceSecurityEventData.java | 2 +- .../tpm/eventlog/events/DeviceSecurityEventData2.java | 2 +- .../eventlog/events/DeviceSecurityEventDataHeader.java | 2 +- .../eventlog/events/DeviceSecurityEventDataHeader2.java | 2 +- ...DataHeaderBase.java => DeviceSecurityEventHeader.java} | 6 +++--- 6 files changed, 9 insertions(+), 13 deletions(-) rename HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/{DeviceSecurityEventDataBase.java => DeviceSecurityEvent.java} (95%) rename HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/{DeviceSecurityEventDataHeaderBase.java => DeviceSecurityEventHeader.java} (97%) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEvent.java similarity index 95% rename from HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java rename to HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEvent.java index d0e2389e..0e97f8a1 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataBase.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEvent.java @@ -1,11 +1,7 @@ package hirs.utils.tpm.eventlog.events; -import hirs.utils.HexUtils; -import hirs.utils.tpm.eventlog.uefi.UefiConstants; import lombok.Getter; -import java.nio.charset.StandardCharsets; - /** * Abstract base class to process the DEVICE_SECURITY_EVENT_DATA or ..DATA2 event. @@ -52,7 +48,7 @@ import java.nio.charset.StandardCharsets; * even though the spec says both are in the data structure. If it is only 1, though, there's no * method to tell them apart. */ -public abstract class DeviceSecurityEventDataBase { +public abstract class DeviceSecurityEvent { /** * Human readable description of the data within the @@ -65,7 +61,7 @@ public abstract class DeviceSecurityEventDataBase { * DeviceSecurityEventData Default Constructor. * */ - public DeviceSecurityEventDataBase() { + public DeviceSecurityEvent() { } diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java index 2abd5be3..4f996548 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData.java @@ -13,7 +13,7 @@ import java.io.UnsupportedEncodingException; * } DEVICE_SECURITY_EVENT_DATA; * <p> */ -public class DeviceSecurityEventData extends DeviceSecurityEventDataBase { +public class DeviceSecurityEventData extends DeviceSecurityEvent { /** * DeviceSecurityEventDataHeader Object. diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData2.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData2.java index 076bad86..014b6fe0 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData2.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventData2.java @@ -14,7 +14,7 @@ import lombok.Getter; * } DEVICE_SECURITY_EVENT_DATA2; * <p> */ -public class DeviceSecurityEventData2 extends DeviceSecurityEventDataBase { +public class DeviceSecurityEventData2 extends DeviceSecurityEvent { /** * DeviceSecurityEventDataHeader Object. diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java index e46c48ab..9a598000 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java @@ -28,7 +28,7 @@ import java.io.UnsupportedEncodingException; * <p> * Assumption: there is only 1 SpdmMeasurementBlock per event. Need more test patterns to verify. */ -public class DeviceSecurityEventDataHeader extends DeviceSecurityEventDataHeaderBase { +public class DeviceSecurityEventDataHeader extends DeviceSecurityEventHeader { /** * Event data length. diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader2.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader2.java index bf416158..0e372ea8 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader2.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader2.java @@ -1,7 +1,7 @@ package hirs.utils.tpm.eventlog.events; // Placeholder for Header2 data structure. -public class DeviceSecurityEventDataHeader2 extends DeviceSecurityEventDataHeaderBase { +public class DeviceSecurityEventDataHeader2 extends DeviceSecurityEventHeader { public DeviceSecurityEventDataHeader2(final byte[] dSEDbytes) { diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventHeader.java similarity index 97% rename from HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java rename to HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventHeader.java index 818395e5..c254eec3 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeaderBase.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventHeader.java @@ -50,7 +50,7 @@ import java.nio.charset.StandardCharsets; * DevicePath * <p> */ -public abstract class DeviceSecurityEventDataHeaderBase { +public abstract class DeviceSecurityEventHeader { /** * Contains the size (in bytes) of the header. @@ -105,7 +105,7 @@ public abstract class DeviceSecurityEventDataHeaderBase { /** * DeviceSecurityEventDataHeaderBase Default Constructor. */ - public DeviceSecurityEventDataHeaderBase() { + public DeviceSecurityEventHeader() { } @@ -114,7 +114,7 @@ public abstract class DeviceSecurityEventDataHeaderBase { * * @param dSEDbytes byte array holding the DeviceSecurityEventData. */ - public DeviceSecurityEventDataHeaderBase(final byte[] dSEDbytes) { + public DeviceSecurityEventHeader(final byte[] dSEDbytes) { byte[] signatureBytes = new byte[UefiConstants.SIZE_16]; System.arraycopy(dSEDbytes, 0, signatureBytes, 0, UefiConstants.SIZE_16); From 9f097f391c66b703a989fcd164e7e5833b0ae838 Mon Sep 17 00:00:00 2001 From: iadgovuser58 <124906646+iadgovuser58@users.noreply.github.com> Date: Mon, 29 Apr 2024 11:49:25 -0400 Subject: [PATCH 31/31] changing string and other comments --- .../DeviceSecurityEventDataDeviceContext.java | 2 +- .../events/DeviceSecurityEventDataHeader.java | 2 +- .../events/DeviceSecurityEventDataHeader2.java | 13 +++++++++++++ .../events/DeviceSecurityEventDataPciContext.java | 2 +- .../eventlog/events/DeviceSecurityEventHeader.java | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java index ce1f918e..a9863eb7 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataDeviceContext.java @@ -49,7 +49,7 @@ public abstract class DeviceSecurityEventDataDeviceContext { * * @return a description of this structure.. */ - public String deviceContextCommonInfoToString() { + public String toString() { String dSEDdeviceContextCommonInfo = ""; dSEDdeviceContextCommonInfo += "\n DeviceSecurityEventData Device Info:"; diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java index 9a598000..3c9ac444 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader.java @@ -92,7 +92,7 @@ public class DeviceSecurityEventDataHeader extends DeviceSecurityEventHeader { public String toString() { String dsedHeaderInfo = ""; - dsedHeaderInfo += headerCommonInfoToString(); + dsedHeaderInfo += super.toString(); String spdmHashAlgoStr = SpdmHa.tcgAlgIdToString(spdmHashAlgo); dsedHeaderInfo += "\n SPDM Hash Algorithm = " + spdmHashAlgoStr; dsedHeaderInfo += "\n SPDM Measurement Block:"; diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader2.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader2.java index 0e372ea8..8e7589a9 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader2.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataHeader2.java @@ -1,9 +1,22 @@ package hirs.utils.tpm.eventlog.events; +import hirs.utils.tpm.eventlog.spdm.SpdmHa; + // Placeholder for Header2 data structure. public class DeviceSecurityEventDataHeader2 extends DeviceSecurityEventHeader { public DeviceSecurityEventDataHeader2(final byte[] dSEDbytes) { } + + /** + * Returns a human readable description of the data within this structure. + * + * @return a description of this structure. + */ + public String toString() { + String dsedHeader2Info = ""; + + return dsedHeader2Info; + } } 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 194d0e12..ed8f4c89 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 @@ -106,7 +106,7 @@ public class DeviceSecurityEventDataPciContext extends DeviceSecurityEventDataDe public String toString() { String dSEDpciContextInfo = ""; - dSEDpciContextInfo += deviceContextCommonInfoToString(); + dSEDpciContextInfo += super.toString(); dSEDpciContextInfo += "\n Device Type = PCI"; dSEDpciContextInfo += "\n VendorID = 0x" + vendorId; dSEDpciContextInfo += "\n DeviceID = 0x" + deviceId; 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 c254eec3..b7192054 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 @@ -203,7 +203,7 @@ public abstract class DeviceSecurityEventHeader { * * @return a description of this structure. */ - public String headerCommonInfoToString() { + public String toString() { String dsedHeaderCommonInfo = ""; dsedHeaderCommonInfo += "\n SPDM Device Type = " + deviceTypeToString(deviceType);