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

Side by Side Diff: webrtc/pc/srtpfilter.h

Issue 2720663003: Support GCM ciphers even if ENABLE_EXTERNAL_AUTH is defined. (Closed)
Patch Set: Fixed win_x64 compile errors (added explicit casts). Created 3 years, 9 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 | « webrtc/pc/channelmanager.cc ('k') | webrtc/pc/srtpfilter.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 * 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // If an HMAC is used, this will decrease the packet size. 107 // If an HMAC is used, this will decrease the packet size.
108 bool UnprotectRtp(void* data, int in_len, int* out_len); 108 bool UnprotectRtp(void* data, int in_len, int* out_len);
109 bool UnprotectRtcp(void* data, int in_len, int* out_len); 109 bool UnprotectRtcp(void* data, int in_len, int* out_len);
110 110
111 // Returns rtp auth params from srtp context. 111 // Returns rtp auth params from srtp context.
112 bool GetRtpAuthParams(uint8_t** key, int* key_len, int* tag_len); 112 bool GetRtpAuthParams(uint8_t** key, int* key_len, int* tag_len);
113 113
114 // Returns srtp overhead for rtp packets. 114 // Returns srtp overhead for rtp packets.
115 bool GetSrtpOverhead(int* srtp_overhead) const; 115 bool GetSrtpOverhead(int* srtp_overhead) const;
116 116
117 #if defined(ENABLE_EXTERNAL_AUTH)
118 // A SRTP filter supports external creation of the auth tag if a non-GCM
119 // cipher is used. This method is only valid after the RTP params have
120 // been set.
121 bool IsExternalAuthActive() const;
122 #endif
123
117 // Update the silent threshold (in ms) for signaling errors. 124 // Update the silent threshold (in ms) for signaling errors.
118 void set_signal_silent_time(int signal_silent_time_in_ms); 125 void set_signal_silent_time(int signal_silent_time_in_ms);
119 126
120 bool ResetParams(); 127 bool ResetParams();
121 128
122 sigslot::repeater3<uint32_t, Mode, Error> SignalSrtpError; 129 sigslot::repeater3<uint32_t, Mode, Error> SignalSrtpError;
123 130
124 protected: 131 protected:
125 bool ExpectOffer(ContentSource source); 132 bool ExpectOffer(ContentSource source);
126 bool StoreParams(const std::vector<CryptoParams>& params, 133 bool StoreParams(const std::vector<CryptoParams>& params,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 // Decrypts/verifies an invidiual RTP/RTCP packet. 206 // Decrypts/verifies an invidiual RTP/RTCP packet.
200 // If an HMAC is used, this will decrease the packet size. 207 // If an HMAC is used, this will decrease the packet size.
201 bool UnprotectRtp(void* data, int in_len, int* out_len); 208 bool UnprotectRtp(void* data, int in_len, int* out_len);
202 bool UnprotectRtcp(void* data, int in_len, int* out_len); 209 bool UnprotectRtcp(void* data, int in_len, int* out_len);
203 210
204 // Helper method to get authentication params. 211 // Helper method to get authentication params.
205 bool GetRtpAuthParams(uint8_t** key, int* key_len, int* tag_len); 212 bool GetRtpAuthParams(uint8_t** key, int* key_len, int* tag_len);
206 213
207 int GetSrtpOverhead() const; 214 int GetSrtpOverhead() const;
208 215
216 #if defined(ENABLE_EXTERNAL_AUTH)
217 // A SRTP session supports external creation of the auth tag if a non-GCM
218 // cipher is used. This method is only valid after the RTP params have
219 // been set.
220 bool IsExternalAuthActive() const;
221 #endif
222
209 // Update the silent threshold (in ms) for signaling errors. 223 // Update the silent threshold (in ms) for signaling errors.
210 void set_signal_silent_time(int signal_silent_time_in_ms); 224 void set_signal_silent_time(int signal_silent_time_in_ms);
211 225
212 // Calls srtp_shutdown if it's initialized. 226 // Calls srtp_shutdown if it's initialized.
213 static void Terminate(); 227 static void Terminate();
214 228
215 sigslot::repeater3<uint32_t, SrtpFilter::Mode, SrtpFilter::Error> 229 sigslot::repeater3<uint32_t, SrtpFilter::Mode, SrtpFilter::Error>
216 SignalSrtpError; 230 SignalSrtpError;
217 231
218 private: 232 private:
219 bool SetKey(int type, int cs, const uint8_t* key, size_t len); 233 bool SetKey(int type, int cs, const uint8_t* key, size_t len);
220 // Returns send stream current packet index from srtp db. 234 // Returns send stream current packet index from srtp db.
221 bool GetSendStreamPacketIndex(void* data, int in_len, int64_t* index); 235 bool GetSendStreamPacketIndex(void* data, int in_len, int64_t* index);
222 236
223 static bool Init(); 237 static bool Init();
224 void HandleEvent(const srtp_event_data_t* ev); 238 void HandleEvent(const srtp_event_data_t* ev);
225 static void HandleEventThunk(srtp_event_data_t* ev); 239 static void HandleEventThunk(srtp_event_data_t* ev);
226 240
227 rtc::ThreadChecker thread_checker_; 241 rtc::ThreadChecker thread_checker_;
228 srtp_ctx_t_* session_; 242 srtp_ctx_t_* session_ = nullptr;
229 int rtp_auth_tag_len_; 243 int rtp_auth_tag_len_ = 0;
230 int rtcp_auth_tag_len_; 244 int rtcp_auth_tag_len_ = 0;
231 std::unique_ptr<SrtpStat> srtp_stat_; 245 std::unique_ptr<SrtpStat> srtp_stat_;
232 static bool inited_; 246 static bool inited_;
233 static rtc::GlobalLockPod lock_; 247 static rtc::GlobalLockPod lock_;
234 int last_send_seq_num_; 248 int last_send_seq_num_ = -1;
249 #if defined(ENABLE_EXTERNAL_AUTH)
250 bool external_auth_active_ = false;
251 #endif
235 RTC_DISALLOW_COPY_AND_ASSIGN(SrtpSession); 252 RTC_DISALLOW_COPY_AND_ASSIGN(SrtpSession);
236 }; 253 };
237 254
238 // Class that collects failures of SRTP. 255 // Class that collects failures of SRTP.
239 class SrtpStat { 256 class SrtpStat {
240 public: 257 public:
241 SrtpStat(); 258 SrtpStat();
242 259
243 // Report RTP protection results to the handler. 260 // Report RTP protection results to the handler.
244 void AddProtectRtpResult(uint32_t ssrc, int result); 261 void AddProtectRtpResult(uint32_t ssrc, int result);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 std::map<FailureKey, FailureStat> failures_; 320 std::map<FailureKey, FailureStat> failures_;
304 // Threshold in ms to silent the signaling errors. 321 // Threshold in ms to silent the signaling errors.
305 int signal_silent_time_; 322 int signal_silent_time_;
306 323
307 RTC_DISALLOW_COPY_AND_ASSIGN(SrtpStat); 324 RTC_DISALLOW_COPY_AND_ASSIGN(SrtpStat);
308 }; 325 };
309 326
310 } // namespace cricket 327 } // namespace cricket
311 328
312 #endif // WEBRTC_PC_SRTPFILTER_H_ 329 #endif // WEBRTC_PC_SRTPFILTER_H_
OLDNEW
« no previous file with comments | « webrtc/pc/channelmanager.cc ('k') | webrtc/pc/srtpfilter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698