Skip to content

Commit

Permalink
Remove dead codes PeerConnectionState::Reset (project-chip#9422)
Browse files Browse the repository at this point in the history
  • Loading branch information
kghost authored Sep 13, 2021
1 parent f9de0af commit b8e7596
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 39 deletions.
10 changes: 0 additions & 10 deletions src/transport/MessageCounter.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class MessageCounter
virtual ~MessageCounter() = 0;

virtual Type GetType() = 0;
virtual void Reset() = 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 */
Expand All @@ -63,9 +62,6 @@ class GlobalUnencryptedMessageCounter : public MessageCounter
~GlobalUnencryptedMessageCounter() override {}

Type GetType() override { return GlobalUnencrypted; }
void Reset() override
{ /* null op */
}
uint32_t Value() override { return value; }
CHIP_ERROR Advance() override
{
Expand All @@ -74,7 +70,6 @@ class GlobalUnencryptedMessageCounter : public MessageCounter
}
CHIP_ERROR SetCounter(uint32_t count) override
{
Reset();
value = count;
return CHIP_NO_ERROR;
}
Expand All @@ -91,9 +86,6 @@ class GlobalEncryptedMessageCounter : public MessageCounter

CHIP_ERROR Init();
Type GetType() override { return GlobalEncrypted; }
void Reset() override
{ /* null op */
}
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; }
Expand Down Expand Up @@ -128,7 +120,6 @@ class LocalSessionMessageCounter : public MessageCounter
~LocalSessionMessageCounter() override {}

Type GetType() override { return Session; }
void Reset() override { value = kInitialValue; }
uint32_t Value() override { return value; }
CHIP_ERROR Advance() override
{
Expand All @@ -137,7 +128,6 @@ class LocalSessionMessageCounter : public MessageCounter
}
CHIP_ERROR SetCounter(uint32_t count) override
{
Reset();
value = count;
return CHIP_NO_ERROR;
}
Expand Down
12 changes: 0 additions & 12 deletions src/transport/PeerConnectionState.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,6 @@ class PeerConnectionState
mLocalKeyID != UINT16_MAX);
}

/**
* Reset the connection state to a completely uninitialized status.
*/
void Reset()
{
mPeerAddress = PeerAddress::Uninitialized();
mPeerNodeId = kUndefinedNodeId;
mLastActivityTimeMs = 0;
mSecureSession.Reset();
mSessionMessageCounter.Reset();
}

CHIP_ERROR EncryptBeforeSend(const uint8_t * input, size_t input_length, uint8_t * output, PacketHeader & header,
MessageAuthenticationCode & mac) const
{
Expand Down
6 changes: 0 additions & 6 deletions src/transport/SecureSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,6 @@ CHIP_ERROR SecureSession::Init(const Crypto::P256Keypair & local_keypair, const
return InitFromSecret(ByteSpan(secret, secret.Length()), salt, infoType, role);
}

void SecureSession::Reset()
{
mKeyAvailable = false;
memset(mKeys, 0, sizeof(mKeys));
}

CHIP_ERROR SecureSession::GetIV(const PacketHeader & header, uint8_t * iv, size_t len)
{

Expand Down
5 changes: 0 additions & 5 deletions src/transport/SecureSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,6 @@ class DLL_EXPORT SecureSession
*/
size_t EncryptionOverhead();

/**
* Clears the internal state of secure session back to the state of a new object.
*/
void Reset();

private:
static constexpr size_t kAES_CCM128_Key_Length = 16;

Expand Down
6 changes: 0 additions & 6 deletions src/transport/SessionMessageCounter.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ namespace Transport {
class SessionMessageCounter
{
public:
void Reset()
{
mLocalMessageCounter.Reset();
mPeerMessageCounter.Reset();
}

MessageCounter & GetLocalMessageCounter() { return mLocalMessageCounter; }
PeerMessageCounter & GetPeerMessageCounter() { return mPeerMessageCounter; }

Expand Down

0 comments on commit b8e7596

Please sign in to comment.