srtp_unprotect() is the Secure RTP receiver-side packet processing function.
The function call srtp_unprotect(ctx, srtp_hdr, len_ptr) verifies the Secure RTP protection of the SRTP packet pointed to by srtp_hdr (which has length *len_ptr), using the SRTP context ctx. If err_status_ok is returned, then srtp_hdr points to the resulting RTP 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 the SRTP packet is aligned on a 32-bit boundary.
|ctx ||is a pointer to the srtp_t which applies to the particular packet.|
|srtp_hdr ||is a pointer to the header of the SRTP packet (before the call). after the function returns, it points to the rtp packet if err_status_ok was returned; otherwise, the value of the data to which it points is undefined.|
|len_ptr ||is a pointer to the length in octets of the complete srtp packet (header and body) before the function call, and of the complete rtp 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 if the RTP packet is valid.
- err_status_auth_fail if the SRTP packet failed the message authentication check.
- err_status_replay_fail if the SRTP packet is a replay (e.g. packet has already been processed and accepted).
- [other] if there has been an error in the cryptographic mechanisms.