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

Unified Diff: webrtc/pc/srtpfilter.h

Issue 2722423003: Improve testing of SRTP external auth code paths. (Closed)
Patch Set: Created 3 years, 10 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 46b9dea19f38400abdb38f56cabc2eeece1197fb..3412ac4dfaf05b698fadcf6ad880ea1ca404698e 100644
--- a/webrtc/pc/srtpfilter.h
+++ b/webrtc/pc/srtpfilter.h
@@ -114,12 +114,16 @@ class SrtpFilter {
// Returns srtp overhead for rtp packets.
bool GetSrtpOverhead(int* srtp_overhead) const;
-#if defined(ENABLE_EXTERNAL_AUTH)
+ void AllowExternalAuthForTest(bool allow);
+
+ // External auth is only allowed if ENABLE_EXTERNAL_AUTH is defined or
+ // it has been explicitly activated for tests.
Taylor Brandstetter 2017/03/03 02:20:34 Is there any comment in general explaining what ex
joachim 2017/03/03 20:42:57 There is a comment in channel.cc (BaseChannel::Sen
+ bool IsExternalAuthAllowed() const;
+
// A SRTP filter supports external creation of the auth tag if a non-GCM
// cipher is used. This method is only valid after the RTP params have
// been set.
bool IsExternalAuthActive() const;
-#endif
// Update the silent threshold (in ms) for signaling errors.
void set_signal_silent_time(int signal_silent_time_in_ms);
@@ -169,8 +173,9 @@ class SrtpFilter {
// ST_INIT.
ST_RECEIVEDPRANSWER
};
- State state_;
- int signal_silent_time_in_ms_;
+ State state_ = ST_INIT;
+ int signal_silent_time_in_ms_ = 0;
+ bool external_auth_allowed_ = false;
std::vector<CryptoParams> offer_params_;
std::unique_ptr<SrtpSession> send_session_;
std::unique_ptr<SrtpSession> recv_session_;
@@ -213,12 +218,16 @@ class SrtpSession {
int GetSrtpOverhead() const;
-#if defined(ENABLE_EXTERNAL_AUTH)
+ void AllowExternalAuthForTest(bool allow);
+
+ // External auth is only allowed if ENABLE_EXTERNAL_AUTH is defined or
+ // it has been explicitly activated for tests.
+ bool IsExternalAuthAllowed() const;
+
// A SRTP session supports external creation of the auth tag if a non-GCM
// cipher is used. This method is only valid after the RTP params have
// been set.
bool IsExternalAuthActive() const;
-#endif
// Update the silent threshold (in ms) for signaling errors.
void set_signal_silent_time(int signal_silent_time_in_ms);
@@ -246,9 +255,8 @@ class SrtpSession {
static bool inited_;
static rtc::GlobalLockPod lock_;
int last_send_seq_num_ = -1;
-#if defined(ENABLE_EXTERNAL_AUTH)
bool external_auth_active_ = false;
-#endif
+ bool external_auth_allowed_ = false;
RTC_DISALLOW_COPY_AND_ASSIGN(SrtpSession);
};
« no previous file with comments | « webrtc/pc/externalhmac.cc ('k') | webrtc/pc/srtpfilter.cc » ('j') | webrtc/pc/srtpfilter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698