There was an issue with finding the support RIM with the base RIM

information.  Changed how it finds the support RIM to using the hash for
the swid resource.
This commit is contained in:
Cyrus 2023-11-07 10:05:35 -05:00
parent 433087961c
commit 548d6bb1eb

View File

@ -112,9 +112,16 @@ public class ReferenceManifestDetailsPageController extends PageController<Refer
String uuidError = "Failed to parse ID from: " + params.getId(); String uuidError = "Failed to parse ID from: " + params.getId();
messages.addError(uuidError); messages.addError(uuidError);
log.error(uuidError, iaEx); log.error(uuidError, iaEx);
} catch (Exception ioEx) { } catch (CertificateException cEx) {
log.error(cEx);
} catch (NoSuchAlgorithmException nsEx) {
log.error(nsEx);
} catch (IOException ioEx) {
log.error(ioEx); log.error(ioEx);
} catch (Exception ex) {
log.error(ex);
} }
if (data.isEmpty()) { if (data.isEmpty()) {
String notFoundMessage = "Unable to find RIM with ID: " + params.getId(); String notFoundMessage = "Unable to find RIM with ID: " + params.getId();
messages.addError(notFoundMessage); messages.addError(notFoundMessage);
@ -259,23 +266,15 @@ public class ReferenceManifestDetailsPageController extends PageController<Refer
TCGEventLog logProcessor = null; TCGEventLog logProcessor = null;
SupportReferenceManifest support = null; SupportReferenceManifest support = null;
if (baseRim.getAssociatedRim() == null) {
support = (SupportReferenceManifest) referenceManifestRepository
.getByManufacturer(baseRim.getPlatformManufacturer(),
"SupportReferenceManifest");
if (support != null) {
baseRim.setAssociatedRim(support.getId());
}
} else {
support = referenceManifestRepository
.getSupportRimEntityById(baseRim.getAssociatedRim());
}
// going to have to pull the filename and grab that from the DB // going to have to pull the filename and grab that from the DB
// to get the id to make the link // to get the id to make the link
RIM_VALIDATOR.setRim(baseRim.getRimBytes()); RIM_VALIDATOR.setRim(baseRim.getRimBytes());
for (SwidResource swidRes : resources) { for (SwidResource swidRes : resources) {
support = (SupportReferenceManifest) referenceManifestRepository.findByHexDecHash(swidRes.getHashValue());
if (support != null && swidRes.getHashValue() if (support != null && swidRes.getHashValue()
.equalsIgnoreCase(support.getHexDecHash())) { .equalsIgnoreCase(support.getHexDecHash())) {
baseRim.setAssociatedRim(support.getId());
RIM_VALIDATOR.validateSupportRimHash(support.getRimBytes(), RIM_VALIDATOR.validateSupportRimHash(support.getRimBytes(),
swidRes.getHashValue()); swidRes.getHashValue());
if (RIM_VALIDATOR.isSupportRimValid()) { if (RIM_VALIDATOR.isSupportRimValid()) {