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 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 // The audio/video engines may attempt to send RTCP packets as soon as the | 731 // The audio/video engines may attempt to send RTCP packets as soon as the |
732 // streams are created, so don't treat this as an error for RTCP. | 732 // streams are created, so don't treat this as an error for RTCP. |
733 // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=6809 | 733 // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=6809 |
734 if (rtcp) { | 734 if (rtcp) { |
735 return false; | 735 return false; |
736 } | 736 } |
737 // However, there shouldn't be any RTP packets sent before SRTP is set up | 737 // However, there shouldn't be any RTP packets sent before SRTP is set up |
738 // (and SetSend(true) is called). | 738 // (and SetSend(true) is called). |
739 LOG(LS_ERROR) << "Can't send outgoing RTP packet when SRTP is inactive" | 739 LOG(LS_ERROR) << "Can't send outgoing RTP packet when SRTP is inactive" |
740 << " and crypto is required"; | 740 << " and crypto is required"; |
741 RTC_DCHECK(false); | 741 RTC_NOTREACHED(); |
742 return false; | 742 return false; |
743 } | 743 } |
744 | 744 |
745 // Bon voyage. | 745 // Bon voyage. |
746 int flags = (secure() && secure_dtls()) ? PF_SRTP_BYPASS : PF_NORMAL; | 746 int flags = (secure() && secure_dtls()) ? PF_SRTP_BYPASS : PF_NORMAL; |
747 int ret = channel->SendPacket(packet->data<char>(), packet->size(), | 747 int ret = channel->SendPacket(packet->data<char>(), packet->size(), |
748 updated_options, flags); | 748 updated_options, flags); |
749 if (ret != static_cast<int>(packet->size())) { | 749 if (ret != static_cast<int>(packet->size())) { |
750 if (channel->GetError() == ENOTCONN) { | 750 if (channel->GetError() == ENOTCONN) { |
751 LOG(LS_WARNING) << "Got ENOTCONN from transport."; | 751 LOG(LS_WARNING) << "Got ENOTCONN from transport."; |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 | 991 |
992 // OK, we're now doing DTLS (RFC 5764) | 992 // OK, we're now doing DTLS (RFC 5764) |
993 std::vector<unsigned char> dtls_buffer(key_len * 2 + salt_len * 2); | 993 std::vector<unsigned char> dtls_buffer(key_len * 2 + salt_len * 2); |
994 | 994 |
995 // RFC 5705 exporter using the RFC 5764 parameters | 995 // RFC 5705 exporter using the RFC 5764 parameters |
996 if (!channel->ExportKeyingMaterial( | 996 if (!channel->ExportKeyingMaterial( |
997 kDtlsSrtpExporterLabel, | 997 kDtlsSrtpExporterLabel, |
998 NULL, 0, false, | 998 NULL, 0, false, |
999 &dtls_buffer[0], dtls_buffer.size())) { | 999 &dtls_buffer[0], dtls_buffer.size())) { |
1000 LOG(LS_WARNING) << "DTLS-SRTP key export failed"; | 1000 LOG(LS_WARNING) << "DTLS-SRTP key export failed"; |
1001 RTC_DCHECK(false); // This should never happen | 1001 RTC_NOTREACHED(); // This should never happen |
1002 return false; | 1002 return false; |
1003 } | 1003 } |
1004 | 1004 |
1005 // Sync up the keys with the DTLS-SRTP interface | 1005 // Sync up the keys with the DTLS-SRTP interface |
1006 std::vector<unsigned char> client_write_key(key_len + salt_len); | 1006 std::vector<unsigned char> client_write_key(key_len + salt_len); |
1007 std::vector<unsigned char> server_write_key(key_len + salt_len); | 1007 std::vector<unsigned char> server_write_key(key_len + salt_len); |
1008 size_t offset = 0; | 1008 size_t offset = 0; |
1009 memcpy(&client_write_key[0], &dtls_buffer[offset], key_len); | 1009 memcpy(&client_write_key[0], &dtls_buffer[offset], key_len); |
1010 offset += key_len; | 1010 offset += key_len; |
1011 memcpy(&server_write_key[0], &dtls_buffer[offset], key_len); | 1011 memcpy(&server_write_key[0], &dtls_buffer[offset], key_len); |
(...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2410 signaling_thread()->Post(RTC_FROM_HERE, this, MSG_READYTOSENDDATA, | 2410 signaling_thread()->Post(RTC_FROM_HERE, this, MSG_READYTOSENDDATA, |
2411 new DataChannelReadyToSendMessageData(writable)); | 2411 new DataChannelReadyToSendMessageData(writable)); |
2412 } | 2412 } |
2413 | 2413 |
2414 void RtpDataChannel::GetSrtpCryptoSuites_n( | 2414 void RtpDataChannel::GetSrtpCryptoSuites_n( |
2415 std::vector<int>* crypto_suites) const { | 2415 std::vector<int>* crypto_suites) const { |
2416 GetSupportedDataCryptoSuites(crypto_options(), crypto_suites); | 2416 GetSupportedDataCryptoSuites(crypto_options(), crypto_suites); |
2417 } | 2417 } |
2418 | 2418 |
2419 } // namespace cricket | 2419 } // namespace cricket |
OLD | NEW |