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

We should not use const_cast for PacketHeader to set PeerGroupMsgIdNotSynchronized state #5367

Closed
yufengwangca opened this issue Mar 15, 2021 · 0 comments · Fixed by #5368
Closed

Comments

@yufengwangca
Copy link
Contributor

Problem

We are storing the IsPeerGroupMsgIdNotSynchronized state in the PacketHeader, which seems like as lightly odd place to put it and requires const_cast. We should not be adding const_cast to the code.

    // For all group messages, Set flag if peer group key message counter is not synchronized.
    if (ChipKeyId::IsAppGroupKey(packetHeader.GetEncryptionKeyID()))
    {
        const_cast<PacketHeader &>(packetHeader).SetPeerGroupMsgIdNotSynchronized(true);
    }

Proposed Solution

Use SecureSessionHandle to indicate if the peer's group key message counter is not synchronized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant