OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 if (!rtcp) { | 733 if (!rtcp) { |
734 // If ENABLE_EXTERNAL_AUTH flag is on then packet authentication is not done | 734 // If ENABLE_EXTERNAL_AUTH flag is on then packet authentication is not done |
735 // inside libsrtp for a RTP packet. A external HMAC module will be writing | 735 // inside libsrtp for a RTP packet. A external HMAC module will be writing |
736 // a fake HMAC value. This is ONLY done for a RTP packet. | 736 // a fake HMAC value. This is ONLY done for a RTP packet. |
737 // Socket layer will update rtp sendtime extension header if present in | 737 // Socket layer will update rtp sendtime extension header if present in |
738 // packet with current time before updating the HMAC. | 738 // packet with current time before updating the HMAC. |
739 #if !defined(ENABLE_EXTERNAL_AUTH) | 739 #if !defined(ENABLE_EXTERNAL_AUTH) |
740 res = srtp_filter_.ProtectRtp( | 740 res = srtp_filter_.ProtectRtp( |
741 data, len, static_cast<int>(packet->capacity()), &len); | 741 data, len, static_cast<int>(packet->capacity()), &len); |
742 #else | 742 #else |
743 updated_options.packet_time_params.rtp_sendtime_extension_id = | 743 if (!srtp_filter_.IsExternalAuthActive()) { |
744 rtp_abs_sendtime_extn_id_; | 744 res = srtp_filter_.ProtectRtp( |
745 res = srtp_filter_.ProtectRtp( | 745 data, len, static_cast<int>(packet->capacity()), &len); |
746 data, len, static_cast<int>(packet->capacity()), &len, | 746 } else { |
747 &updated_options.packet_time_params.srtp_packet_index); | 747 updated_options.packet_time_params.rtp_sendtime_extension_id = |
748 // If protection succeeds, let's get auth params from srtp. | 748 rtp_abs_sendtime_extn_id_; |
749 if (res) { | 749 res = srtp_filter_.ProtectRtp( |
750 uint8_t* auth_key = NULL; | 750 data, len, static_cast<int>(packet->capacity()), &len, |
751 int key_len; | 751 &updated_options.packet_time_params.srtp_packet_index); |
752 res = srtp_filter_.GetRtpAuthParams( | 752 // If protection succeeds, let's get auth params from srtp. |
753 &auth_key, &key_len, | |
754 &updated_options.packet_time_params.srtp_auth_tag_len); | |
755 if (res) { | 753 if (res) { |
756 updated_options.packet_time_params.srtp_auth_key.resize(key_len); | 754 uint8_t* auth_key = NULL; |
757 updated_options.packet_time_params.srtp_auth_key.assign( | 755 int key_len; |
758 auth_key, auth_key + key_len); | 756 res = srtp_filter_.GetRtpAuthParams( |
| 757 &auth_key, &key_len, |
| 758 &updated_options.packet_time_params.srtp_auth_tag_len); |
| 759 if (res) { |
| 760 updated_options.packet_time_params.srtp_auth_key.resize(key_len); |
| 761 updated_options.packet_time_params.srtp_auth_key.assign( |
| 762 auth_key, auth_key + key_len); |
| 763 } |
759 } | 764 } |
760 } | 765 } |
761 #endif | 766 #endif |
762 if (!res) { | 767 if (!res) { |
763 int seq_num = -1; | 768 int seq_num = -1; |
764 uint32_t ssrc = 0; | 769 uint32_t ssrc = 0; |
765 GetRtpSeqNum(data, len, &seq_num); | 770 GetRtpSeqNum(data, len, &seq_num); |
766 GetRtpSsrc(data, len, &ssrc); | 771 GetRtpSsrc(data, len, &ssrc); |
767 LOG(LS_ERROR) << "Failed to protect " << content_name_ | 772 LOG(LS_ERROR) << "Failed to protect " << content_name_ |
768 << " RTP packet: size=" << len | 773 << " RTP packet: size=" << len |
(...skipping 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2457 signaling_thread()->Post(RTC_FROM_HERE, this, MSG_READYTOSENDDATA, | 2462 signaling_thread()->Post(RTC_FROM_HERE, this, MSG_READYTOSENDDATA, |
2458 new DataChannelReadyToSendMessageData(writable)); | 2463 new DataChannelReadyToSendMessageData(writable)); |
2459 } | 2464 } |
2460 | 2465 |
2461 void RtpDataChannel::GetSrtpCryptoSuites_n( | 2466 void RtpDataChannel::GetSrtpCryptoSuites_n( |
2462 std::vector<int>* crypto_suites) const { | 2467 std::vector<int>* crypto_suites) const { |
2463 GetSupportedDataCryptoSuites(crypto_options(), crypto_suites); | 2468 GetSupportedDataCryptoSuites(crypto_options(), crypto_suites); |
2464 } | 2469 } |
2465 | 2470 |
2466 } // namespace cricket | 2471 } // namespace cricket |
OLD | NEW |