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

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

Issue 2761143002: Support encrypted RTP extensions (RFC 6904) (Closed)
Patch Set: 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
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 ContentSource source); 72 ContentSource source);
73 // Indicates which crypto algorithms and keys were contained in the answer. 73 // Indicates which crypto algorithms and keys were contained in the answer.
74 // answer_params should contain the negotiated parameters, which may be none, 74 // answer_params should contain the negotiated parameters, which may be none,
75 // if crypto was not desired or could not be negotiated (and not required). 75 // if crypto was not desired or could not be negotiated (and not required).
76 // This must be called after SetOffer. If crypto negotiation completes 76 // This must be called after SetOffer. If crypto negotiation completes
77 // successfully, this will advance the filter to the active state. 77 // successfully, this will advance the filter to the active state.
78 bool SetAnswer(const std::vector<CryptoParams>& answer_params, 78 bool SetAnswer(const std::vector<CryptoParams>& answer_params,
79 ContentSource source); 79 ContentSource source);
80 80
81 // Just set up both sets of keys directly. 81 // Just set up both sets of keys directly.
82 // Used with DTLS-SRTP. 82 // Used with DTLS-SRTP.
Taylor Brandstetter 2017/03/22 18:00:11 nit: Update the comments in this file to describe
joachim 2017/03/23 00:04:33 Functionality has moved to a new method, I added a
83 bool SetRtpParams(int send_cs, 83 bool SetRtpParams(int send_cs,
84 const uint8_t* send_key, 84 const uint8_t* send_key,
85 int send_key_len, 85 int send_key_len,
86 const std::vector<int>& send_encrypted_headers,
86 int recv_cs, 87 int recv_cs,
87 const uint8_t* recv_key, 88 const uint8_t* recv_key,
88 int recv_key_len); 89 int recv_key_len,
90 const std::vector<int>& recv_encrypted_headers);
89 bool SetRtcpParams(int send_cs, 91 bool SetRtcpParams(int send_cs,
90 const uint8_t* send_key, 92 const uint8_t* send_key,
91 int send_key_len, 93 int send_key_len,
92 int recv_cs, 94 int recv_cs,
93 const uint8_t* recv_key, 95 const uint8_t* recv_key,
94 int recv_key_len); 96 int recv_key_len);
95 97
96 // Encrypts/signs an individual RTP/RTCP packet, in-place. 98 // Encrypts/signs an individual RTP/RTCP packet, in-place.
97 // If an HMAC is used, this will increase the packet size. 99 // If an HMAC is used, this will increase the packet size.
98 bool ProtectRtp(void* data, int in_len, int max_len, int* out_len); 100 bool ProtectRtp(void* data, int in_len, int max_len, int* out_len);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 }; 190 };
189 191
190 // Class that wraps a libSRTP session. 192 // Class that wraps a libSRTP session.
191 class SrtpSession { 193 class SrtpSession {
192 public: 194 public:
193 SrtpSession(); 195 SrtpSession();
194 ~SrtpSession(); 196 ~SrtpSession();
195 197
196 // Configures the session for sending data using the specified 198 // Configures the session for sending data using the specified
197 // cipher-suite and key. Receiving must be done by a separate session. 199 // cipher-suite and key. Receiving must be done by a separate session.
198 bool SetSend(int cs, const uint8_t* key, size_t len); 200 bool SetSend(int cs, const uint8_t* key, size_t len,
201 const std::vector<int>& encrypted_headers);
199 // Configures the session for receiving data using the specified 202 // Configures the session for receiving data using the specified
200 // cipher-suite and key. Sending must be done by a separate session. 203 // cipher-suite and key. Sending must be done by a separate session.
201 bool SetRecv(int cs, const uint8_t* key, size_t len); 204 bool SetRecv(int cs, const uint8_t* key, size_t len,
205 const std::vector<int>& encrypted_headers);
202 206
203 // Encrypts/signs an individual RTP/RTCP packet, in-place. 207 // Encrypts/signs an individual RTP/RTCP packet, in-place.
204 // If an HMAC is used, this will increase the packet size. 208 // If an HMAC is used, this will increase the packet size.
205 bool ProtectRtp(void* data, int in_len, int max_len, int* out_len); 209 bool ProtectRtp(void* data, int in_len, int max_len, int* out_len);
206 // Overloaded version, outputs packet index. 210 // Overloaded version, outputs packet index.
207 bool ProtectRtp(void* data, 211 bool ProtectRtp(void* data,
208 int in_len, 212 int in_len,
209 int max_len, 213 int max_len,
210 int* out_len, 214 int* out_len,
211 int64_t* index); 215 int64_t* index);
(...skipping 24 matching lines...) Expand all
236 // Update the silent threshold (in ms) for signaling errors. 240 // Update the silent threshold (in ms) for signaling errors.
237 void set_signal_silent_time(int signal_silent_time_in_ms); 241 void set_signal_silent_time(int signal_silent_time_in_ms);
238 242
239 // Calls srtp_shutdown if it's initialized. 243 // Calls srtp_shutdown if it's initialized.
240 static void Terminate(); 244 static void Terminate();
241 245
242 sigslot::repeater3<uint32_t, SrtpFilter::Mode, SrtpFilter::Error> 246 sigslot::repeater3<uint32_t, SrtpFilter::Mode, SrtpFilter::Error>
243 SignalSrtpError; 247 SignalSrtpError;
244 248
245 private: 249 private:
246 bool SetKey(int type, int cs, const uint8_t* key, size_t len); 250 bool SetKey(int type, int cs, const uint8_t* key, size_t len,
Taylor Brandstetter 2017/03/22 18:00:11 SetKeyAndEncryptedHeaders?
joachim 2017/03/23 00:04:34 Done.
251 const std::vector<int>& encrypted_headers);
247 // Returns send stream current packet index from srtp db. 252 // Returns send stream current packet index from srtp db.
248 bool GetSendStreamPacketIndex(void* data, int in_len, int64_t* index); 253 bool GetSendStreamPacketIndex(void* data, int in_len, int64_t* index);
249 254
250 static bool Init(); 255 static bool Init();
251 void HandleEvent(const srtp_event_data_t* ev); 256 void HandleEvent(const srtp_event_data_t* ev);
252 static void HandleEventThunk(srtp_event_data_t* ev); 257 static void HandleEventThunk(srtp_event_data_t* ev);
253 258
254 rtc::ThreadChecker thread_checker_; 259 rtc::ThreadChecker thread_checker_;
255 srtp_ctx_t_* session_ = nullptr; 260 srtp_ctx_t_* session_ = nullptr;
256 int rtp_auth_tag_len_ = 0; 261 int rtp_auth_tag_len_ = 0;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 std::map<FailureKey, FailureStat> failures_; 337 std::map<FailureKey, FailureStat> failures_;
333 // Threshold in ms to silent the signaling errors. 338 // Threshold in ms to silent the signaling errors.
334 int signal_silent_time_; 339 int signal_silent_time_;
335 340
336 RTC_DISALLOW_COPY_AND_ASSIGN(SrtpStat); 341 RTC_DISALLOW_COPY_AND_ASSIGN(SrtpStat);
337 }; 342 };
338 343
339 } // namespace cricket 344 } // namespace cricket
340 345
341 #endif // WEBRTC_PC_SRTPFILTER_H_ 346 #endif // WEBRTC_PC_SRTPFILTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698