Merge pull request #315 from nsacyber/rim_display_error

[#314] Support RIM bug fixes
This commit is contained in:
Cyrus 2020-11-17 09:34:34 -05:00 committed by GitHub
commit 1339f2b63c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 10 deletions

View File

@ -736,7 +736,7 @@ public abstract class AbstractAttestationCertificateAuthority
String clientName = String.format("%s_%s", String clientName = String.format("%s_%s",
dv.getHw().getManufacturer(), dv.getHw().getManufacturer(),
dv.getHw().getProductName()); dv.getHw().getProductName());
ReferenceManifest dbBaseRim; ReferenceManifest dbBaseRim = null;
ReferenceManifest support; ReferenceManifest support;
String tagId = ""; String tagId = "";
String fileName = ""; String fileName = "";
@ -798,7 +798,16 @@ public abstract class AbstractAttestationCertificateAuthority
support.setTagId(tagId); support.setTagId(tagId);
this.referenceManifestManager.save(support); this.referenceManifestManager.save(support);
} else { } 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) { } catch (IOException ioEx) {
LOG.error(ioEx); LOG.error(ioEx);

View File

@ -352,11 +352,11 @@ public class SupplyChainValidationServiceImpl implements SupplyChainValidationSe
validationObject = baseReferenceManifest; validationObject = baseReferenceManifest;
String failedString = ""; String failedString = "";
if (baseReferenceManifest == null) { if (baseReferenceManifest == null) {
failedString = "Base Reference Integrity Manifest%n"; failedString = "Base Reference Integrity Manifest\n";
passed = false; passed = false;
} }
if (supportReferenceManifest == null) { if (supportReferenceManifest == null) {
failedString += "Support Reference Integrity Manifest%n"; failedString += "Support Reference Integrity Manifest\n";
passed = false; passed = false;
} }
if (measurement == null) { if (measurement == null) {

View File

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