< Previous by Date Date Index Next by Date >
  Thread Index Next in Thread >

[recon-devel] allocate memory for srtp_protect


Hi, if I got a RTP packet want to crypto it before sending, do I need to allocate 4 byte memory for this RTP packet to allows srtp write "tag" ?

Likes:

RTPPacket packet;
int length = packet.getLegth(); // length = rtp header length + rtp paylaod length

unsigned char srtpPacket * = new char[length+4];
memcpy(srtpPacket, &packet.getData(), length);

srtp_protect(mSRTPSessionOut, srtpPacket, &length);

Does this code is right ?

Sorry for my simple question, I'm new to SRTP :)

Thanks