zstein | 398c3fd | 2017-07-19 13:38:02 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #include "pc/srtptransport.h" |
zstein | 398c3fd | 2017-07-19 13:38:02 -0700 | [diff] [blame] | 12 | |
| 13 | #include <string> |
Steve Anton | 36b29d1 | 2017-10-30 09:57:42 -0700 | [diff] [blame] | 14 | #include <vector> |
zstein | 398c3fd | 2017-07-19 13:38:02 -0700 | [diff] [blame] | 15 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 16 | #include "media/base/rtputils.h" |
| 17 | #include "pc/rtptransport.h" |
| 18 | #include "pc/srtpsession.h" |
| 19 | #include "rtc_base/asyncpacketsocket.h" |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 20 | #include "rtc_base/base64.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 21 | #include "rtc_base/copyonwritebuffer.h" |
| 22 | #include "rtc_base/ptr_util.h" |
| 23 | #include "rtc_base/trace_event.h" |
zstein | 398c3fd | 2017-07-19 13:38:02 -0700 | [diff] [blame] | 24 | |
| 25 | namespace webrtc { |
| 26 | |
| 27 | SrtpTransport::SrtpTransport(bool rtcp_mux_enabled, |
| 28 | const std::string& content_name) |
| 29 | : content_name_(content_name), |
| 30 | rtp_transport_(rtc::MakeUnique<RtpTransport>(rtcp_mux_enabled)) { |
| 31 | ConnectToRtpTransport(); |
| 32 | } |
| 33 | |
| 34 | SrtpTransport::SrtpTransport(std::unique_ptr<RtpTransportInternal> transport, |
| 35 | const std::string& content_name) |
| 36 | : content_name_(content_name), rtp_transport_(std::move(transport)) { |
| 37 | ConnectToRtpTransport(); |
| 38 | } |
| 39 | |
| 40 | void SrtpTransport::ConnectToRtpTransport() { |
| 41 | rtp_transport_->SignalPacketReceived.connect( |
| 42 | this, &SrtpTransport::OnPacketReceived); |
| 43 | rtp_transport_->SignalReadyToSend.connect(this, |
| 44 | &SrtpTransport::OnReadyToSend); |
| 45 | } |
| 46 | |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 47 | bool SrtpTransport::SendRtpPacket(rtc::CopyOnWriteBuffer* packet, |
| 48 | const rtc::PacketOptions& options, |
| 49 | int flags) { |
| 50 | return SendPacket(false, packet, options, flags); |
| 51 | } |
| 52 | |
| 53 | bool SrtpTransport::SendRtcpPacket(rtc::CopyOnWriteBuffer* packet, |
| 54 | const rtc::PacketOptions& options, |
| 55 | int flags) { |
| 56 | return SendPacket(true, packet, options, flags); |
| 57 | } |
| 58 | |
zstein | 398c3fd | 2017-07-19 13:38:02 -0700 | [diff] [blame] | 59 | bool SrtpTransport::SendPacket(bool rtcp, |
| 60 | rtc::CopyOnWriteBuffer* packet, |
| 61 | const rtc::PacketOptions& options, |
| 62 | int flags) { |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 63 | if (!IsActive()) { |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 64 | RTC_LOG(LS_ERROR) |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 65 | << "Failed to send the packet because SRTP transport is inactive."; |
| 66 | return false; |
| 67 | } |
zstein | 398c3fd | 2017-07-19 13:38:02 -0700 | [diff] [blame] | 68 | |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 69 | rtc::PacketOptions updated_options = options; |
| 70 | rtc::CopyOnWriteBuffer cp = *packet; |
| 71 | TRACE_EVENT0("webrtc", "SRTP Encode"); |
| 72 | bool res; |
| 73 | uint8_t* data = packet->data(); |
| 74 | int len = static_cast<int>(packet->size()); |
| 75 | if (!rtcp) { |
| 76 | // If ENABLE_EXTERNAL_AUTH flag is on then packet authentication is not done |
| 77 | // inside libsrtp for a RTP packet. A external HMAC module will be writing |
| 78 | // a fake HMAC value. This is ONLY done for a RTP packet. |
| 79 | // Socket layer will update rtp sendtime extension header if present in |
| 80 | // packet with current time before updating the HMAC. |
| 81 | #if !defined(ENABLE_EXTERNAL_AUTH) |
| 82 | res = ProtectRtp(data, len, static_cast<int>(packet->capacity()), &len); |
| 83 | #else |
| 84 | if (!IsExternalAuthActive()) { |
| 85 | res = ProtectRtp(data, len, static_cast<int>(packet->capacity()), &len); |
| 86 | } else { |
| 87 | updated_options.packet_time_params.rtp_sendtime_extension_id = |
| 88 | rtp_abs_sendtime_extn_id_; |
| 89 | res = ProtectRtp(data, len, static_cast<int>(packet->capacity()), &len, |
| 90 | &updated_options.packet_time_params.srtp_packet_index); |
| 91 | // If protection succeeds, let's get auth params from srtp. |
| 92 | if (res) { |
| 93 | uint8_t* auth_key = NULL; |
| 94 | int key_len; |
| 95 | res = GetRtpAuthParams( |
| 96 | &auth_key, &key_len, |
| 97 | &updated_options.packet_time_params.srtp_auth_tag_len); |
| 98 | if (res) { |
| 99 | updated_options.packet_time_params.srtp_auth_key.resize(key_len); |
| 100 | updated_options.packet_time_params.srtp_auth_key.assign( |
| 101 | auth_key, auth_key + key_len); |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | #endif |
| 106 | if (!res) { |
| 107 | int seq_num = -1; |
| 108 | uint32_t ssrc = 0; |
| 109 | cricket::GetRtpSeqNum(data, len, &seq_num); |
| 110 | cricket::GetRtpSsrc(data, len, &ssrc); |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 111 | RTC_LOG(LS_ERROR) << "Failed to protect " << content_name_ |
| 112 | << " RTP packet: size=" << len << ", seqnum=" << seq_num |
| 113 | << ", SSRC=" << ssrc; |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 114 | return false; |
| 115 | } |
| 116 | } else { |
| 117 | res = ProtectRtcp(data, len, static_cast<int>(packet->capacity()), &len); |
| 118 | if (!res) { |
| 119 | int type = -1; |
| 120 | cricket::GetRtcpType(data, len, &type); |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 121 | RTC_LOG(LS_ERROR) << "Failed to protect " << content_name_ |
| 122 | << " RTCP packet: size=" << len << ", type=" << type; |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 123 | return false; |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | // Update the length of the packet now that we've added the auth tag. |
| 128 | packet->SetSize(len); |
| 129 | return rtcp ? rtp_transport_->SendRtcpPacket(packet, updated_options, flags) |
| 130 | : rtp_transport_->SendRtpPacket(packet, updated_options, flags); |
zstein | 398c3fd | 2017-07-19 13:38:02 -0700 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | void SrtpTransport::OnPacketReceived(bool rtcp, |
| 134 | rtc::CopyOnWriteBuffer* packet, |
| 135 | const rtc::PacketTime& packet_time) { |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 136 | if (!IsActive()) { |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 137 | RTC_LOG(LS_WARNING) |
| 138 | << "Inactive SRTP transport received a packet. Drop it."; |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 139 | return; |
| 140 | } |
zstein | 398c3fd | 2017-07-19 13:38:02 -0700 | [diff] [blame] | 141 | |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 142 | TRACE_EVENT0("webrtc", "SRTP Decode"); |
| 143 | char* data = packet->data<char>(); |
| 144 | int len = static_cast<int>(packet->size()); |
| 145 | bool res; |
| 146 | if (!rtcp) { |
| 147 | res = UnprotectRtp(data, len, &len); |
| 148 | if (!res) { |
| 149 | int seq_num = -1; |
| 150 | uint32_t ssrc = 0; |
| 151 | cricket::GetRtpSeqNum(data, len, &seq_num); |
| 152 | cricket::GetRtpSsrc(data, len, &ssrc); |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 153 | RTC_LOG(LS_ERROR) << "Failed to unprotect " << content_name_ |
| 154 | << " RTP packet: size=" << len << ", seqnum=" << seq_num |
| 155 | << ", SSRC=" << ssrc; |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 156 | return; |
| 157 | } |
| 158 | } else { |
| 159 | res = UnprotectRtcp(data, len, &len); |
| 160 | if (!res) { |
| 161 | int type = -1; |
| 162 | cricket::GetRtcpType(data, len, &type); |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 163 | RTC_LOG(LS_ERROR) << "Failed to unprotect " << content_name_ |
| 164 | << " RTCP packet: size=" << len << ", type=" << type; |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 165 | return; |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | packet->SetSize(len); |
zstein | 398c3fd | 2017-07-19 13:38:02 -0700 | [diff] [blame] | 170 | SignalPacketReceived(rtcp, packet, packet_time); |
| 171 | } |
| 172 | |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 173 | bool SrtpTransport::SetRtpParams(int send_cs, |
| 174 | const uint8_t* send_key, |
| 175 | int send_key_len, |
Zhi Huang | c99b6c7 | 2017-11-10 16:44:46 -0800 | [diff] [blame^] | 176 | const std::vector<int>& send_extension_ids, |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 177 | int recv_cs, |
| 178 | const uint8_t* recv_key, |
Zhi Huang | c99b6c7 | 2017-11-10 16:44:46 -0800 | [diff] [blame^] | 179 | int recv_key_len, |
| 180 | const std::vector<int>& recv_extension_ids) { |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 181 | // If parameters are being set for the first time, we should create new SRTP |
| 182 | // sessions and call "SetSend/SetRecv". Otherwise we should call |
| 183 | // "UpdateSend"/"UpdateRecv" on the existing sessions, which will internally |
| 184 | // call "srtp_update". |
| 185 | bool new_sessions = false; |
| 186 | if (!send_session_) { |
| 187 | RTC_DCHECK(!recv_session_); |
| 188 | CreateSrtpSessions(); |
| 189 | new_sessions = true; |
| 190 | } |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 191 | bool ret = new_sessions |
Zhi Huang | c99b6c7 | 2017-11-10 16:44:46 -0800 | [diff] [blame^] | 192 | ? send_session_->SetSend(send_cs, send_key, send_key_len, |
| 193 | send_extension_ids) |
| 194 | : send_session_->UpdateSend(send_cs, send_key, send_key_len, |
| 195 | send_extension_ids); |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 196 | if (!ret) { |
| 197 | ResetParams(); |
| 198 | return false; |
| 199 | } |
| 200 | |
Zhi Huang | c99b6c7 | 2017-11-10 16:44:46 -0800 | [diff] [blame^] | 201 | ret = new_sessions ? recv_session_->SetRecv(recv_cs, recv_key, recv_key_len, |
| 202 | recv_extension_ids) |
| 203 | : recv_session_->UpdateRecv( |
| 204 | recv_cs, recv_key, recv_key_len, recv_extension_ids); |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 205 | if (!ret) { |
| 206 | ResetParams(); |
| 207 | return false; |
| 208 | } |
| 209 | |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 210 | RTC_LOG(LS_INFO) << "SRTP " << (new_sessions ? "activated" : "updated") |
| 211 | << " with negotiated parameters:" |
| 212 | << " send cipher_suite " << send_cs << " recv cipher_suite " |
| 213 | << recv_cs; |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 214 | return true; |
| 215 | } |
| 216 | |
| 217 | bool SrtpTransport::SetRtcpParams(int send_cs, |
| 218 | const uint8_t* send_key, |
| 219 | int send_key_len, |
Zhi Huang | c99b6c7 | 2017-11-10 16:44:46 -0800 | [diff] [blame^] | 220 | const std::vector<int>& send_extension_ids, |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 221 | int recv_cs, |
| 222 | const uint8_t* recv_key, |
Zhi Huang | c99b6c7 | 2017-11-10 16:44:46 -0800 | [diff] [blame^] | 223 | int recv_key_len, |
| 224 | const std::vector<int>& recv_extension_ids) { |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 225 | // This can only be called once, but can be safely called after |
| 226 | // SetRtpParams |
| 227 | if (send_rtcp_session_ || recv_rtcp_session_) { |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 228 | RTC_LOG(LS_ERROR) << "Tried to set SRTCP Params when filter already active"; |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 229 | return false; |
| 230 | } |
| 231 | |
| 232 | send_rtcp_session_.reset(new cricket::SrtpSession()); |
Zhi Huang | c99b6c7 | 2017-11-10 16:44:46 -0800 | [diff] [blame^] | 233 | if (!send_rtcp_session_->SetSend(send_cs, send_key, send_key_len, |
| 234 | send_extension_ids)) { |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 235 | return false; |
| 236 | } |
| 237 | |
| 238 | recv_rtcp_session_.reset(new cricket::SrtpSession()); |
Zhi Huang | c99b6c7 | 2017-11-10 16:44:46 -0800 | [diff] [blame^] | 239 | if (!recv_rtcp_session_->SetRecv(recv_cs, recv_key, recv_key_len, |
| 240 | recv_extension_ids)) { |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 241 | return false; |
| 242 | } |
| 243 | |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 244 | RTC_LOG(LS_INFO) << "SRTCP activated with negotiated parameters:" |
| 245 | << " send cipher_suite " << send_cs << " recv cipher_suite " |
| 246 | << recv_cs; |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 247 | |
| 248 | return true; |
| 249 | } |
| 250 | |
| 251 | bool SrtpTransport::IsActive() const { |
| 252 | return send_session_ && recv_session_; |
| 253 | } |
| 254 | |
| 255 | void SrtpTransport::ResetParams() { |
| 256 | send_session_ = nullptr; |
| 257 | recv_session_ = nullptr; |
| 258 | send_rtcp_session_ = nullptr; |
| 259 | recv_rtcp_session_ = nullptr; |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 260 | RTC_LOG(LS_INFO) << "The params in SRTP transport are reset."; |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 261 | } |
| 262 | |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 263 | void SrtpTransport::CreateSrtpSessions() { |
| 264 | send_session_.reset(new cricket::SrtpSession()); |
| 265 | recv_session_.reset(new cricket::SrtpSession()); |
| 266 | |
| 267 | if (external_auth_enabled_) { |
| 268 | send_session_->EnableExternalAuth(); |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | bool SrtpTransport::ProtectRtp(void* p, int in_len, int max_len, int* out_len) { |
| 273 | if (!IsActive()) { |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 274 | RTC_LOG(LS_WARNING) << "Failed to ProtectRtp: SRTP not active"; |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 275 | return false; |
| 276 | } |
| 277 | RTC_CHECK(send_session_); |
| 278 | return send_session_->ProtectRtp(p, in_len, max_len, out_len); |
| 279 | } |
| 280 | |
| 281 | bool SrtpTransport::ProtectRtp(void* p, |
| 282 | int in_len, |
| 283 | int max_len, |
| 284 | int* out_len, |
| 285 | int64_t* index) { |
| 286 | if (!IsActive()) { |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 287 | RTC_LOG(LS_WARNING) << "Failed to ProtectRtp: SRTP not active"; |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 288 | return false; |
| 289 | } |
| 290 | RTC_CHECK(send_session_); |
| 291 | return send_session_->ProtectRtp(p, in_len, max_len, out_len, index); |
| 292 | } |
| 293 | |
| 294 | bool SrtpTransport::ProtectRtcp(void* p, |
| 295 | int in_len, |
| 296 | int max_len, |
| 297 | int* out_len) { |
| 298 | if (!IsActive()) { |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 299 | RTC_LOG(LS_WARNING) << "Failed to ProtectRtcp: SRTP not active"; |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 300 | return false; |
| 301 | } |
| 302 | if (send_rtcp_session_) { |
| 303 | return send_rtcp_session_->ProtectRtcp(p, in_len, max_len, out_len); |
| 304 | } else { |
| 305 | RTC_CHECK(send_session_); |
| 306 | return send_session_->ProtectRtcp(p, in_len, max_len, out_len); |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | bool SrtpTransport::UnprotectRtp(void* p, int in_len, int* out_len) { |
| 311 | if (!IsActive()) { |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 312 | RTC_LOG(LS_WARNING) << "Failed to UnprotectRtp: SRTP not active"; |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 313 | return false; |
| 314 | } |
| 315 | RTC_CHECK(recv_session_); |
| 316 | return recv_session_->UnprotectRtp(p, in_len, out_len); |
| 317 | } |
| 318 | |
| 319 | bool SrtpTransport::UnprotectRtcp(void* p, int in_len, int* out_len) { |
| 320 | if (!IsActive()) { |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 321 | RTC_LOG(LS_WARNING) << "Failed to UnprotectRtcp: SRTP not active"; |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 322 | return false; |
| 323 | } |
| 324 | if (recv_rtcp_session_) { |
| 325 | return recv_rtcp_session_->UnprotectRtcp(p, in_len, out_len); |
| 326 | } else { |
| 327 | RTC_CHECK(recv_session_); |
| 328 | return recv_session_->UnprotectRtcp(p, in_len, out_len); |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | bool SrtpTransport::GetRtpAuthParams(uint8_t** key, |
| 333 | int* key_len, |
| 334 | int* tag_len) { |
| 335 | if (!IsActive()) { |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 336 | RTC_LOG(LS_WARNING) << "Failed to GetRtpAuthParams: SRTP not active"; |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 337 | return false; |
| 338 | } |
| 339 | |
| 340 | RTC_CHECK(send_session_); |
| 341 | return send_session_->GetRtpAuthParams(key, key_len, tag_len); |
| 342 | } |
| 343 | |
| 344 | bool SrtpTransport::GetSrtpOverhead(int* srtp_overhead) const { |
| 345 | if (!IsActive()) { |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 346 | RTC_LOG(LS_WARNING) << "Failed to GetSrtpOverhead: SRTP not active"; |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 347 | return false; |
| 348 | } |
| 349 | |
| 350 | RTC_CHECK(send_session_); |
| 351 | *srtp_overhead = send_session_->GetSrtpOverhead(); |
| 352 | return true; |
| 353 | } |
| 354 | |
| 355 | void SrtpTransport::EnableExternalAuth() { |
| 356 | RTC_DCHECK(!IsActive()); |
| 357 | external_auth_enabled_ = true; |
| 358 | } |
| 359 | |
| 360 | bool SrtpTransport::IsExternalAuthEnabled() const { |
| 361 | return external_auth_enabled_; |
| 362 | } |
| 363 | |
| 364 | bool SrtpTransport::IsExternalAuthActive() const { |
| 365 | if (!IsActive()) { |
Mirko Bonadei | 675513b | 2017-11-09 11:09:25 +0100 | [diff] [blame] | 366 | RTC_LOG(LS_WARNING) |
| 367 | << "Failed to check IsExternalAuthActive: SRTP not active"; |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 368 | return false; |
| 369 | } |
| 370 | |
| 371 | RTC_CHECK(send_session_); |
| 372 | return send_session_->IsExternalAuthActive(); |
| 373 | } |
| 374 | |
zstein | 398c3fd | 2017-07-19 13:38:02 -0700 | [diff] [blame] | 375 | } // namespace webrtc |