OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2009 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2009 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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
558 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 558 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
559 RTC_DCHECK(IsExternalAuthActive()); | 559 RTC_DCHECK(IsExternalAuthActive()); |
560 if (!IsExternalAuthActive()) { | 560 if (!IsExternalAuthActive()) { |
561 return false; | 561 return false; |
562 } | 562 } |
563 | 563 |
564 ExternalHmacContext* external_hmac = nullptr; | 564 ExternalHmacContext* external_hmac = nullptr; |
565 // stream_template will be the reference context for other streams. | 565 // stream_template will be the reference context for other streams. |
566 // Let's use it for getting the keys. | 566 // Let's use it for getting the keys. |
567 srtp_stream_ctx_t* srtp_context = session_->stream_template; | 567 srtp_stream_ctx_t* srtp_context = session_->stream_template; |
568 #if defined(SRTP_MAX_MKI_LEN) | |
joachim
2017/06/27 21:15:16
The #define has been introduced in libsrtp 2.1.0
| |
569 // libsrtp 2.1.0 | |
570 if (srtp_context && srtp_context->session_keys && | |
571 srtp_context->session_keys->rtp_auth) { | |
572 external_hmac = reinterpret_cast<ExternalHmacContext*>( | |
573 srtp_context->session_keys->rtp_auth->state); | |
574 } | |
575 #else | |
576 // libsrtp 2.0.0 | |
577 // TODO(jbauch): Remove after switching to libsrtp 2.1.0 | |
568 if (srtp_context && srtp_context->rtp_auth) { | 578 if (srtp_context && srtp_context->rtp_auth) { |
569 external_hmac = reinterpret_cast<ExternalHmacContext*>( | 579 external_hmac = reinterpret_cast<ExternalHmacContext*>( |
570 srtp_context->rtp_auth->state); | 580 srtp_context->rtp_auth->state); |
571 } | 581 } |
582 #endif | |
572 | 583 |
573 if (!external_hmac) { | 584 if (!external_hmac) { |
574 LOG(LS_ERROR) << "Failed to get auth keys from libsrtp!."; | 585 LOG(LS_ERROR) << "Failed to get auth keys from libsrtp!."; |
575 return false; | 586 return false; |
576 } | 587 } |
577 | 588 |
578 *key = external_hmac->key; | 589 *key = external_hmac->key; |
579 *key_len = external_hmac->key_length; | 590 *key_len = external_hmac->key_length; |
580 *tag_len = rtp_auth_tag_len_; | 591 *tag_len = rtp_auth_tag_len_; |
581 return true; | 592 return true; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
762 // Callback will be executed from same thread that calls the "srtp_protect" | 773 // Callback will be executed from same thread that calls the "srtp_protect" |
763 // and "srtp_unprotect" functions. | 774 // and "srtp_unprotect" functions. |
764 SrtpSession* session = static_cast<SrtpSession*>( | 775 SrtpSession* session = static_cast<SrtpSession*>( |
765 srtp_get_user_data(ev->session)); | 776 srtp_get_user_data(ev->session)); |
766 if (session) { | 777 if (session) { |
767 session->HandleEvent(ev); | 778 session->HandleEvent(ev); |
768 } | 779 } |
769 } | 780 } |
770 | 781 |
771 } // namespace cricket | 782 } // namespace cricket |
OLD | NEW |