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.
|
||||
*/
|
||||
String spdmBaseHashAlgoError = "";
|
||||
String spdmCertChainError = "";
|
||||
|
||||
/**
|
||||
* DeviceSecurityEventDataSubHeaderCertChain Constructor.
|
||||
@ -75,11 +75,16 @@ public class DeviceSecurityEventDataSubHeaderCertChain extends DeviceSecurityEve
|
||||
|
||||
int spdmBaseHashAlgoSize = SpdmHa.tcgAlgIdToByteSize(spdmBaseHashAlgo);
|
||||
|
||||
if(spdmBaseHashAlgoSize > 0) {
|
||||
spdmCertChain = new SpdmCertificateChain(spdmCertChainBytes, spdmBaseHashAlgoSize);
|
||||
if(spdmCertChainSize <= 0) {
|
||||
spdmCertChainError += "SPDM cert chain length is not >0, " +
|
||||
"stopping cert chain processing";
|
||||
}
|
||||
else {
|
||||
spdmBaseHashAlgoError += "SPDM base hash algorithm size is not >0";
|
||||
else if(spdmBaseHashAlgoSize <= 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";
|
||||
|
||||
// SPDM Certificate Chain output
|
||||
dsedSubHeaderInfo += spdmCertChain.toString();
|
||||
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();
|
||||
}
|
||||
|
||||
return dsedSubHeaderInfo;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user