| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2017 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 147 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 148 RTC_DCHECK(IsExternalAuthActive()); | 148 RTC_DCHECK(IsExternalAuthActive()); |
| 149 if (!IsExternalAuthActive()) { | 149 if (!IsExternalAuthActive()) { |
| 150 return false; | 150 return false; |
| 151 } | 151 } |
| 152 | 152 |
| 153 ExternalHmacContext* external_hmac = nullptr; | 153 ExternalHmacContext* external_hmac = nullptr; |
| 154 // stream_template will be the reference context for other streams. | 154 // stream_template will be the reference context for other streams. |
| 155 // Let's use it for getting the keys. | 155 // Let's use it for getting the keys. |
| 156 srtp_stream_ctx_t* srtp_context = session_->stream_template; | 156 srtp_stream_ctx_t* srtp_context = session_->stream_template; |
| 157 #if defined(SRTP_MAX_MKI_LEN) | |
| 158 // libsrtp 2.1.0 | |
| 159 if (srtp_context && srtp_context->session_keys && | 157 if (srtp_context && srtp_context->session_keys && |
| 160 srtp_context->session_keys->rtp_auth) { | 158 srtp_context->session_keys->rtp_auth) { |
| 161 external_hmac = reinterpret_cast<ExternalHmacContext*>( | 159 external_hmac = reinterpret_cast<ExternalHmacContext*>( |
| 162 srtp_context->session_keys->rtp_auth->state); | 160 srtp_context->session_keys->rtp_auth->state); |
| 163 } | 161 } |
| 164 #else | |
| 165 // libsrtp 2.0.0 | |
| 166 // TODO(jbauch): Remove after switching to libsrtp 2.1.0 | |
| 167 if (srtp_context && srtp_context->rtp_auth) { | |
| 168 external_hmac = | |
| 169 reinterpret_cast<ExternalHmacContext*>(srtp_context->rtp_auth->state); | |
| 170 } | |
| 171 #endif | |
| 172 | 162 |
| 173 if (!external_hmac) { | 163 if (!external_hmac) { |
| 174 LOG(LS_ERROR) << "Failed to get auth keys from libsrtp!."; | 164 LOG(LS_ERROR) << "Failed to get auth keys from libsrtp!."; |
| 175 return false; | 165 return false; |
| 176 } | 166 } |
| 177 | 167 |
| 178 *key = external_hmac->key; | 168 *key = external_hmac->key; |
| 179 *key_len = external_hmac->key_length; | 169 *key_len = external_hmac->key_length; |
| 180 *tag_len = rtp_auth_tag_len_; | 170 *tag_len = rtp_auth_tag_len_; |
| 181 return true; | 171 return true; |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 // Callback will be executed from same thread that calls the "srtp_protect" | 389 // Callback will be executed from same thread that calls the "srtp_protect" |
| 400 // and "srtp_unprotect" functions. | 390 // and "srtp_unprotect" functions. |
| 401 SrtpSession* session = | 391 SrtpSession* session = |
| 402 static_cast<SrtpSession*>(srtp_get_user_data(ev->session)); | 392 static_cast<SrtpSession*>(srtp_get_user_data(ev->session)); |
| 403 if (session) { | 393 if (session) { |
| 404 session->HandleEvent(ev); | 394 session->HandleEvent(ev); |
| 405 } | 395 } |
| 406 } | 396 } |
| 407 | 397 |
| 408 } // namespace cricket | 398 } // namespace cricket |
| OLD | NEW |