srtp_protect() is the Secure RTP sender-side packet processing function.
The function call srtp_protect(ctx, rtp_hdr, len_ptr) applies SRTP protection to the RTP packet rtp_hdr (which has length *len_ptr) using the SRTP context ctx. If err_status_ok is returned, then rtp_hdr points to the resulting SRTP packet and *len_ptr is the number of octets in that packet; otherwise, no assumptions should be made about the value of either data elements.
The sequence numbers of the RTP packets presented to this function need not be consecutive, but they must be out of order by less than 2^15 = 32,768 packets.
- This function assumes that it can write the authentication tag into the location in memory immediately following the RTP packet, and assumes that the RTP packet is aligned on a 32-bit boundary.
|ctx||is the SRTP context to use in processing the packet.|
|rtp_hdr||is a pointer to the RTP packet (before the call); after the function returns, it points to the srtp packet.|
|len_ptr||is a pointer to the length in octets of the complete RTP packet (header and body) before the function call, and of the complete SRTP packet after the call, if err_status_ok was returned. Otherwise, the value of the data to which it points is undefined.|
- err_status_ok no problems
- err_status_replay_fail rtp sequence number was non-increasing
- other failure in cryptographic mechanisms