From 54bb37443de14e0acbcec9bbba73aa602af01232 Mon Sep 17 00:00:00 2001 From: jepenven-silabs Date: Wed, 9 Feb 2022 13:56:57 -0500 Subject: [PATCH] Add log for decryption failure --- src/transport/SessionManager.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/transport/SessionManager.cpp b/src/transport/SessionManager.cpp index ec6404727290ef..305eb359efe571 100644 --- a/src/transport/SessionManager.cpp +++ b/src/transport/SessionManager.cpp @@ -624,7 +624,11 @@ void SessionManager::SecureGroupMessageDispatch(const PacketHeader & packetHeade // Trial decryption with GroupDataProvider Credentials::GroupDataProvider::GroupSession groupContext; auto iter = groups->IterateGroupSessions(packetHeader.GetSessionId()); - VerifyOrReturn(nullptr != iter); + if (iter == nullptr) + { + ChipLogError(Inet, "Failed to retrieve Groups iterator. Discarding everything"); + return; + } System::PacketBufferHandle msgCopy; bool decrypted = false; @@ -635,7 +639,11 @@ void SessionManager::SecureGroupMessageDispatch(const PacketHeader & packetHeade (CHIP_NO_ERROR == SecureMessageCodec::Decrypt(CryptoContext(groupContext.key), payloadHeader, packetHeader, msgCopy)); } iter->Release(); - VerifyOrReturn(decrypted); + if (!decrypted) + { + ChipLogError(Inet, "Failed to retrieve Key. Discarding everything"); + return; + } msg = std::move(msgCopy); // MCSP check