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

Unified Diff: webrtc/pc/srtpfilter.h

Issue 2761143002: Support encrypted RTP extensions (RFC 6904) (Closed)
Patch Set: Various changes based on feedback from Peter and Taylor. 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..9e1197e1bd8f9cb84b727a6a29ca534465f6fd79 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,
@@ -143,6 +150,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 +194,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.
@@ -195,10 +206,12 @@ 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 SetSend(int cs, const uint8_t* key, size_t len,
+ const std::vector<int>& encrypted_header_extensions);
// 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 SetRecv(int cs, const uint8_t* key, size_t len,
+ 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 +256,8 @@ class SrtpSession {
SignalSrtpError;
private:
- bool SetKey(int type, int cs, const uint8_t* key, size_t len);
+ bool SetKeyAndEncryptedHeaderExtensions(int type, int cs, const uint8_t* key,
+ size_t len, 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);

Powered by Google App Engine
This is Rietveld 408576698