Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1572)

Side by Side Diff: talk/session/media/mediasession.cc

Issue 1337673002: Change WebRTC SslCipher to be exposed as number only. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « talk/session/media/mediasession.h ('k') | talk/session/media/mediasession_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2004 Google Inc. 3 * Copyright 2004 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 return true; 148 return true;
149 } 149 }
150 } 150 }
151 return false; 151 return false;
152 } 152 }
153 153
154 // For audio, HMAC 32 is prefered because of the low overhead. 154 // For audio, HMAC 32 is prefered because of the low overhead.
155 void GetSupportedAudioCryptoSuites( 155 void GetSupportedAudioCryptoSuites(
156 std::vector<std::string>* crypto_suites) { 156 std::vector<std::string>* crypto_suites) {
157 #ifdef HAVE_SRTP 157 #ifdef HAVE_SRTP
158 crypto_suites->push_back(CS_AES_CM_128_HMAC_SHA1_32); 158 crypto_suites->push_back(rtc::CS_AES_CM_128_HMAC_SHA1_32);
159 crypto_suites->push_back(CS_AES_CM_128_HMAC_SHA1_80); 159 crypto_suites->push_back(rtc::CS_AES_CM_128_HMAC_SHA1_80);
160 #endif 160 #endif
161 } 161 }
162 162
163 void GetSupportedVideoCryptoSuites( 163 void GetSupportedVideoCryptoSuites(
164 std::vector<std::string>* crypto_suites) { 164 std::vector<std::string>* crypto_suites) {
165 GetSupportedDefaultCryptoSuites(crypto_suites); 165 GetDefaultSrtpCryptoSuiteNames(crypto_suites);
166 } 166 }
167 167
168 void GetSupportedDataCryptoSuites( 168 void GetSupportedDataCryptoSuites(
169 std::vector<std::string>* crypto_suites) { 169 std::vector<std::string>* crypto_suites) {
170 GetSupportedDefaultCryptoSuites(crypto_suites); 170 GetDefaultSrtpCryptoSuiteNames(crypto_suites);
171 } 171 }
172 172
173 void GetSupportedDefaultCryptoSuites( 173 void GetDefaultSrtpCryptoSuiteNames(std::vector<std::string>* crypto_suites) {
174 std::vector<std::string>* crypto_suites) {
175 #ifdef HAVE_SRTP 174 #ifdef HAVE_SRTP
176 crypto_suites->push_back(CS_AES_CM_128_HMAC_SHA1_80); 175 crypto_suites->push_back(rtc::CS_AES_CM_128_HMAC_SHA1_80);
177 #endif 176 #endif
178 } 177 }
179 178
180 // For video support only 80-bit SHA1 HMAC. For audio 32-bit HMAC is 179 // For video support only 80-bit SHA1 HMAC. For audio 32-bit HMAC is
181 // tolerated unless bundle is enabled because it is low overhead. Pick the 180 // tolerated unless bundle is enabled because it is low overhead. Pick the
182 // crypto in the list that is supported. 181 // crypto in the list that is supported.
183 static bool SelectCrypto(const MediaContentDescription* offer, 182 static bool SelectCrypto(const MediaContentDescription* offer,
184 bool bundle, 183 bool bundle,
185 CryptoParams *crypto) { 184 CryptoParams *crypto) {
186 bool audio = offer->type() == MEDIA_TYPE_AUDIO; 185 bool audio = offer->type() == MEDIA_TYPE_AUDIO;
187 const CryptoParamsVec& cryptos = offer->cryptos(); 186 const CryptoParamsVec& cryptos = offer->cryptos();
188 187
189 for (CryptoParamsVec::const_iterator i = cryptos.begin(); 188 for (CryptoParamsVec::const_iterator i = cryptos.begin();
190 i != cryptos.end(); ++i) { 189 i != cryptos.end(); ++i) {
191 if (CS_AES_CM_128_HMAC_SHA1_80 == i->cipher_suite || 190 if (rtc::CS_AES_CM_128_HMAC_SHA1_80 == i->cipher_suite ||
192 (CS_AES_CM_128_HMAC_SHA1_32 == i->cipher_suite && audio && !bundle)) { 191 (rtc::CS_AES_CM_128_HMAC_SHA1_32 == i->cipher_suite && audio &&
192 !bundle)) {
193 return CreateCryptoParams(i->tag, i->cipher_suite, crypto); 193 return CreateCryptoParams(i->tag, i->cipher_suite, crypto);
194 } 194 }
195 } 195 }
196 return false; 196 return false;
197 } 197 }
198 198
199 static const StreamParams* FindFirstStreamParamsByCname( 199 static const StreamParams* FindFirstStreamParamsByCname(
200 const StreamParamsVec& params_vec, 200 const StreamParamsVec& params_vec,
201 const std::string& cname) { 201 const std::string& cname) {
202 for (StreamParamsVec::const_iterator it = params_vec.begin(); 202 for (StreamParamsVec::const_iterator it = params_vec.begin();
(...skipping 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after
1902 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO)); 1902 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_VIDEO));
1903 } 1903 }
1904 1904
1905 const DataContentDescription* GetFirstDataContentDescription( 1905 const DataContentDescription* GetFirstDataContentDescription(
1906 const SessionDescription* sdesc) { 1906 const SessionDescription* sdesc) {
1907 return static_cast<const DataContentDescription*>( 1907 return static_cast<const DataContentDescription*>(
1908 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA)); 1908 GetFirstMediaContentDescription(sdesc, MEDIA_TYPE_DATA));
1909 } 1909 }
1910 1910
1911 } // namespace cricket 1911 } // namespace cricket
OLDNEW
« no previous file with comments | « talk/session/media/mediasession.h ('k') | talk/session/media/mediasession_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698