mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-03-22 12:05:59 +00:00
spdm processing
This commit is contained in:
parent
c1d4e90e63
commit
d10aa3a197
@ -18,8 +18,8 @@ import java.util.List;
|
|||||||
* 2) DEVICE_SECURITY_EVENT_DATA2
|
* 2) DEVICE_SECURITY_EVENT_DATA2
|
||||||
* The first 16 bytes of the event data header MUST be a String based identifier (Signature),
|
* 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
|
* 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
|
* implies the data is a DEVICE_SECURITY_EVENT_DATA or ..DATA2. The Version field in the HEADER
|
||||||
* whether it is ..DATA or ..DATA2.
|
* or HEADER2 indicates whether the Device Security Event is ..DATA or ..DATA2.
|
||||||
*
|
*
|
||||||
* DEVICE SECURITY EVENT structures defined by PFP v1.06 Rev 52:
|
* DEVICE SECURITY EVENT structures defined by PFP v1.06 Rev 52:
|
||||||
* <p>
|
* <p>
|
||||||
@ -34,6 +34,12 @@ import java.util.List;
|
|||||||
* DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT DeviceContext;
|
* DEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT DeviceContext;
|
||||||
* } DEVICE_SECURITY_EVENT_DATA;
|
* } DEVICE_SECURITY_EVENT_DATA;
|
||||||
* <p>
|
* <p>
|
||||||
|
* typedef struct tdDEVICE_SECURITY_EVENT_DATA_HEADER or HEADER2 {
|
||||||
|
* UINT8 Signature[16];
|
||||||
|
* UINT16 Version;
|
||||||
|
* ... ...
|
||||||
|
* }
|
||||||
|
* <p>
|
||||||
* typedef struct tdDEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT {
|
* typedef struct tdDEVICE_SECURITY_EVENT_DATA_DEVICE_CONTEXT {
|
||||||
* DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT PciContext;
|
* DEVICE_SECURITY_EVENT_DATA_PCI_CONTEXT PciContext;
|
||||||
* DEVICE_SECURITY_EVENT_DATA_USB_CONTEXT UsbContext;
|
* DEVICE_SECURITY_EVENT_DATA_USB_CONTEXT UsbContext;
|
||||||
@ -55,11 +61,11 @@ public class DeviceSecurityEventData {
|
|||||||
/**
|
/**
|
||||||
* Version determines data structure used (..DATA or ..DATA2).
|
* Version determines data structure used (..DATA or ..DATA2).
|
||||||
*/
|
*/
|
||||||
// @Getter
|
@Getter
|
||||||
// private String version = "";
|
private String version = "";
|
||||||
// /**
|
/**
|
||||||
// * Contains the human-readable info inside the Device Security Event.
|
* Contains the human-readable info inside the Device Security Event.
|
||||||
// */
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
private String dSEDinfo = "";
|
private String dSEDinfo = "";
|
||||||
/**
|
/**
|
||||||
@ -94,7 +100,7 @@ public class DeviceSecurityEventData {
|
|||||||
byte[] versionBytes = new byte[UefiConstants.SIZE_4];
|
byte[] versionBytes = new byte[UefiConstants.SIZE_4];
|
||||||
System.arraycopy(dSEDbytes, UefiConstants.OFFSET_16, versionBytes, 0,
|
System.arraycopy(dSEDbytes, UefiConstants.OFFSET_16, versionBytes, 0,
|
||||||
UefiConstants.SIZE_4);
|
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 0x01, the event is a DEVICE_SECURITY_EVENT_DATA
|
||||||
// If version is 0x02, the event is a DEVICE_SECURITY_EVENT_DATA2
|
// If version is 0x02, the event is a DEVICE_SECURITY_EVENT_DATA2
|
||||||
|
@ -95,15 +95,20 @@ public class DeviceSecurityEventDataHeader {
|
|||||||
@Getter
|
@Getter
|
||||||
private String version = "";
|
private String version = "";
|
||||||
/**
|
/**
|
||||||
* Event Data Length.
|
* Event data length.
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
private String length = "";
|
private String length = "";
|
||||||
/**
|
/**
|
||||||
* Signature (text) data.
|
* SPDM hash algorithm.
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
private String spdmHashAlgo = "";
|
private String spdmHashAlgo = "";
|
||||||
|
/**
|
||||||
|
* Device type.
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
private String deviceType = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DeviceSecurityEventDataHeader Constructor.
|
* DeviceSecurityEventDataHeader Constructor.
|
||||||
@ -112,21 +117,32 @@ public class DeviceSecurityEventDataHeader {
|
|||||||
*/
|
*/
|
||||||
public DeviceSecurityEventDataHeader(final byte[] dSEDbytes) {
|
public DeviceSecurityEventDataHeader(final byte[] dSEDbytes) {
|
||||||
// algList = new ArrayList<>();
|
// algList = new ArrayList<>();
|
||||||
// byte[] signatureBytes = new byte[UefiConstants.SIZE_16];
|
byte[] signatureBytes = new byte[UefiConstants.SIZE_16];
|
||||||
// System.arraycopy(efiSpecId, 0, signatureBytes, 0, UefiConstants.SIZE_16);
|
System.arraycopy(dSEDbytes, 0, signatureBytes, 0, UefiConstants.SIZE_16);
|
||||||
// signature = HexUtils.byteArrayToHexString(signatureBytes);
|
//signature = HexUtils.byteArrayToHexString(signatureBytes);
|
||||||
// signature = new String(signatureBytes, StandardCharsets.UTF_8)
|
signature = new String(signatureBytes, StandardCharsets.UTF_8)
|
||||||
// .substring(0, UefiConstants.SIZE_15);
|
.substring(0, UefiConstants.SIZE_15);
|
||||||
//
|
|
||||||
// byte[] platformClassBytes = new byte[UefiConstants.SIZE_4];
|
byte[] versionBytes = new byte[UefiConstants.SIZE_4];
|
||||||
// System.arraycopy(efiSpecId, UefiConstants.OFFSET_16, platformClassBytes, 0,
|
System.arraycopy(dSEDbytes, UefiConstants.OFFSET_16, versionBytes, 0,
|
||||||
// UefiConstants.SIZE_4);
|
UefiConstants.SIZE_4);
|
||||||
// platformClass = HexUtils.byteArrayToHexString(platformClassBytes);
|
version = HexUtils.byteArrayToHexString(versionBytes);
|
||||||
//
|
|
||||||
// byte[] specVersionMinorBytes = new byte[1];
|
byte[] lengthBytes = new byte[UefiConstants.SIZE_4];
|
||||||
// System.arraycopy(efiSpecId, UefiConstants.OFFSET_20, specVersionMinorBytes, 0, 1);
|
System.arraycopy(dSEDbytes, UefiConstants.OFFSET_20, lengthBytes, 0,
|
||||||
// versionMinor = HexUtils.byteArrayToHexString(specVersionMinorBytes);
|
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];
|
// byte[] specVersionMajorBytes = new byte[1];
|
||||||
// System.arraycopy(efiSpecId, UefiConstants.OFFSET_21, specVersionMajorBytes, 0, 1);
|
// System.arraycopy(efiSpecId, UefiConstants.OFFSET_21, specVersionMajorBytes, 0, 1);
|
||||||
// versionMajor = HexUtils.byteArrayToHexString(specVersionMajorBytes);
|
// versionMajor = HexUtils.byteArrayToHexString(specVersionMajorBytes);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user