Skip to content

Commit 8499c82

Browse files
committed
da_revocation: Make DeviceAttestationRevocationDelegate a subclass of DeviceAttestationVerifier
1 parent 84fb78f commit 8499c82

8 files changed

+41
-38
lines changed

examples/chip-tool/commands/common/CHIPCommand.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ constexpr chip::FabricId kIdentityOtherFabricId = 4;
5050
constexpr char kPAATrustStorePathVariable[] = "CHIPTOOL_PAA_TRUST_STORE_PATH";
5151
constexpr char kCDTrustStorePathVariable[] = "CHIPTOOL_CD_TRUST_STORE_PATH";
5252

53-
const chip::Credentials::AttestationTrustStore * CHIPCommand::sTrustStore = nullptr;
54-
chip::Credentials::DeviceAttestationRevocationDelegate * CHIPCommand::sRevocationDelegate = nullptr;
53+
const chip::Credentials::AttestationTrustStore * CHIPCommand::sTrustStore = nullptr;
54+
chip::Credentials::DeviceAttestationVerifier::DeviceAttestationRevocationDelegate * CHIPCommand::sRevocationDelegate = nullptr;
5555

5656
chip::Credentials::GroupDataProviderImpl CHIPCommand::sGroupDataProvider{ kMaxGroupsPerFabric, kMaxGroupKeysPerFabric };
5757
// All fabrics share the same ICD client storage.
@@ -91,8 +91,9 @@ CHIP_ERROR GetAttestationTrustStore(const char * paaTrustStorePath, const chip::
9191
return CHIP_NO_ERROR;
9292
}
9393

94-
CHIP_ERROR GetAttestationRevocationDelegate(const char * revocationSetPath,
95-
chip::Credentials::DeviceAttestationRevocationDelegate ** revocationDelegate)
94+
CHIP_ERROR GetAttestationRevocationDelegate(
95+
const char * revocationSetPath,
96+
chip::Credentials::DeviceAttestationVerifier::DeviceAttestationRevocationDelegate ** revocationDelegate)
9697
{
9798
if (revocationSetPath == nullptr)
9899
{

examples/chip-tool/commands/common/CHIPCommand.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ class CHIPCommand : public Command
234234

235235
// Cached DAC revocation delegate, this can be set using "--dac-revocation-set-path" argument
236236
// Once set this will be used by all commands.
237-
static chip::Credentials::DeviceAttestationRevocationDelegate * sRevocationDelegate;
237+
static chip::Credentials::DeviceAttestationVerifier::DeviceAttestationRevocationDelegate * sRevocationDelegate;
238238

239239
static void RunQueuedCommand(intptr_t commandArg);
240240
typedef decltype(RunQueuedCommand) MatterWorkCallback;

examples/chip-tool/commands/common/CredentialIssuerCommands.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ class CredentialIssuerCommands
6161
*
6262
* @return CHIP_ERROR CHIP_NO_ERROR on success, or corresponding error code.
6363
*/
64-
virtual CHIP_ERROR SetupDeviceAttestation(chip::Controller::SetupParams & setupParams,
65-
const chip::Credentials::AttestationTrustStore * trustStore,
66-
chip::Credentials::DeviceAttestationRevocationDelegate * revocationDelegate) = 0;
64+
virtual CHIP_ERROR SetupDeviceAttestation(
65+
chip::Controller::SetupParams & setupParams, const chip::Credentials::AttestationTrustStore * trustStore,
66+
chip::Credentials::DeviceAttestationVerifier::DeviceAttestationRevocationDelegate * revocationDelegate) = 0;
6767

6868
/**
6969
* @brief Add a list of additional non-default CD verifying keys (by certificate)

examples/chip-tool/commands/example/ExampleCredentialIssuerCommands.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ class ExampleCredentialIssuerCommands : public CredentialIssuerCommands
3333
{
3434
return mOpCredsIssuer.Initialize(storage);
3535
}
36-
CHIP_ERROR SetupDeviceAttestation(chip::Controller::SetupParams & setupParams,
37-
const chip::Credentials::AttestationTrustStore * trustStore,
38-
chip::Credentials::DeviceAttestationRevocationDelegate * revocationDelegate) override
36+
CHIP_ERROR SetupDeviceAttestation(
37+
chip::Controller::SetupParams & setupParams, const chip::Credentials::AttestationTrustStore * trustStore,
38+
chip::Credentials::DeviceAttestationVerifier::DeviceAttestationRevocationDelegate * revocationDelegate) override
3939
{
4040
chip::Credentials::SetDeviceAttestationCredentialsProvider(chip::Credentials::Examples::GetExampleDACProvider());
4141

src/credentials/attestation_verifier/DefaultDeviceAttestationVerifier.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -696,8 +696,9 @@ const AttestationTrustStore * GetTestAttestationTrustStore()
696696
return &gTestAttestationTrustStore.get();
697697
}
698698

699-
DeviceAttestationVerifier * GetDefaultDACVerifier(const AttestationTrustStore * paaRootStore,
700-
DeviceAttestationRevocationDelegate * revocationDelegate)
699+
DeviceAttestationVerifier *
700+
GetDefaultDACVerifier(const AttestationTrustStore * paaRootStore,
701+
DeviceAttestationVerifier::DeviceAttestationRevocationDelegate * revocationDelegate)
701702
{
702703
static DefaultDACVerifier defaultDACVerifier{ paaRootStore, revocationDelegate };
703704

src/credentials/attestation_verifier/DefaultDeviceAttestationVerifier.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,9 @@ const AttestationTrustStore * GetTestAttestationTrustStore();
122122
* process lifetime. In particular, after the first call it's not
123123
* possible to change which AttestationTrustStore is used by this verifier.
124124
*/
125-
DeviceAttestationVerifier * GetDefaultDACVerifier(const AttestationTrustStore * paaRootStore,
126-
DeviceAttestationRevocationDelegate * revocationDelegate = nullptr);
125+
DeviceAttestationVerifier *
126+
GetDefaultDACVerifier(const AttestationTrustStore * paaRootStore,
127+
DeviceAttestationVerifier::DeviceAttestationRevocationDelegate * revocationDelegate = nullptr);
127128

128129
} // namespace Credentials
129130
} // namespace chip

