From ffb451e48a1271baee3692d5ff6567c4b00e56e9 Mon Sep 17 00:00:00 2001 From: Tennessee Carmel-Veilleux Date: Thu, 7 Jul 2022 19:33:03 -0400 Subject: [PATCH] Restyled --- .../operational-credentials-server.cpp | 23 ++++++++++++++----- .../ChipDeviceController-ScriptBinding.cpp | 2 +- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp index 19c68ba82f9f9d..f93b95f340fd41 100644 --- a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp +++ b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp @@ -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; @@ -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); diff --git a/src/controller/python/ChipDeviceController-ScriptBinding.cpp b/src/controller/python/ChipDeviceController-ScriptBinding.cpp index 88874fa8be9b8a..54d45f082fedab 100644 --- a/src/controller/python/ChipDeviceController-ScriptBinding.cpp +++ b/src/controller/python/ChipDeviceController-ScriptBinding.cpp @@ -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(); }