Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add log for decryption failure #14970

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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