diff --git a/src/controller/CommissioneeDeviceProxy.cpp b/src/controller/CommissioneeDeviceProxy.cpp index f91d17e8ab3e3c..9ce7c425895751 100644 --- a/src/controller/CommissioneeDeviceProxy.cpp +++ b/src/controller/CommissioneeDeviceProxy.cpp @@ -90,19 +90,6 @@ void CommissioneeDeviceProxy::OnNewConnection(SessionHandle session) { mState = ConnectionState::SecureConnected; mSecureSession.SetValue(session); - - // Reset the message counters here because this is the first time we get a handle to the secure session. - // Since CHIPDevices can be serialized/deserialized in the middle of what is conceptually a single PASE session - // we need to restore the session counters along with the session information. - Transport::SecureSession * secureSession = mSessionManager->GetSecureSession(mSecureSession.Value()); - VerifyOrReturn(secureSession != nullptr); - MessageCounter & localCounter = secureSession->GetSessionMessageCounter().GetLocalMessageCounter(); - if (localCounter.SetCounter(mLocalMessageCounter) != CHIP_NO_ERROR) - { - ChipLogError(Controller, "Unable to restore local counter to %" PRIu32, mLocalMessageCounter); - } - Transport::PeerMessageCounter & peerCounter = secureSession->GetSessionMessageCounter().GetPeerMessageCounter(); - peerCounter.SetCounter(mPeerMessageCounter); } void CommissioneeDeviceProxy::OnConnectionExpired(SessionHandle session) diff --git a/src/controller/CommissioneeDeviceProxy.h b/src/controller/CommissioneeDeviceProxy.h index 81b59820c1f223..6eabfb91866f2a 100644 --- a/src/controller/CommissioneeDeviceProxy.h +++ b/src/controller/CommissioneeDeviceProxy.h @@ -347,9 +347,6 @@ class CommissioneeDeviceProxy : public DeviceProxy, Messaging::ExchangeDelegate uint8_t mSequenceNumber = 0; - uint32_t mLocalMessageCounter = 0; - uint32_t mPeerMessageCounter = 0; - /** * @brief * This function loads the secure session object from the serialized operational diff --git a/src/transport/MessageCounter.h b/src/transport/MessageCounter.h index 62365d2b95fa88..2c48ac801e99db 100644 --- a/src/transport/MessageCounter.h +++ b/src/transport/MessageCounter.h @@ -47,10 +47,9 @@ class MessageCounter virtual ~MessageCounter() = default; - virtual Type GetType() = 0; - virtual uint32_t Value() = 0; /** Get current value */ - virtual CHIP_ERROR Advance() = 0; /** Advance the counter */ - virtual CHIP_ERROR SetCounter(uint32_t count) = 0; /** Set the counter to the specified value */ + virtual Type GetType() = 0; + virtual uint32_t Value() = 0; /** Get current value */ + virtual CHIP_ERROR Advance() = 0; /** Advance the counter */ }; class GlobalUnencryptedMessageCounter : public MessageCounter @@ -67,11 +66,6 @@ class GlobalUnencryptedMessageCounter : public MessageCounter ++value; return CHIP_NO_ERROR; } - CHIP_ERROR SetCounter(uint32_t count) override - { - value = count; - return CHIP_NO_ERROR; - } private: uint32_t value; @@ -86,7 +80,6 @@ class GlobalEncryptedMessageCounter : public MessageCounter Type GetType() override { return GlobalEncrypted; } uint32_t Value() override { return persisted.GetValue(); } CHIP_ERROR Advance() override { return persisted.Advance(); } - CHIP_ERROR SetCounter(uint32_t count) override { return CHIP_ERROR_NOT_IMPLEMENTED; } private: #if CONFIG_DEVICE_LAYER @@ -123,11 +116,6 @@ class LocalSessionMessageCounter : public MessageCounter ++value; return CHIP_NO_ERROR; } - CHIP_ERROR SetCounter(uint32_t count) override - { - value = count; - return CHIP_NO_ERROR; - } private: uint32_t value;