From 3208241cc3de7a7f72e2dee50927ad63eb3dc56b Mon Sep 17 00:00:00 2001 From: Cyrus <24922493+cyrus-dev@users.noreply.github.com> Date: Mon, 24 Jun 2019 13:02:01 -0400 Subject: [PATCH] [#162] Attribute match fix (#165) * Updated code by removing a loop that wasn't necessary. It was supposed to filter out the deltas but this wasn't needed as the chain was established. * The debug code was left in, this is now removed. --- .../SupplyChainCredentialValidator.java | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/HIRS_Utils/src/main/java/hirs/validation/SupplyChainCredentialValidator.java b/HIRS_Utils/src/main/java/hirs/validation/SupplyChainCredentialValidator.java index dbb8752e..3aaba8b8 100644 --- a/HIRS_Utils/src/main/java/hirs/validation/SupplyChainCredentialValidator.java +++ b/HIRS_Utils/src/main/java/hirs/validation/SupplyChainCredentialValidator.java @@ -304,7 +304,6 @@ public final class SupplyChainCredentialValidator implements CredentialValidator // parse out the provided delta and its specific chain. Collections.reverse(chainCertificates); List leafChain = new LinkedList<>(); - PlatformCredential dc; List origPcComponents = new LinkedList<>(); for (PlatformCredential pc : chainCertificates) { @@ -315,8 +314,7 @@ public final class SupplyChainCredentialValidator implements CredentialValidator origPcComponents.addAll(pc.getComponentIdentifiers()); } } else { - dc = pc; - leafChain.add(dc); + leafChain.add(pc); } } @@ -326,24 +324,6 @@ public final class SupplyChainCredentialValidator implements CredentialValidator leafMap.put(delta.getHolderSerialNumber().toString(), delta); }); - leafChain.clear(); - String serialNumber = basePlatformCredential.getSerialNumber().toString(); - PlatformCredential tempCred; - - // Start with the base serial number, find the delta pointing to it - // and put that first in the list - for (int i = 0; i < leafMap.size(); i++) { - tempCred = leafMap.get(serialNumber); - // this should never be null - if (tempCred != null) { - leafChain.add(i, tempCred); - serialNumber = tempCred.getSerialNumber().toString(); - } else { - return new AppraisalStatus(ERROR, String.format("Delta platform search " - + "for mapping returned null for %s", serialNumber)); - } - } - return validateDeltaAttributesChainV2p0(deviceInfoReport, leafChain, origPcComponents); } @@ -613,7 +593,6 @@ public final class SupplyChainCredentialValidator implements CredentialValidator if (ci.isVersion2()) { ciSerial = ci.getComponentSerial().toString(); ComponentIdentifierV2 ciV2 = (ComponentIdentifierV2) ci; - if (ciV2.isModified()) { // this won't match // check it is there