Skip to content

Commit 66f2a85

Browse files
committed
Reset IV buffers when needed
1 parent 233d953 commit 66f2a85

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

srtp_cipher_aead_aes_gcm.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ func (s *srtpCipherAeadAesGcm) decryptRTCP(dst, encrypted []byte, srtcpIndex, ss
344344
//
345345
// https://tools.ietf.org/html/rfc7714#section-8.1
346346
func (s *srtpCipherAeadAesGcm) rtpInitializationVector(header *rtp.Header, roc uint32) {
347+
s.rtpIV = [12]byte{}
347348
binary.BigEndian.PutUint32(s.rtpIV[2:], header.SSRC)
348349
binary.BigEndian.PutUint32(s.rtpIV[6:], roc)
349350
binary.BigEndian.PutUint16(s.rtpIV[10:], header.SequenceNumber)
@@ -361,6 +362,7 @@ func (s *srtpCipherAeadAesGcm) rtpInitializationVector(header *rtp.Header, roc u
361362
//
362363
// https://tools.ietf.org/html/rfc7714#section-9.1
363364
func (s *srtpCipherAeadAesGcm) rtcpInitializationVector(srtcpIndex uint32, ssrc uint32) {
365+
s.rtcpIV = [12]byte{}
364366
binary.BigEndian.PutUint32(s.rtcpIV[2:], ssrc)
365367
binary.BigEndian.PutUint32(s.rtcpIV[8:], srtcpIndex)
366368

0 commit comments

Comments
 (0)