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 and pull[bot] committed Feb 3, 2024
1 parent b19b74f commit f9d4cfb
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 f9d4cfb

Please sign in to comment.