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

Mark MCSP responses as NOT_IMPLEMENTED #14853

Merged
merged 3 commits into from
Feb 8, 2022
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
26 changes: 10 additions & 16 deletions src/protocols/secure_channel/MessageCounterManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,26 +222,20 @@ CHIP_ERROR MessageCounterManager::SendMsgCounterSyncResp(Messaging::ExchangeCont
FixedByteSpan<kChallengeSize> challenge)
{
System::PacketBufferHandle msgBuf;

VerifyOrDie(exchangeContext->HasSessionHandle());

// Allocate new buffer.
msgBuf = MessagePacketBuffer::New(kSyncRespMsgSize);
VerifyOrReturnError(!msgBuf.IsNull(), CHIP_ERROR_NO_MEMORY);

{
uint8_t * msg = msgBuf->Start();
Encoding::LittleEndian::BufferWriter bbuf(msg, kSyncRespMsgSize);
bbuf.Put32(
exchangeContext->GetSessionHandle()->AsSecureSession()->GetSessionMessageCounter().GetLocalMessageCounter().Value());
bbuf.Put(challenge.data(), kChallengeSize);
VerifyOrReturnError(bbuf.Fit(), CHIP_ERROR_NO_MEMORY);
}
VerifyOrReturnError(exchangeContext->GetSessionHandle()->GetSessionType() == Transport::Session::SessionType::kGroup,
CHIP_ERROR_INVALID_ARGUMENT);

msgBuf->SetDataLength(kSyncRespMsgSize);
// NOTE: not currently implemented. When implementing, the following should be done:
// - allocate a new buffer: MessagePacketBuffer::New
// - setup payload and place the local message counter + challange in it
// - exchangeContext->SendMessage(Protocols::SecureChannel::MsgType::MsgCounterSyncRsp, ...)
//
// You can view the history of this file for a partial implementation that got
// removed due to it using non-group sessions.

return exchangeContext->SendMessage(Protocols::SecureChannel::MsgType::MsgCounterSyncRsp, std::move(msgBuf),
Messaging::SendFlags(Messaging::SendMessageFlags::kNoAutoRequestAck));
return CHIP_ERROR_NOT_IMPLEMENTED;
}

CHIP_ERROR MessageCounterManager::HandleMsgCounterSyncReq(Messaging::ExchangeContext * exchangeContext,
Expand Down