Skip to content

Commit

Permalink
Restyled
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarmelveilleux committed Jul 7, 2022
1 parent 58a343c commit ffb451e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ bool emberAfOperationalCredentialsClusterAddNOCCallback(app::CommandHandler * co
auto nocResponse = OperationalCertStatus::kSuccess;
auto nonDefaultStatus = Status::Success;
bool needRevert = false;
int line = 0;
int line = 0;

CHIP_ERROR err = CHIP_NO_ERROR;
FabricIndex newFabricIndex = kUndefinedFabricIndex;
Expand All @@ -626,11 +626,22 @@ bool emberAfOperationalCredentialsClusterAddNOCCallback(app::CommandHandler * co

ChipLogProgress(Zcl, "OpCreds: Received an AddNOC command");

VerifyOrExit(NOCValue.size() <= Credentials::kMaxCHIPCertLength, {nonDefaultStatus = Status::InvalidCommand; line = __LINE__; });
VerifyOrExit(!ICACValue.HasValue() || ICACValue.Value().size() <= Credentials::kMaxCHIPCertLength,
{nonDefaultStatus = Status::InvalidCommand; line = __LINE__; });
VerifyOrExit(ipkValue.size() == Crypto::CHIP_CRYPTO_SYMMETRIC_KEY_LENGTH_BYTES, {nonDefaultStatus = Status::InvalidCommand; line = __LINE__; });
VerifyOrExit(IsVendorIdValidOperationally(adminVendorId), {nonDefaultStatus = Status::InvalidCommand; line = __LINE__; });
VerifyOrExit(NOCValue.size() <= Credentials::kMaxCHIPCertLength, {
nonDefaultStatus = Status::InvalidCommand;
line = __LINE__;
});
VerifyOrExit(!ICACValue.HasValue() || ICACValue.Value().size() <= Credentials::kMaxCHIPCertLength, {
nonDefaultStatus = Status::InvalidCommand;
line = __LINE__;
});
VerifyOrExit(ipkValue.size() == Crypto::CHIP_CRYPTO_SYMMETRIC_KEY_LENGTH_BYTES, {
nonDefaultStatus = Status::InvalidCommand;
line = __LINE__;
});
VerifyOrExit(IsVendorIdValidOperationally(adminVendorId), {
nonDefaultStatus = Status::InvalidCommand;
line = __LINE__;
});

VerifyOrExit(failSafeContext.IsFailSafeArmed(commandObj->GetAccessingFabricIndex()),
nonDefaultStatus = Status::FailsafeRequired);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ ChipError::StorageType pychip_GetDeviceBeingCommissioned(chip::Controller::Devic
ChipError::StorageType pychip_ExpireSessions(chip::Controller::DeviceCommissioner * devCtrl, chip::NodeId nodeId)
{
VerifyOrReturnError((devCtrl != nullptr) && (devCtrl->SessionMgr() != nullptr), CHIP_ERROR_INVALID_ARGUMENT.AsInteger());
(void)devCtrl->ReleaseOperationalDevice(nodeId);
(void) devCtrl->ReleaseOperationalDevice(nodeId);
devCtrl->SessionMgr()->ExpireAllSessions(ScopedNodeId(nodeId, devCtrl->GetFabricIndex()));
return CHIP_NO_ERROR.AsInteger();
}
Expand Down

0 comments on commit ffb451e

Please sign in to comment.