From 93c1a9bf29b28fd242d3d820bb4563ba45597d2b 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] 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.