OLD | NEW |
1 /* | 1 /* |
2 * srtp.c | 2 * srtp.c |
3 * | 3 * |
4 * the secure real-time transport protocol | 4 * the secure real-time transport protocol |
5 * | 5 * |
6 * David A. McGrew | 6 * David A. McGrew |
7 * Cisco Systems, Inc. | 7 * Cisco Systems, Inc. |
8 */ | 8 */ |
9 /* | 9 /* |
10 * | 10 * |
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 * We pass the tag down to the cipher when doing GCM mode | 1083 * We pass the tag down to the cipher when doing GCM mode |
1084 */ | 1084 */ |
1085 enc_octet_len = (unsigned int)(*pkt_octet_len - | 1085 enc_octet_len = (unsigned int)(*pkt_octet_len - |
1086 ((uint8_t*)enc_start - (uint8_t*)hdr)); | 1086 ((uint8_t*)enc_start - (uint8_t*)hdr)); |
1087 | 1087 |
1088 /* | 1088 /* |
1089 * Sanity check the encrypted payload length against | 1089 * Sanity check the encrypted payload length against |
1090 * the tag size. It must always be at least as large | 1090 * the tag size. It must always be at least as large |
1091 * as the tag length. | 1091 * as the tag length. |
1092 */ | 1092 */ |
1093 if (enc_octet_len < tag_len) { | 1093 if (enc_octet_len < (unsigned int) tag_len) { |
1094 return err_status_cipher_fail; | 1094 return err_status_cipher_fail; |
1095 } | 1095 } |
1096 | 1096 |
1097 /* | 1097 /* |
1098 * update the key usage limit, and check it to make sure that we | 1098 * update the key usage limit, and check it to make sure that we |
1099 * didn't just hit either the soft limit or the hard limit, and call | 1099 * didn't just hit either the soft limit or the hard limit, and call |
1100 * the event handler if we hit either. | 1100 * the event handler if we hit either. |
1101 */ | 1101 */ |
1102 switch (key_limit_update(stream->limit)) { | 1102 switch (key_limit_update(stream->limit)) { |
1103 case key_event_normal: | 1103 case key_event_normal: |
(...skipping 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2871 return err_status_no_ctx; | 2871 return err_status_no_ctx; |
2872 } | 2872 } |
2873 } | 2873 } |
2874 | 2874 |
2875 /* get tag length from stream context */ | 2875 /* get tag length from stream context */ |
2876 tag_len = auth_get_tag_length(stream->rtcp_auth); | 2876 tag_len = auth_get_tag_length(stream->rtcp_auth); |
2877 | 2877 |
2878 /* check the packet length - it must contain at least a full RTCP | 2878 /* check the packet length - it must contain at least a full RTCP |
2879 header, an auth tag (if applicable), and the SRTCP encrypted flag | 2879 header, an auth tag (if applicable), and the SRTCP encrypted flag |
2880 and 31-bit index value */ | 2880 and 31-bit index value */ |
2881 if (*pkt_octet_len < (octets_in_rtcp_header + tag_len + sizeof(srtcp_trailer_t
))) { | 2881 if (*pkt_octet_len < (int) (octets_in_rtcp_header + tag_len + sizeof(srtcp_tra
iler_t))) { |
2882 return err_status_bad_param; | 2882 return err_status_bad_param; |
2883 } | 2883 } |
2884 | 2884 |
2885 /* | 2885 /* |
2886 * Check if this is an AEAD stream (GCM mode). If so, then dispatch | 2886 * Check if this is an AEAD stream (GCM mode). If so, then dispatch |
2887 * the request to our AEAD handler. | 2887 * the request to our AEAD handler. |
2888 */ | 2888 */ |
2889 if (stream->rtp_cipher->algorithm == AES_128_GCM || | 2889 if (stream->rtp_cipher->algorithm == AES_128_GCM || |
2890 stream->rtp_cipher->algorithm == AES_256_GCM) { | 2890 stream->rtp_cipher->algorithm == AES_256_GCM) { |
2891 return srtp_unprotect_rtcp_aead(ctx, stream, srtcp_hdr, (unsigned int*)pkt
_octet_len); | 2891 return srtp_unprotect_rtcp_aead(ctx, stream, srtcp_hdr, (unsigned int*)pkt
_octet_len); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3216 break; | 3216 break; |
3217 case srtp_profile_aes256_cm_sha1_32: | 3217 case srtp_profile_aes256_cm_sha1_32: |
3218 return 14; | 3218 return 14; |
3219 break; | 3219 break; |
3220 /* the following profiles are not (yet) supported */ | 3220 /* the following profiles are not (yet) supported */ |
3221 case srtp_profile_null_sha1_32: | 3221 case srtp_profile_null_sha1_32: |
3222 default: | 3222 default: |
3223 return 0; /* indicate error by returning a zero */ | 3223 return 0; /* indicate error by returning a zero */ |
3224 } | 3224 } |
3225 } | 3225 } |
OLD | NEW |