|
21 | 21 | #include <commands/icd/ICDCommand.h>
|
22 | 22 | #include <controller/CHIPDeviceControllerFactory.h>
|
23 | 23 | #include <credentials/attestation_verifier/FileAttestationTrustStore.h>
|
| 24 | +#include <credentials/attestation_verifier/TestDACRevocationDelegateImpl.h> |
24 | 25 | #include <lib/core/CHIPConfig.h>
|
25 | 26 | #include <lib/core/CHIPVendorIdentifiers.hpp>
|
26 | 27 | #include <lib/support/CodeUtils.h>
|
@@ -48,7 +49,9 @@ constexpr chip::FabricId kIdentityOtherFabricId = 4;
|
48 | 49 | constexpr char kPAATrustStorePathVariable[] = "CHIPTOOL_PAA_TRUST_STORE_PATH";
|
49 | 50 | constexpr char kCDTrustStorePathVariable[] = "CHIPTOOL_CD_TRUST_STORE_PATH";
|
50 | 51 |
|
51 |
| -const chip::Credentials::AttestationTrustStore * CHIPCommand::sTrustStore = nullptr; |
| 52 | +const chip::Credentials::AttestationTrustStore * CHIPCommand::sTrustStore = nullptr; |
| 53 | +chip::Credentials::DeviceAttestationRevocationDelegate * CHIPCommand::sRevocationDelegate = nullptr; |
| 54 | + |
52 | 55 | chip::Credentials::GroupDataProviderImpl CHIPCommand::sGroupDataProvider{ kMaxGroupsPerFabric, kMaxGroupKeysPerFabric };
|
53 | 56 | // All fabrics share the same ICD client storage.
|
54 | 57 | chip::app::DefaultICDClientStorage CHIPCommand::sICDClientStorage;
|
@@ -87,6 +90,20 @@ CHIP_ERROR GetAttestationTrustStore(const char * paaTrustStorePath, const chip::
|
87 | 90 | return CHIP_NO_ERROR;
|
88 | 91 | }
|
89 | 92 |
|
| 93 | +CHIP_ERROR GetAttestationRevocationDelegate(const char * revocationSetPath, |
| 94 | + chip::Credentials::DeviceAttestationRevocationDelegate ** revocationDelegate) |
| 95 | +{ |
| 96 | + if (revocationSetPath == nullptr) |
| 97 | + { |
| 98 | + return CHIP_NO_ERROR; |
| 99 | + } |
| 100 | + |
| 101 | + static chip::Credentials::TestDACRevocationDelegateImpl testDacRevocationDelegate; |
| 102 | + ReturnErrorOnFailure(testDacRevocationDelegate.SetDeviceAttestationRevocationSetPath(revocationSetPath)); |
| 103 | + *revocationDelegate = &testDacRevocationDelegate; |
| 104 | + return CHIP_NO_ERROR; |
| 105 | +} |
| 106 | + |
90 | 107 | } // namespace
|
91 | 108 |
|
92 | 109 | CHIP_ERROR CHIPCommand::MaybeSetUpStack()
|
@@ -151,6 +168,8 @@ CHIP_ERROR CHIPCommand::MaybeSetUpStack()
|
151 | 168 |
|
152 | 169 | ReturnErrorOnFailure(GetAttestationTrustStore(mPaaTrustStorePath.ValueOr(nullptr), &sTrustStore));
|
153 | 170 |
|
| 171 | + ReturnLogErrorOnFailure(GetAttestationRevocationDelegate(mDacRevocationSetPath.ValueOr(nullptr), &sRevocationDelegate)); |
| 172 | + |
154 | 173 | auto engine = chip::app::InteractionModelEngine::GetInstance();
|
155 | 174 | VerifyOrReturnError(engine != nullptr, CHIP_ERROR_INCORRECT_STATE);
|
156 | 175 | ReturnLogErrorOnFailure(ChipToolCheckInDelegate()->Init(&sICDClientStorage, engine));
|
@@ -450,7 +469,7 @@ CHIP_ERROR CHIPCommand::InitializeCommissioner(CommissionerIdentity & identity,
|
450 | 469 | std::unique_ptr<ChipDeviceCommissioner> commissioner = std::make_unique<ChipDeviceCommissioner>();
|
451 | 470 | chip::Controller::SetupParams commissionerParams;
|
452 | 471 |
|
453 |
| - ReturnLogErrorOnFailure(mCredIssuerCmds->SetupDeviceAttestation(commissionerParams, sTrustStore)); |
| 472 | + ReturnLogErrorOnFailure(mCredIssuerCmds->SetupDeviceAttestation(commissionerParams, sTrustStore, sRevocationDelegate)); |
454 | 473 |
|
455 | 474 | chip::Crypto::P256Keypair ephemeralKey;
|
456 | 475 |
|
|
0 commit comments