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 c1c7320e..b2f63ba4 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 @@ -72,11 +72,11 @@ public class DeviceSecurityEventData2 extends DeviceSecurityEvent { subHeaderInfo += dsedSubHeader.toString(); } catch(NullPointerException e) { - subHeaderInfo = "\n Could not interpret Sub header info for SPDM measurment block"; + subHeaderInfo = "\n Could not interpret Sub header info for SPDM measurment block"; } } else if (subHeaderType == DeviceSecurityEventDataSubHeader.SUBHEADERTYPE_CERT_CHAIN) { - subHeaderInfo += "\n Cert chain to be implemented "; + subHeaderInfo += "\n Cert chain to be implemented "; try { dsedSubHeader = new DeviceSecurityEventDataSubHeaderCertChain(dsedSubHeaderBytes); 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 3b0f6761..56934fef 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 @@ -39,6 +39,8 @@ public class DeviceSecurityEventDataHeader2 extends DeviceSecurityEventHeader { private int length = 0; /** * Event sub headerType + * SUBHEADERTYPE_MEAS_BLOCK = 0 + * SUBHEADERTYPE_CERT_CHAIN = 1 */ @Getter private int subHeaderType = 0; diff --git a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataSubHeaderCertChain.java b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataSubHeaderCertChain.java index 45c9e722..eac5bc8a 100644 --- a/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataSubHeaderCertChain.java +++ b/HIRS_Utils/src/main/java/hirs/utils/tpm/eventlog/events/DeviceSecurityEventDataSubHeaderCertChain.java @@ -1,6 +1,7 @@ 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 lombok.Getter; @@ -75,4 +76,28 @@ public class DeviceSecurityEventDataSubHeaderCertChain extends DeviceSecurityEve // spdmMeasurementBlockList.add(spdmMeasurementBlock); // } } + + + /** + * Returns a human-readable description of the data within this structure. + * + * @return a description of this structure. + */ + public String toString() { + String dsedSubHeaderInfo = ""; +// dsedSubHeaderInfo += "\n SPDM Version: " + spdmVersion; +// String spdmHashAlgoStr = SpdmHa.tcgAlgIdToString(spdmMeasurementHashAlgo); +// dsedSubHeaderInfo += "\n SPDM Hash Algorithm = " + spdmHashAlgoStr; +// +// // SPDM Measurement Block List output +// dsedSubHeaderInfo += "\n Number of SPDM Measurement Blocks = " + spdmMeasurementBlockList.size(); +// int spdmMeasBlockCnt = 1; +// for (SpdmMeasurementBlock spdmMeasBlock : spdmMeasurementBlockList) { +// dsedSubHeaderInfo += "\n SPDM Measurement Block # " + spdmMeasBlockCnt++ + " of " + +// spdmMeasurementBlockList.size(); +// dsedSubHeaderInfo += spdmMeasBlock.toString(); +// } + + return dsedSubHeaderInfo; + } }