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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 rtc::SrtpCryptoSuiteFromName(cipher), &key_len, &salt_len)) { | 111 rtc::SrtpCryptoSuiteFromName(cipher), &key_len, &salt_len)) { |
112 return false; | 112 return false; |
113 } | 113 } |
114 | 114 |
115 int master_key_len = key_len + salt_len; | 115 int master_key_len = key_len + salt_len; |
116 std::string master_key; | 116 std::string master_key; |
117 if (!rtc::CreateRandomData(master_key_len, &master_key)) { | 117 if (!rtc::CreateRandomData(master_key_len, &master_key)) { |
118 return false; | 118 return false; |
119 } | 119 } |
120 | 120 |
121 RTC_CHECK_EQ(static_cast<size_t>(master_key_len), master_key.size()); | 121 RTC_CHECK_EQ(master_key_len, master_key.size()); |
122 std::string key = rtc::Base64::Encode(master_key); | 122 std::string key = rtc::Base64::Encode(master_key); |
123 | 123 |
124 out->tag = tag; | 124 out->tag = tag; |
125 out->cipher_suite = cipher; | 125 out->cipher_suite = cipher; |
126 out->key_params = kInline; | 126 out->key_params = kInline; |
127 out->key_params += key; | 127 out->key_params += key; |
128 return true; | 128 return true; |
129 } | 129 } |
130 | 130 |
131 #ifdef HAVE_SRTP | 131 #ifdef HAVE_SRTP |
(...skipping 2058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2190 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO)); | 2190 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO)); |
2191 } | 2191 } |
2192 | 2192 |
2193 DataContentDescription* GetFirstDataContentDescription( | 2193 DataContentDescription* GetFirstDataContentDescription( |
2194 SessionDescription* sdesc) { | 2194 SessionDescription* sdesc) { |
2195 return static_cast<DataContentDescription*>( | 2195 return static_cast<DataContentDescription*>( |
2196 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA)); | 2196 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA)); |
2197 } | 2197 } |
2198 | 2198 |
2199 } // namespace cricket | 2199 } // namespace cricket |
OLD | NEW |