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

Unified Diff: webrtc/p2p/base/fakedtlstransport.h

Issue 2815513012: Negotiate the same SRTP crypto suites for every DTLS association formed. (Closed)
Patch Set: Merge with master Created 3 years, 8 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
« no previous file with comments | « webrtc/p2p/base/dtlstransportinternal.h ('k') | webrtc/p2p/base/faketransportcontroller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/fakedtlstransport.h
diff --git a/webrtc/p2p/base/fakedtlstransport.h b/webrtc/p2p/base/fakedtlstransport.h
index da3537f1fd9ec0f0e76b75e5201c1763d65a666e..9d5859c4dd51a8c7c968c69a940b35459cc8f505 100644
--- a/webrtc/p2p/base/fakedtlstransport.h
+++ b/webrtc/p2p/base/fakedtlstransport.h
@@ -86,7 +86,6 @@ class FakeDtlsTransport : public DtlsTransportInternal {
dest_ = dest;
if (local_cert_ && dest_->local_cert_) {
do_dtls_ = true;
- NegotiateSrtpCiphers();
}
SetWritable(true);
if (!asymmetric) {
@@ -132,16 +131,12 @@ class FakeDtlsTransport : public DtlsTransportInternal {
remote_cert_ = cert;
}
bool IsDtlsActive() const override { return do_dtls_; }
- bool SetSrtpCryptoSuites(const std::vector<int>& ciphers) override {
- srtp_ciphers_ = ciphers;
- return true;
- }
bool GetSrtpCryptoSuite(int* crypto_suite) override {
- if (chosen_crypto_suite_ != rtc::SRTP_INVALID_CRYPTO_SUITE) {
- *crypto_suite = chosen_crypto_suite_;
- return true;
+ if (!do_dtls_) {
+ return false;
}
- return false;
+ *crypto_suite = rtc::SRTP_AES128_CM_SHA1_80;
+ return true;
}
bool GetSslCipherSuite(int* cipher_suite) override { return false; }
rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate() const override {
@@ -159,12 +154,11 @@ class FakeDtlsTransport : public DtlsTransportInternal {
bool use_context,
uint8_t* result,
size_t result_len) override {
- if (chosen_crypto_suite_ != rtc::SRTP_INVALID_CRYPTO_SUITE) {
- memset(result, 0xff, result_len);
- return true;
+ if (!do_dtls_) {
+ return false;
}
-
- return false;
+ memset(result, 0xff, result_len);
+ return true;
}
void set_ssl_max_protocol_version(rtc::SSLProtocolVersion version) {
ssl_max_version_ = version;
@@ -172,13 +166,6 @@ class FakeDtlsTransport : public DtlsTransportInternal {
rtc::SSLProtocolVersion ssl_max_protocol_version() const {
return ssl_max_version_;
}
- bool SetSrtpCiphers(const std::vector<std::string>& ciphers) override {
- std::vector<int> crypto_suites;
- for (const auto cipher : ciphers) {
- crypto_suites.push_back(rtc::SrtpCryptoSuiteFromName(cipher));
- }
- return SetSrtpCryptoSuites(crypto_suites);
- }
IceTransportInternal* ice_transport() override { return ice_transport_; }
@@ -213,19 +200,6 @@ class FakeDtlsTransport : public DtlsTransportInternal {
SignalReadPacket(this, data, len, time, flags);
}
- void NegotiateSrtpCiphers() {
- for (std::vector<int>::const_iterator it1 = srtp_ciphers_.begin();
- it1 != srtp_ciphers_.end(); ++it1) {
- for (std::vector<int>::const_iterator it2 = dest_->srtp_ciphers_.begin();
- it2 != dest_->srtp_ciphers_.end(); ++it2) {
- if (*it1 == *it2) {
- chosen_crypto_suite_ = *it1;
- return;
- }
- }
- }
- }
-
void set_receiving(bool receiving) {
if (receiving_ == receiving) {
return;
@@ -253,8 +227,6 @@ class FakeDtlsTransport : public DtlsTransportInternal {
rtc::scoped_refptr<rtc::RTCCertificate> local_cert_;
rtc::FakeSSLCertificate* remote_cert_ = nullptr;
bool do_dtls_ = false;
- std::vector<int> srtp_ciphers_;
- int chosen_crypto_suite_ = rtc::SRTP_INVALID_CRYPTO_SUITE;
rtc::SSLProtocolVersion ssl_max_version_ = rtc::SSL_PROTOCOL_DTLS_12;
rtc::SSLFingerprint dtls_fingerprint_;
rtc::SSLRole ssl_role_ = rtc::SSL_CLIENT;
« no previous file with comments | « webrtc/p2p/base/dtlstransportinternal.h ('k') | webrtc/p2p/base/faketransportcontroller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698