diff --git a/src/protocols/secure_channel/MessageCounterManager.cpp b/src/protocols/secure_channel/MessageCounterManager.cpp index 4ccf8a0960a10d..a94c1b50dc5511 100644 --- a/src/protocols/secure_channel/MessageCounterManager.cpp +++ b/src/protocols/secure_channel/MessageCounterManager.cpp @@ -222,26 +222,20 @@ CHIP_ERROR MessageCounterManager::SendMsgCounterSyncResp(Messaging::ExchangeCont FixedByteSpan 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,