mirror of
https://github.com/nsacyber/HIRS.git
synced 2024-12-18 20:47:58 +00:00
checking null object
This commit is contained in:
parent
d858246ce0
commit
a5b9cd7ad9
@ -42,7 +42,7 @@ public class DeviceSecurityEventDataSubHeaderCertChain extends DeviceSecurityEve
|
|||||||
/**
|
/**
|
||||||
* Human-readable description of any error associated with SPDM base hash alg.
|
* Human-readable description of any error associated with SPDM base hash alg.
|
||||||
*/
|
*/
|
||||||
String spdmBaseHashAlgoError = "";
|
String spdmCertChainError = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DeviceSecurityEventDataSubHeaderCertChain Constructor.
|
* DeviceSecurityEventDataSubHeaderCertChain Constructor.
|
||||||
@ -75,11 +75,16 @@ public class DeviceSecurityEventDataSubHeaderCertChain extends DeviceSecurityEve
|
|||||||
|
|
||||||
int spdmBaseHashAlgoSize = SpdmHa.tcgAlgIdToByteSize(spdmBaseHashAlgo);
|
int spdmBaseHashAlgoSize = SpdmHa.tcgAlgIdToByteSize(spdmBaseHashAlgo);
|
||||||
|
|
||||||
if(spdmBaseHashAlgoSize > 0) {
|
if(spdmCertChainSize <= 0) {
|
||||||
spdmCertChain = new SpdmCertificateChain(spdmCertChainBytes, spdmBaseHashAlgoSize);
|
spdmCertChainError += "SPDM cert chain length is not >0, " +
|
||||||
|
"stopping cert chain processing";
|
||||||
}
|
}
|
||||||
else {
|
else if(spdmBaseHashAlgoSize <= 0) {
|
||||||
spdmBaseHashAlgoError += "SPDM base hash algorithm size is not >0";
|
spdmCertChainError += "SPDM base hash algorithm size is not >0 " +
|
||||||
|
"stopping cert chain processing";
|
||||||
|
}
|
||||||
|
if(spdmCertChainError.isEmpty()) {
|
||||||
|
spdmCertChain = new SpdmCertificateChain(spdmCertChainBytes, spdmBaseHashAlgoSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +101,15 @@ public class DeviceSecurityEventDataSubHeaderCertChain extends DeviceSecurityEve
|
|||||||
dsedSubHeaderInfo += " SPDM Base Hash Algorithm = " + spdmBaseHashAlgoStr + "\n";
|
dsedSubHeaderInfo += " SPDM Base Hash Algorithm = " + spdmBaseHashAlgoStr + "\n";
|
||||||
|
|
||||||
// SPDM Certificate Chain output
|
// SPDM Certificate Chain output
|
||||||
|
if(!spdmCertChainError.isEmpty()) {
|
||||||
|
dsedSubHeaderInfo += " SPDM cert chain error: " + spdmCertChainError;
|
||||||
|
}
|
||||||
|
else if(spdmCertChain == null) {
|
||||||
|
dsedSubHeaderInfo += " SPDM cert chain error: Could not parse cert chain\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
dsedSubHeaderInfo += spdmCertChain.toString();
|
dsedSubHeaderInfo += spdmCertChain.toString();
|
||||||
|
}
|
||||||
|
|
||||||
return dsedSubHeaderInfo;
|
return dsedSubHeaderInfo;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user