Merge pull request #469 from nsacyber/issue-468

[#468] Platform Manufacturer causes 500 error
This commit is contained in:
Cyrus 2022-04-12 09:52:32 -04:00 committed by GitHub
commit 5088bf7107
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -225,17 +225,8 @@ public class ReferenceManifestPageController
}); });
supportRims.stream().forEach((rim) -> { supportRims.stream().forEach((rim) -> {
LOGGER.info(String.format("Storing event log %s", rim.getFileName())); LOGGER.info(String.format("Storing event log %s", rim.getFileName()));
storeManifest(messages, rim, false);
});
for (ReferenceManifest rim : baseRims) {
// store first then update
storeManifest(messages, rim, false);
}
for (ReferenceManifest rim : supportRims) {
// store the rimels
storeManifest(messages, rim, true); storeManifest(messages, rim, true);
} });
// Prep a map to associated the swidtag payload hash to the swidtag. // Prep a map to associated the swidtag payload hash to the swidtag.
// pass it in to update support rims that either were uploaded // pass it in to update support rims that either were uploaded
@ -657,33 +648,35 @@ public class ReferenceManifestPageController
// So first we'll have to pull values based on support rim // So first we'll have to pull values based on support rim
// get by support rim id NEXT // get by support rim id NEXT
tpmEvents = referenceEventManager.getValuesByRimId(dbSupport); if (dbSupport.getPlatformManufacturer() != null) {
baseRim = findBaseRim(dbSupport); tpmEvents = referenceEventManager.getValuesByRimId(dbSupport);
if (tpmEvents.isEmpty()) { baseRim = findBaseRim(dbSupport);
ReferenceDigestValue rdv; if (tpmEvents.isEmpty()) {
try { ReferenceDigestValue rdv;
logProcessor = new TCGEventLog(dbSupport.getRimBytes()); try {
for (TpmPcrEvent tpe : logProcessor.getEventList()) { logProcessor = new TCGEventLog(dbSupport.getRimBytes());
rdv = new ReferenceDigestValue(baseRim.getId(), for (TpmPcrEvent tpe : logProcessor.getEventList()) {
dbSupport.getId(), dbSupport.getPlatformManufacturer(), rdv = new ReferenceDigestValue(baseRim.getId(),
dbSupport.getPlatformModel(), tpe.getPcrIndex(), dbSupport.getId(), dbSupport.getPlatformManufacturer(),
tpe.getEventDigestStr(), tpe.getEventTypeStr(), dbSupport.getPlatformModel(), tpe.getPcrIndex(),
false, false, updated, tpe.getEventContent()); tpe.getEventDigestStr(), tpe.getEventTypeStr(),
false, false, updated, tpe.getEventContent());
this.referenceEventManager.saveValue(rdv); this.referenceEventManager.saveValue(rdv);
}
} catch (CertificateException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} }
} catch (CertificateException e) { } else {
e.printStackTrace(); for (ReferenceDigestValue rdv : tpmEvents) {
} catch (NoSuchAlgorithmException e) { if (!rdv.isUpdated()) {
e.printStackTrace(); rdv.updateInfo(dbSupport, baseRim.getId());
} catch (IOException e) { this.referenceEventManager.updateEvent(rdv);
e.printStackTrace(); }
}
} else {
for (ReferenceDigestValue rdv : tpmEvents) {
if (!rdv.isUpdated()) {
rdv.updateInfo(dbSupport, baseRim.getId());
this.referenceEventManager.updateEvent(rdv);
} }
} }
} }