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

Unified Diff: webrtc/pc/srtpfilter.h

Issue 2761143002: Support encrypted RTP extensions (RFC 6904) (Closed)
Patch Set: More updates + support for adding/changing encrypted extensions. 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/pc/srtpfilter.h
diff --git a/webrtc/pc/srtpfilter.h b/webrtc/pc/srtpfilter.h
index 3df787646c740eb819f93986e697de0daabf1237..1e247a6244ed887edbc4fafad3453adc3eb5f0a3 100644
--- a/webrtc/pc/srtpfilter.h
+++ b/webrtc/pc/srtpfilter.h
@@ -23,6 +23,7 @@
#include "webrtc/base/sigslotrepeater.h"
#include "webrtc/base/sslstreamadapter.h"
#include "webrtc/base/thread_checker.h"
+#include "webrtc/config.h"
#include "webrtc/media/base/cryptoparams.h"
#include "webrtc/p2p/base/sessiondescription.h"
@@ -78,6 +79,12 @@ class SrtpFilter {
bool SetAnswer(const std::vector<CryptoParams>& answer_params,
ContentSource source);
+ // Set the header extensions that should be encrypted for the given source.
+ // Only header extensions that should be encrypted for both sides will be
+ // encrypted.
+ void SetEncryptedHeaderExtensions(ContentSource source,
+ const std::vector<webrtc::RtpExtension>& extensions);
+
// Just set up both sets of keys directly.
// Used with DTLS-SRTP.
bool SetRtpParams(int send_cs,
@@ -86,6 +93,12 @@ class SrtpFilter {
int recv_cs,
const uint8_t* recv_key,
int recv_key_len);
+ bool UpdateRtpParams(int send_cs,
+ const uint8_t* send_key,
+ int send_key_len,
+ int recv_cs,
+ const uint8_t* recv_key,
+ int recv_key_len);
bool SetRtcpParams(int send_cs,
const uint8_t* send_key,
int send_key_len,
@@ -143,6 +156,8 @@ class SrtpFilter {
ContentSource source,
bool final);
void CreateSrtpSessions();
+ void GetSendRecvEncryptedHeaderExtensions(
+ std::vector<int>* send_extensions, std::vector<int>* recv_extensions);
bool NegotiateParams(const std::vector<CryptoParams>& answer_params,
CryptoParams* selected_params);
bool ApplyParams(const CryptoParams& send_params,
@@ -185,6 +200,8 @@ class SrtpFilter {
std::unique_ptr<SrtpSession> recv_rtcp_session_;
CryptoParams applied_send_params_;
CryptoParams applied_recv_params_;
+ std::vector<webrtc::RtpExtension> local_encrypted_header_extensions_;
+ std::vector<webrtc::RtpExtension> remote_encrypted_header_extensions_;
};
// Class that wraps a libSRTP session.
@@ -196,9 +213,15 @@ class SrtpSession {
// Configures the session for sending data using the specified
// cipher-suite and key. Receiving must be done by a separate session.
bool SetSend(int cs, const uint8_t* key, size_t len);
+ bool UpdateSend(int cs, const uint8_t* key, size_t len);
+
// Configures the session for receiving data using the specified
// cipher-suite and key. Sending must be done by a separate session.
bool SetRecv(int cs, const uint8_t* key, size_t len);
+ bool UpdateRecv(int cs, const uint8_t* key, size_t len);
+
+ void SetEncryptedHeaderExtensions(
+ const std::vector<int>& encrypted_header_extensions);
// Encrypts/signs an individual RTP/RTCP packet, in-place.
// If an HMAC is used, this will increase the packet size.
@@ -243,7 +266,11 @@ class SrtpSession {
SignalSrtpError;
private:
+ bool DoSetKey(int type, int cs, const uint8_t* key, size_t len);
bool SetKey(int type, int cs, const uint8_t* key, size_t len);
+ bool UpdateKey(int type, int cs, const uint8_t* key, size_t len);
+ bool SetEncryptedHeaderExtensions(int type,
+ const std::vector<int>& encrypted_header_extensions);
// Returns send stream current packet index from srtp db.
bool GetSendStreamPacketIndex(void* data, int in_len, int64_t* index);
@@ -261,6 +288,7 @@ class SrtpSession {
int last_send_seq_num_ = -1;
bool external_auth_active_ = false;
bool external_auth_enabled_ = false;
+ std::vector<int> encrypted_header_extensions_;
RTC_DISALLOW_COPY_AND_ASSIGN(SrtpSession);
};

Powered by Google App Engine
This is Rietveld 408576698