-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added mechanism to override device attestation failure based on clien…
…t/user (#17028) * Added mechanism to override device attestation failure based on client/user input Fixes #16681 Change overview Added delegates that can be optionally set by the client of the SDK. When the device attestation delegate is set and when a DA failure is encountered during commissioning, the delegate is invoked letting the client decide on the behavior to either ignore the error and continue commissioning or fail the commissioning. The arm failsafe timer can also be adjusted by the client to handle any delays due to user input. Testing Flashed an M5 with the changes. Used the iOS CHIPTool with the changes and verified no regression in current commissioning process when the delegate is either setup or not. Modified the kTestPaaRoots array in DefaultDeviceAttestationVerifier.cpp to be empty causing DA failure. Verified the dialog is presented to the user and that commissioning succeeds with error is ignored and fails when the user declines to proceed. * Restyled by whitespace * Restyled by clang-format * Restyled by gn * Fixed linker error for chip-tool-darwin * Restyled by gn * Changed CHIPDeviceAttestationDelegate delegate call to match Obj-C API conventions * Restyled by clang-format * Switched to passing DeviceProxy* in DA delegate methods * Restyled by clang-format * Apply suggestions from code review Co-authored-by: Boris Zbarsky <[email protected]> * Restyled by whitespace * Restyled by clang-format Co-authored-by: Restyled.io <[email protected]> Co-authored-by: Boris Zbarsky <[email protected]>
- Loading branch information
Showing
17 changed files
with
503 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/credentials/attestation_verifier/DeviceAttestationDelegate.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* | ||
* Copyright (c) 2021 Project CHIP Authors | ||
* All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <credentials/attestation_verifier/DeviceAttestationVerifier.h> | ||
#include <lib/core/Optional.h> | ||
|
||
namespace chip { | ||
|
||
class DeviceProxy; | ||
|
||
namespace Controller { | ||
class DeviceCommissioner; | ||
} // namespace Controller | ||
|
||
namespace Credentials { | ||
|
||
/// Callbacks for CHIP device attestation status | ||
class DeviceAttestationDelegate | ||
{ | ||
public: | ||
virtual ~DeviceAttestationDelegate() {} | ||
|
||
/** | ||
* @brief | ||
* If valid, value to set for the fail-safe timer before the delegate's OnDeviceAttestionFailed is invoked. | ||
* | ||
* @return Optional value for the fail-safe timer in seconds. | ||
*/ | ||
virtual Optional<uint16_t> FailSafeExpiryTimeoutSecs() const = 0; | ||
|
||
/** | ||
* @brief | ||
* This method is invoked when device attestation fails for a device that is being commissioned. The client | ||
* handling the failure has the option to continue commissionning or fail the operation. | ||
* | ||
* @param deviceCommissioner The commissioner object that is commissioning the device | ||
* @param device The proxy represent the device being commissioned | ||
* @param attestationResult The failure code for the device attestation validation operation | ||
*/ | ||
virtual void OnDeviceAttestationFailed(Controller::DeviceCommissioner * deviceCommissioner, DeviceProxy * device, | ||
AttestationVerificationResult attestationResult) = 0; | ||
}; | ||
|
||
} // namespace Credentials | ||
} // namespace chip |
Oops, something went wrong.