mirror of
https://github.com/nsacyber/HIRS.git
synced 2024-12-18 20:47:58 +00:00
Use AppraisalStatus.additionalInfo as a flag to indicate when a EventMeasurement rim is needed.
This commit is contained in:
parent
a41b0f2fe4
commit
2e3af24ada
@ -105,7 +105,7 @@ public class SupplyChainValidation extends ArchivableEntity {
|
|||||||
this.certificatesUsed = new ArrayList<>();
|
this.certificatesUsed = new ArrayList<>();
|
||||||
this.rimId = "";
|
this.rimId = "";
|
||||||
for (ArchivableEntity ae : certificatesUsed) {
|
for (ArchivableEntity ae : certificatesUsed) {
|
||||||
if (ae instanceof BaseReferenceManifest rm) {
|
if (ae instanceof ReferenceManifest rm) {
|
||||||
this.rimId = rm.getId().toString();
|
this.rimId = rm.getId().toString();
|
||||||
break;
|
break;
|
||||||
} else if (ae instanceof Certificate) {
|
} else if (ae instanceof Certificate) {
|
||||||
|
@ -190,16 +190,22 @@ public class ValidationService {
|
|||||||
final SupplyChainValidation.ValidationType validationType
|
final SupplyChainValidation.ValidationType validationType
|
||||||
= SupplyChainValidation.ValidationType.FIRMWARE;
|
= SupplyChainValidation.ValidationType.FIRMWARE;
|
||||||
|
|
||||||
List<ReferenceManifest> rims = rimRepo.findByDeviceName(device.getName());
|
|
||||||
ReferenceManifest baseRim = null;
|
|
||||||
for (ReferenceManifest rim : rims) {
|
|
||||||
if (rim.getRimType().equals(ReferenceManifest.BASE_RIM)) {
|
|
||||||
baseRim = rim;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AppraisalStatus result = FirmwareScvValidator.validateFirmware(device, policySettings,
|
AppraisalStatus result = FirmwareScvValidator.validateFirmware(device, policySettings,
|
||||||
rimRepo, rdvRepo, caRepo);
|
rimRepo, rdvRepo, caRepo);
|
||||||
Level logLevel;
|
Level logLevel;
|
||||||
|
List<ReferenceManifest> rims = rimRepo.findByDeviceName(device.getName());
|
||||||
|
ReferenceManifest referenceManifest = null;
|
||||||
|
String rimType = "";
|
||||||
|
if (result.getAdditionalInfo().equals(ReferenceManifest.MEASUREMENT_RIM)) {
|
||||||
|
rimType = ReferenceManifest.MEASUREMENT_RIM;
|
||||||
|
} else {
|
||||||
|
rimType = ReferenceManifest.BASE_RIM;
|
||||||
|
}
|
||||||
|
for (ReferenceManifest rim : rims) {
|
||||||
|
if (rim.getRimType().equals(rimType)) {
|
||||||
|
referenceManifest = rim;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (result.getAppStatus()) {
|
switch (result.getAppStatus()) {
|
||||||
case PASS:
|
case PASS:
|
||||||
@ -213,7 +219,7 @@ public class ValidationService {
|
|||||||
logLevel = Level.ERROR;
|
logLevel = Level.ERROR;
|
||||||
}
|
}
|
||||||
return buildValidationRecord(validationType, result.getAppStatus(),
|
return buildValidationRecord(validationType, result.getAppStatus(),
|
||||||
result.getMessage(), baseRim, logLevel);
|
result.getMessage(), referenceManifest, logLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -270,7 +270,8 @@ public class FirmwareScvValidator extends SupplyChainCredentialValidator {
|
|||||||
fwStatus = new AppraisalStatus(FAIL, String.format("%s%n%s",
|
fwStatus = new AppraisalStatus(FAIL, String.format("%s%n%s",
|
||||||
fwStatus.getMessage(), sb.toString()));
|
fwStatus.getMessage(), sb.toString()));
|
||||||
} else {
|
} else {
|
||||||
fwStatus = new AppraisalStatus(FAIL, sb.toString());
|
fwStatus = new AppraisalStatus(FAIL,
|
||||||
|
sb.toString(), ReferenceManifest.MEASUREMENT_RIM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user