B Fixed RTCP unprotect replay window for GCM#1675
Conversation
|
Below is from Claude Code: Thanks for porting the replay-window fix to the RTCP path. The core change is correct — splitting into a read-only However, I think this introduces a functional regression in // ~line 1288 (AES-CM), ~1302 (AEAD GCM/CCM), ~1325 (Double AEAD outer)
SRTP.Encryption.CTR.GenerateMessageKeyIV (context.K_s, ssrc, ssrcContext.S_l, context.Iv16);
SRTP.Encryption.AEAD.GenerateMessageKeyIV(context.K_s, ssrc, ssrcContext.S_l, context.Iv12);Previously this happened to work because the old In-order stream:
The RTP path avoids this by deriving the IV from the local SRTP.Encryption.CTR.GenerateMessageKeyIV (context.K_s, ssrc, index, context.Iv16);
SRTP.Encryption.AEAD.GenerateMessageKeyIV(context.K_s, ssrc, index, context.Iv12); // GCM + Double AEAD outer
Net effect without this change: encrypted RTCP (SR/RR, NACK/PLI/REMB, BYE) stops decrypting after the first report for the standard WebRTC profiles — and this path worked before the PR, so it's a regression rather than a pre-existing issue. The green CI looks to be a coverage gap: there's no multi-packet encrypted-RTCP round-trip test for CM/GCM. A two-packet GCM protect→unprotect round trip fails on packet 2 and catches this; happy to contribute one. |
UnprotectRtcp must derive the per-packet AES-GCM IV from the SRTCP index of the packet being decrypted, not from the connection's highest-seen index (S_l). A single-packet round trip cannot detect a regression here because S_l defaults to 0 and the first index is 0, so they coincide. This test protects and unprotects an in-order multi-packet RTCP stream and asserts every packet round-trips with its payload intact, which only holds when the IV tracks each packet's own index. It guards against the RTCP replay-window refactor in PR #1675 deriving the IV from a stale S_l once the replay update is deferred until after authentication. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
|
Thank you very much! You're right, both about the issue and the missing test coverage. The issue should be fixed now, not sure when I get to writing the tests though, so any contributions/PRs are welcome! |
|
Claude already wrote the test. Thanks for the update I'll give it a spin. |
Same issue as in 8877339, only in RTCP. Removed the CheckAndUpdateReplayWindow method as it was no longer being used.