Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

da_revocation: Make DeviceAttestationRevocationDelegate a subclass of DeviceAttestationVerifier #36758

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions examples/chip-tool/commands/common/CHIPCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ constexpr chip::FabricId kIdentityOtherFabricId = 4;
constexpr char kPAATrustStorePathVariable[] = "CHIPTOOL_PAA_TRUST_STORE_PATH";
constexpr char kCDTrustStorePathVariable[] = "CHIPTOOL_CD_TRUST_STORE_PATH";

const chip::Credentials::AttestationTrustStore * CHIPCommand::sTrustStore = nullptr;
chip::Credentials::DeviceAttestationRevocationDelegate * CHIPCommand::sRevocationDelegate = nullptr;
const chip::Credentials::AttestationTrustStore * CHIPCommand::sTrustStore = nullptr;
chip::Credentials::DeviceAttestationVerifier::DeviceAttestationRevocationDelegate * CHIPCommand::sRevocationDelegate = nullptr;

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

CHIP_ERROR GetAttestationRevocationDelegate(const char * revocationSetPath,
chip::Credentials::DeviceAttestationRevocationDelegate ** revocationDelegate)
CHIP_ERROR GetAttestationRevocationDelegate(
const char * revocationSetPath,
chip::Credentials::DeviceAttestationVerifier::DeviceAttestationRevocationDelegate ** revocationDelegate)
{
if (revocationSetPath == nullptr)
{
Expand Down
2 changes: 1 addition & 1 deletion examples/chip-tool/commands/common/CHIPCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class CHIPCommand : public Command

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

static void RunQueuedCommand(intptr_t commandArg);
typedef decltype(RunQueuedCommand) MatterWorkCallback;
Expand Down
6 changes: 3 additions & 3 deletions examples/chip-tool/commands/common/CredentialIssuerCommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ class CredentialIssuerCommands
*
* @return CHIP_ERROR CHIP_NO_ERROR on success, or corresponding error code.
*/
virtual CHIP_ERROR SetupDeviceAttestation(chip::Controller::SetupParams & setupParams,
const chip::Credentials::AttestationTrustStore * trustStore,
chip::Credentials::DeviceAttestationRevocationDelegate * revocationDelegate) = 0;
virtual CHIP_ERROR SetupDeviceAttestation(
chip::Controller::SetupParams & setupParams, const chip::Credentials::AttestationTrustStore * trustStore,
chip::Credentials::DeviceAttestationVerifier::DeviceAttestationRevocationDelegate * revocationDelegate) = 0;

/**
* @brief Add a list of additional non-default CD verifying keys (by certificate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class ExampleCredentialIssuerCommands : public CredentialIssuerCommands
{
return mOpCredsIssuer.Initialize(storage);
}
CHIP_ERROR SetupDeviceAttestation(chip::Controller::SetupParams & setupParams,
const chip::Credentials::AttestationTrustStore * trustStore,
chip::Credentials::DeviceAttestationRevocationDelegate * revocationDelegate) override
CHIP_ERROR SetupDeviceAttestation(
chip::Controller::SetupParams & setupParams, const chip::Credentials::AttestationTrustStore * trustStore,
chip::Credentials::DeviceAttestationVerifier::DeviceAttestationRevocationDelegate * revocationDelegate) override
{
chip::Credentials::SetDeviceAttestationCredentialsProvider(chip::Credentials::Examples::GetExampleDACProvider());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,9 @@ const AttestationTrustStore * GetTestAttestationTrustStore()
return &gTestAttestationTrustStore.get();
}

DeviceAttestationVerifier * GetDefaultDACVerifier(const AttestationTrustStore * paaRootStore,
DeviceAttestationRevocationDelegate * revocationDelegate)
DeviceAttestationVerifier *
GetDefaultDACVerifier(const AttestationTrustStore * paaRootStore,
DeviceAttestationVerifier::DeviceAttestationRevocationDelegate * revocationDelegate)
{
static DefaultDACVerifier defaultDACVerifier{ paaRootStore, revocationDelegate };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@ const AttestationTrustStore * GetTestAttestationTrustStore();
* process lifetime. In particular, after the first call it's not
* possible to change which AttestationTrustStore is used by this verifier.
*/
DeviceAttestationVerifier * GetDefaultDACVerifier(const AttestationTrustStore * paaRootStore,
DeviceAttestationRevocationDelegate * revocationDelegate = nullptr);
DeviceAttestationVerifier *
GetDefaultDACVerifier(const AttestationTrustStore * paaRootStore,
DeviceAttestationVerifier::DeviceAttestationRevocationDelegate * revocationDelegate = nullptr);

} // namespace Credentials
} // namespace chip
44 changes: 22 additions & 22 deletions src/credentials/attestation_verifier/DeviceAttestationVerifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,28 @@ class DeviceAttestationVerifier
typedef void (*OnAttestationInformationVerification)(void * context, const AttestationInfo & info,
AttestationVerificationResult result);

/**
* @brief Interface for checking the device attestation revocation status
*
*/
class DeviceAttestationRevocationDelegate
{
public:
DeviceAttestationRevocationDelegate() = default;
virtual ~DeviceAttestationRevocationDelegate() = default;

/**
* @brief Verify whether or not the given DAC chain is revoked.
*
* @param[in] info All of the information required to check for revoked DAC chain.
* @param[in] onCompletion Callback handler to provide Attestation Information Verification result to the caller of
* CheckForRevokedDACChain().
*/
virtual void CheckForRevokedDACChain(
const DeviceAttestationVerifier::AttestationInfo & info,
Callback::Callback<DeviceAttestationVerifier::OnAttestationInformationVerification> * onCompletion) = 0;
};

/**
* @brief Verify an attestation information payload against a DAC/PAI chain.
*
Expand Down Expand Up @@ -419,28 +441,6 @@ class DeviceAttestationVerifier
bool mEnableCdTestKeySupport = true;
};

/**
* @brief Interface for checking the device attestation revocation status
*
*/
class DeviceAttestationRevocationDelegate
{
public:
DeviceAttestationRevocationDelegate() = default;
virtual ~DeviceAttestationRevocationDelegate() = default;

/**
* @brief Verify whether or not the given DAC chain is revoked.
*
* @param[in] info All of the information required to check for revoked DAC chain.
* @param[in] onCompletion Callback handler to provide Attestation Information Verification result to the caller of
* CheckForRevokedDACChain().
*/
virtual void
CheckForRevokedDACChain(const DeviceAttestationVerifier::AttestationInfo & info,
Callback::Callback<DeviceAttestationVerifier::OnAttestationInformationVerification> * onCompletion) = 0;
};

/**
* Instance getter for the global DeviceAttestationVerifier.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
namespace chip {
namespace Credentials {

class TestDACRevocationDelegateImpl : public DeviceAttestationRevocationDelegate
class TestDACRevocationDelegateImpl : public DeviceAttestationVerifier::DeviceAttestationRevocationDelegate
{
public:
TestDACRevocationDelegateImpl() = default;
Expand Down
Loading