@@ -79,32 +79,32 @@ srtp_debug_module_t mod_srtp = {
7979#define uint32s_in_rtcp_header 2
8080#define octets_in_rtp_extn_hdr 4
8181
82- static srtp_err_status_t srtp_validate_rtp_header (void * rtp_hdr ,
83- int * pkt_octet_len )
82+ static srtp_err_status_t srtp_validate_rtp_header (const void * rtp_hdr ,
83+ int pkt_octet_len )
8484{
85- srtp_hdr_t * hdr = (srtp_hdr_t * )rtp_hdr ;
85+ const srtp_hdr_t * hdr = (const srtp_hdr_t * )rtp_hdr ;
8686 int rtp_header_len ;
8787
88- if (* pkt_octet_len < octets_in_rtp_header )
88+ if (pkt_octet_len < octets_in_rtp_header )
8989 return srtp_err_status_bad_param ;
9090
9191 /* Check RTP header length */
9292 rtp_header_len = octets_in_rtp_header + 4 * hdr -> cc ;
9393 if (hdr -> x == 1 )
9494 rtp_header_len += octets_in_rtp_extn_hdr ;
9595
96- if (* pkt_octet_len < rtp_header_len )
96+ if (pkt_octet_len < rtp_header_len )
9797 return srtp_err_status_bad_param ;
9898
9999 /* Verifing profile length. */
100100 if (hdr -> x == 1 ) {
101- srtp_hdr_xtnd_t * xtn_hdr =
102- (srtp_hdr_xtnd_t * )((uint32_t * )hdr + uint32s_in_rtp_header +
103- hdr -> cc );
101+ const srtp_hdr_xtnd_t * xtn_hdr =
102+ (const srtp_hdr_xtnd_t * )((const uint32_t * )hdr +
103+ uint32s_in_rtp_header + hdr -> cc );
104104 int profile_len = ntohs (xtn_hdr -> length );
105105 rtp_header_len += profile_len * 4 ;
106106 /* profile length counts the number of 32-bit words */
107- if (* pkt_octet_len < rtp_header_len )
107+ if (pkt_octet_len < rtp_header_len )
108108 return srtp_err_status_bad_param ;
109109 }
110110 return srtp_err_status_ok ;
@@ -1577,7 +1577,7 @@ static srtp_err_status_t srtp_process_header_encryption(
15771577static void srtp_calc_aead_iv (srtp_session_keys_t * session_keys ,
15781578 v128_t * iv ,
15791579 srtp_xtd_seq_num_t * seq ,
1580- srtp_hdr_t * hdr )
1580+ const srtp_hdr_t * hdr )
15811581{
15821582 v128_t in ;
15831583 v128_t salt ;
@@ -1616,11 +1616,11 @@ static void srtp_calc_aead_iv(srtp_session_keys_t *session_keys,
16161616}
16171617
16181618srtp_session_keys_t * srtp_get_session_keys (srtp_stream_ctx_t * stream ,
1619- uint8_t * hdr ,
1620- const unsigned int * pkt_octet_len ,
1619+ const uint8_t * hdr ,
1620+ unsigned int pkt_octet_len ,
16211621 unsigned int * mki_size )
16221622{
1623- unsigned int base_mki_start_location = * pkt_octet_len ;
1623+ unsigned int base_mki_start_location = pkt_octet_len ;
16241624 unsigned int mki_start_location = 0 ;
16251625 unsigned int tag_len = 0 ;
16261626 unsigned int i = 0 ;
@@ -1731,7 +1731,7 @@ static srtp_err_status_t srtp_estimate_index(srtp_rdbx_t *rdbx,
17311731 return srtp_err_status_ok ;
17321732}
17331733
1734- static srtp_err_status_t srtp_get_est_pkt_index (srtp_hdr_t * hdr ,
1734+ static srtp_err_status_t srtp_get_est_pkt_index (const srtp_hdr_t * hdr ,
17351735 srtp_stream_ctx_t * stream ,
17361736 srtp_xtd_seq_num_t * est ,
17371737 int * delta )
@@ -2169,7 +2169,7 @@ srtp_err_status_t srtp_protect_mki(srtp_ctx_t *ctx,
21692169 /* we assume the hdr is 32-bit aligned to start */
21702170
21712171 /* Verify RTP header */
2172- status = srtp_validate_rtp_header (rtp_hdr , pkt_octet_len );
2172+ status = srtp_validate_rtp_header (rtp_hdr , * pkt_octet_len );
21732173 if (status )
21742174 return status ;
21752175
@@ -2499,7 +2499,7 @@ srtp_err_status_t srtp_unprotect_mki(srtp_ctx_t *ctx,
24992499 /* we assume the hdr is 32-bit aligned to start */
25002500
25012501 /* Verify RTP header */
2502- status = srtp_validate_rtp_header (srtp_hdr , pkt_octet_len );
2502+ status = srtp_validate_rtp_header (srtp_hdr , * pkt_octet_len );
25032503 if (status )
25042504 return status ;
25052505
@@ -2568,9 +2568,9 @@ srtp_err_status_t srtp_unprotect_mki(srtp_ctx_t *ctx,
25682568
25692569 /* Determine if MKI is being used and what session keys should be used */
25702570 if (use_mki ) {
2571- session_keys = srtp_get_session_keys (
2572- stream , (uint8_t * ) hdr , ( const unsigned int * ) pkt_octet_len ,
2573- & mki_size );
2571+ session_keys =
2572+ srtp_get_session_keys ( stream , (const uint8_t * ) hdr ,
2573+ ( unsigned int ) * pkt_octet_len , & mki_size );
25742574
25752575 if (session_keys == NULL )
25762576 return srtp_err_status_bad_mki ;
@@ -3574,7 +3574,7 @@ static srtp_err_status_t srtp_calc_aead_iv_srtcp(
35743574 srtp_session_keys_t * session_keys ,
35753575 v128_t * iv ,
35763576 uint32_t seq_num ,
3577- srtcp_hdr_t * hdr )
3577+ const srtcp_hdr_t * hdr )
35783578{
35793579 v128_t in ;
35803580 v128_t salt ;
@@ -3873,8 +3873,9 @@ static srtp_err_status_t srtp_unprotect_rtcp_aead(
38733873 * If payload encryption is enabled, then the AAD consist of
38743874 * the RTCP header and the seq# at the end of the packet
38753875 */
3876- status = srtp_cipher_set_aad (session_keys -> rtcp_cipher , (uint8_t * )hdr ,
3877- octets_in_rtcp_header );
3876+ status =
3877+ srtp_cipher_set_aad (session_keys -> rtcp_cipher , (const uint8_t * )hdr ,
3878+ octets_in_rtcp_header );
38783879 if (status ) {
38793880 return (srtp_err_status_cipher_fail );
38803881 }
@@ -4282,9 +4283,9 @@ srtp_err_status_t srtp_unprotect_rtcp_mki(srtp_t ctx,
42824283 * Determine if MKI is being used and what session keys should be used
42834284 */
42844285 if (use_mki ) {
4285- session_keys = srtp_get_session_keys (
4286- stream , (uint8_t * ) hdr , ( const unsigned int * ) pkt_octet_len ,
4287- & mki_size );
4286+ session_keys =
4287+ srtp_get_session_keys ( stream , (const uint8_t * ) hdr ,
4288+ ( unsigned int ) * pkt_octet_len , & mki_size );
42884289
42894290 if (session_keys == NULL )
42904291 return srtp_err_status_bad_mki ;
0 commit comments