Skip to content

Commit

Permalink
Add log for decryption failure (#14970)
Browse files Browse the repository at this point in the history
  • Loading branch information
jepenven-silabs authored Feb 9, 2022
1 parent 1744422 commit 98d1e33
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/transport/SessionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit 98d1e33

Please sign in to comment.