mirror of
https://github.com/nsacyber/HIRS.git
synced 2024-12-20 05:28:22 +00:00
Added some more updates
This commit is contained in:
parent
0d25599c80
commit
8c573b0bcd
@ -35,7 +35,6 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class ComponentIdentifier {
|
||||
|
||||
@ -121,7 +120,7 @@ public class ComponentIdentifier {
|
||||
this.componentRevision = componentRevision;
|
||||
this.componentManufacturerId = componentManufacturerId;
|
||||
this.fieldReplaceable = fieldReplaceable;
|
||||
this.componentAddress = componentAddress;
|
||||
this.componentAddress = componentAddress.stream().toList();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -200,6 +199,22 @@ public class ComponentIdentifier {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for the component addresses.
|
||||
* @return a collection of component addresses
|
||||
*/
|
||||
public List<ComponentAddress> getComponentAddress() {
|
||||
return componentAddress.stream().toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for the list of component addresses.
|
||||
* @param componentAddress collection of addresses
|
||||
*/
|
||||
public void setComponentAddress(List<ComponentAddress> componentAddress) {
|
||||
this.componentAddress = componentAddress.stream().toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -33,6 +33,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -335,6 +336,43 @@ public class BaseReferenceManifest extends ReferenceManifest {
|
||||
return document;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
BaseReferenceManifest that = (BaseReferenceManifest) o;
|
||||
return swidCorpus == that.swidCorpus && Objects.equals(swidName, that.swidName)
|
||||
&& Objects.equals(colloquialVersion, that.colloquialVersion)
|
||||
&& Objects.equals(product, that.product)
|
||||
&& Objects.equals(revision, that.revision)
|
||||
&& Objects.equals(edition, that.edition)
|
||||
&& Objects.equals(rimLinkHash, that.rimLinkHash)
|
||||
&& Objects.equals(bindingSpec, that.bindingSpec)
|
||||
&& Objects.equals(bindingSpecVersion, that.bindingSpecVersion)
|
||||
&& Objects.equals(platformVersion, that.platformVersion)
|
||||
&& Objects.equals(payloadType, that.payloadType)
|
||||
&& Objects.equals(pcURIGlobal, that.pcURIGlobal)
|
||||
&& Objects.equals(pcURILocal, that.pcURILocal)
|
||||
&& Objects.equals(entityName, that.entityName)
|
||||
&& Objects.equals(entityRegId, that.entityRegId)
|
||||
&& Objects.equals(entityRole, that.entityRole)
|
||||
&& Objects.equals(entityThumbprint, that.entityThumbprint)
|
||||
&& Objects.equals(linkHref, that.linkHref)
|
||||
&& Objects.equals(linkRel, that.linkRel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), swidName,
|
||||
swidCorpus, colloquialVersion, product,
|
||||
revision, edition, rimLinkHash, bindingSpec,
|
||||
bindingSpecVersion, platformVersion,
|
||||
payloadType, pcURIGlobal, pcURILocal,
|
||||
entityName, entityRegId, entityRole,
|
||||
entityThumbprint, linkHref, linkRel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("ReferenceManifest{swidName=%s,"
|
||||
|
@ -16,6 +16,7 @@ import java.security.cert.CertificateException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Sub class that will just focus on PCR Values and Events.
|
||||
@ -119,4 +120,18 @@ public class SupportReferenceManifest extends ReferenceManifest {
|
||||
public boolean isBaseSupport() {
|
||||
return !this.isSwidSupplemental() && !this.isSwidPatch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
SupportReferenceManifest that = (SupportReferenceManifest) o;
|
||||
return pcrHash == that.pcrHash && updated == that.updated && processed == that.processed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(super.hashCode(), pcrHash, updated, processed);
|
||||
}
|
||||
}
|
||||
|
@ -279,7 +279,6 @@ public class SupplyChainValidationService {
|
||||
|
||||
// check if the policy is enabled
|
||||
if (getPolicySettings().isFirmwareValidationEnabled()) {
|
||||
String[] baseline = new String[Integer.SIZE];
|
||||
String deviceName = device.getDeviceInfo()
|
||||
.getNetworkInfo().getHostname();
|
||||
|
||||
@ -293,8 +292,6 @@ public class SupplyChainValidationService {
|
||||
sRim = support;
|
||||
}
|
||||
}
|
||||
eventLog = (EventLogMeasurements) referenceManifestRepository
|
||||
.findByHexDecHash(sRim.getEventLogHash());
|
||||
|
||||
if (sRim == null) {
|
||||
fwStatus = new AppraisalStatus(FAIL,
|
||||
@ -302,16 +299,19 @@ public class SupplyChainValidationService {
|
||||
+ "No associated Support RIM file "
|
||||
+ "could be found for %s",
|
||||
deviceName));
|
||||
} else if (eventLog == null) {
|
||||
} else {
|
||||
eventLog = (EventLogMeasurements) referenceManifestRepository
|
||||
.findByHexDecHash(sRim.getEventLogHash());
|
||||
}
|
||||
if (eventLog == null) {
|
||||
fwStatus = new AppraisalStatus(FAIL,
|
||||
String.format("Firmware Quote validation failed: "
|
||||
+ "No associated Client Log file "
|
||||
+ "could be found for %s",
|
||||
deviceName));
|
||||
} else {
|
||||
baseline = sRim.getExpectedPCRList();
|
||||
String[] storedPcrs = eventLog.getExpectedPCRList();
|
||||
PcrValidator pcrValidator = new PcrValidator(baseline);
|
||||
PcrValidator pcrValidator = new PcrValidator(sRim.getExpectedPCRList());
|
||||
// grab the quote
|
||||
byte[] hash = device.getDeviceInfo().getTpmInfo().getTpmQuoteHash();
|
||||
if (pcrValidator.validateQuote(hash, storedPcrs, getPolicySettings())) {
|
||||
|
Loading…
Reference in New Issue
Block a user