Skip to content

Commit

Permalink
Print error messages to log and ACA frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
chubtub committed Jan 17, 2025
1 parent 9bd42ff commit 3c2df82
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public static AppraisalStatus validateFirmware(
String hostName = device.getDeviceInfo().getNetworkInfo().getHostname();
BaseReferenceManifest baseReferenceManifest = null;
EventLogMeasurements measurement = null;
log.info("Validating firmware...");

// This block was looking for a base RIM matching the device name
// The base rim might not have a device name associated with it- i.e. if it's uploaded to the ACA
Expand Down Expand Up @@ -114,15 +115,19 @@ public static AppraisalStatus validateFirmware(
referenceManifestRepository.save(eventLog);
fwStatus = new AppraisalStatus(PASS, SupplyChainCredentialValidator.FIRMWARE_VALID);
} else {
failedString = pcrStatus.getMessage();
log.warn("PCR value validation failed: " + failedString);
passed = false;
}
} else {
failedString = rimSignatureStatus.getMessage();
log.warn("RIM signature validation failed: " + failedString);
passed = false;
}
}
if (!passed) {
fwStatus = new AppraisalStatus(FAIL, String.format("Firmware Validation failed: "
+ "%s for %s can not be found", failedString, hostName));
+ "%s for %s cannot be found", failedString, hostName));
if (measurement != null) {
measurement.setOverallValidationResult(fwStatus.getAppStatus());
referenceManifestRepository.save(measurement);
Expand All @@ -139,6 +144,7 @@ private static AppraisalStatus validateRimSignature(
baseReferenceManifest.getFileResources();
AppraisalStatus rimSignatureStatus = new AppraisalStatus(PASS, "RIM signature valid.");
boolean passed = true;
log.info("Validating RIM signature...");

// verify signatures
ReferenceManifestValidator referenceManifestValidator =
Expand Down Expand Up @@ -246,6 +252,8 @@ private static AppraisalStatus validatePcrValues(
String[] baseline = new String[Integer.SIZE];
TCGEventLog logProcessor;
AppraisalStatus pcrAppraisalStatus = new AppraisalStatus(PASS, "PCR values validated.");
log.info("Validating PCR values...");

try {
logProcessor = new TCGEventLog(supportReferenceManifest.getRimBytes());
baseline = logProcessor.getExpectedPCRValues();
Expand Down

0 comments on commit 3c2df82

Please sign in to comment.