src/credentials/attestation_verifier/DeviceAttestationVerifier.h

+22-22
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,28 @@ class DeviceAttestationVerifier
333333
typedef void (*OnAttestationInformationVerification)(void * context, const AttestationInfo & info,
334334
AttestationVerificationResult result);
335335

336+
/**
337+
* @brief Interface for checking the device attestation revocation status
338+
*
339+
*/
340+
class DeviceAttestationRevocationDelegate
341+
{
342+
public:
343+
DeviceAttestationRevocationDelegate() = default;
344+
virtual ~DeviceAttestationRevocationDelegate() = default;
345+
346+
/**
347+
* @brief Verify whether or not the given DAC chain is revoked.
348+
*
349+
* @param[in] info All of the information required to check for revoked DAC chain.
350+
* @param[in] onCompletion Callback handler to provide Attestation Information Verification result to the caller of
351+
* CheckForRevokedDACChain().
352+
*/
353+
virtual void CheckForRevokedDACChain(
354+
const DeviceAttestationVerifier::AttestationInfo & info,
355+
Callback::Callback<DeviceAttestationVerifier::OnAttestationInformationVerification> * onCompletion) = 0;
356+
};
357+
336358
/**
337359
* @brief Verify an attestation information payload against a DAC/PAI chain.
338360
*
@@ -419,28 +441,6 @@ class DeviceAttestationVerifier
419441
bool mEnableCdTestKeySupport = true;
420442
};
421443

422-
/**
423-
* @brief Interface for checking the device attestation revocation status
424-
*
425-
*/
426-
class DeviceAttestationRevocationDelegate
427-
{
428-
public:
429-
DeviceAttestationRevocationDelegate() = default;
430-
virtual ~DeviceAttestationRevocationDelegate() = default;
431-
432-
/**
433-
* @brief Verify whether or not the given DAC chain is revoked.
434-
*
435-
* @param[in] info All of the information required to check for revoked DAC chain.
436-
* @param[in] onCompletion Callback handler to provide Attestation Information Verification result to the caller of
437-
* CheckForRevokedDACChain().
438-
*/
439-
virtual void
440-
CheckForRevokedDACChain(const DeviceAttestationVerifier::AttestationInfo & info,
441-
Callback::Callback<DeviceAttestationVerifier::OnAttestationInformationVerification> * onCompletion) = 0;
442-
};
443-
444444
/**
445445
* Instance getter for the global DeviceAttestationVerifier.
446446
*

src/credentials/attestation_verifier/TestDACRevocationDelegateImpl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
namespace chip {
2727
namespace Credentials {
2828

29-
class TestDACRevocationDelegateImpl : public DeviceAttestationRevocationDelegate
29+
class TestDACRevocationDelegateImpl : public DeviceAttestationVerifier::DeviceAttestationRevocationDelegate
3030
{
3131
public:
3232
TestDACRevocationDelegateImpl() = default;

0 commit comments

Comments
 (0)