This PR addresses the bugs identified in #314. Due to previous changes to the RIM upload process, the suppor RIM was not being updated properly when manually uploaded.

Closes #314
This commit is contained in:
Cyrus 2020-11-12 13:45:38 -05:00
parent 26fc356db0
commit 6eeb630a75
2 changed files with 21 additions and 8 deletions

View File

@ -736,7 +736,7 @@ public abstract class AbstractAttestationCertificateAuthority
String clientName = String.format("%s_%s",
dv.getHw().getManufacturer(),
dv.getHw().getProductName());
ReferenceManifest dbBaseRim;
ReferenceManifest dbBaseRim = null;
ReferenceManifest support;
String tagId = "";
String fileName = "";
@ -798,7 +798,16 @@ public abstract class AbstractAttestationCertificateAuthority
support.setTagId(tagId);
this.referenceManifestManager.save(support);
} else {
LOG.info("Client provided Support RIM already loaded in database.");
LOG.error("Client provided Support RIM already loaded in database.");
if (dbBaseRim != null) {
support.setPlatformManufacturer(dbBaseRim.getPlatformManufacturer());
support.setPlatformModel(dbBaseRim.getPlatformModel());
support.setSwidTagVersion(dbBaseRim.getSwidTagVersion());
support.setAssociatedRim(dbBaseRim.getId());
support.setTagId(dbBaseRim.getTagId());
}
this.referenceManifestManager.update(support);
}
} catch (IOException ioEx) {
LOG.error(ioEx);

View File

@ -293,8 +293,11 @@ public class ReferenceManifestDetailsPageController
final ReferenceManifestManager referenceManifestManager)
throws IOException, CertificateException, NoSuchAlgorithmException {
HashMap<String, Object> data = new HashMap<>();
EventLogMeasurements measurements = null;
if (support.getAssociatedRim() == null) {
if (support.getAssociatedRim() == null
&& (support.getPlatformManufacturer() != null
&& !support.getPlatformManufacturer().isEmpty())) {
ReferenceManifest baseRim = BaseReferenceManifest.select(referenceManifestManager)
.byManufacturer(support.getPlatformManufacturer()).getRIM();
if (baseRim != null) {
@ -305,16 +308,16 @@ public class ReferenceManifestDetailsPageController
LOGGER.error("Failed to update Support RIM", ex);
}
}
measurements = EventLogMeasurements.select(referenceManifestManager)
.byManufacturer(support.getPlatformManufacturer()).getRIM();
}
data.put("baseRim", support.getTagId());
data.put("associatedRim", support.getAssociatedRim());
data.put("rimType", support.getRimType());
data.put("tagId", support.getTagId());
TCGEventLog logProcessor = new TCGEventLog(support.getRimBytes());
EventLogMeasurements measurements = EventLogMeasurements.select(referenceManifestManager)
.byManufacturer(support.getPlatformManufacturer()).getRIM();
LinkedList<TpmPcrEvent> tpmPcrEvents = new LinkedList<>();
TCGEventLog measurementsProcess;
if (measurements != null) {
@ -327,10 +330,11 @@ public class ReferenceManifestDetailsPageController
}
tpmPcrEvents.add(tpe);
}
data.put("events", tpmPcrEvents);
} else {
data.put("events", logProcessor.getEventList());
}
data.put("events", tpmPcrEvents);
return data;
}