Skip to content

Commit 368f43d

Browse files
committed
B Fixed double AEAD
1 parent 4901e9d commit 368f43d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/SIPSorcery/net/DtlsSrtp/Lib/SRTP/SrtpContext.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -911,8 +911,8 @@ public virtual int UnprotectRtp(ReadOnlyBytes input, Bytes output, out int outpu
911911
// apply inner cryptographic algorithm
912912
var innerK_e = KeyParameter.Create(context.K_e.Slice(0, context.K_e.Length / 2));
913913
var innerK_s = context.K_s.AsSpan(0, context.K_s.Length / 2);
914-
SRTP.Encryption.AEAD.GenerateMessageKeyIV(innerK_s, innerSsrc, innerIndex, context.Iv16);
915-
SRTP.Encryption.AEAD.Encrypt(context.PayloadAEAD, false, syntheticRtpPacket.Slice(rtpHeaderLength, syntheticRtpPacketLen - rtpHeaderLength), syntheticRtpPacket.Slice(rtpHeaderLength, syntheticRtpPacketLen - rtpHeaderLength), context.Iv16, innerK_e, context.N_tag / 2, syntheticRtpPacket.Slice(0, rtpHeaderLength));
914+
SRTP.Encryption.AEAD.GenerateMessageKeyIV(innerK_s, innerSsrc, innerIndex, context.Iv12);
915+
SRTP.Encryption.AEAD.Encrypt(context.PayloadAEAD, false, syntheticRtpPacket.Slice(rtpHeaderLength, syntheticRtpPacketLen - rtpHeaderLength), syntheticRtpPacket.Slice(rtpHeaderLength, syntheticRtpPacketLen - rtpHeaderLength), context.Iv12, innerK_e, context.N_tag / 2, syntheticRtpPacket.Slice(0, rtpHeaderLength));
916916

917917
// copy the unprotected payload back to the output buffer
918918
syntheticRtpPacket.AsSpan(rtpHeaderLength, syntheticRtpPacketLen - rtpHeaderLength - context.N_tag / 2).CopyTo(output.Slice(offset, syntheticRtpPacketLen - rtpHeaderLength - context.N_tag / 2));

0 commit comments

Comments
 (0)