Remove HAVE_SRTP define and unmaintained code.
It was defined unconditionally and the code for non-HAVE_SRTP was unmaintained and failed to compile. BUG=webrtc:7294 Review-Url: https://codereview.webrtc.org/2729373002 Cr-Commit-Position: refs/heads/master@{#17074}
This commit is contained in:
parent
0744a4766b
commit
eaa9c1db73
@ -131,7 +131,6 @@ config("common_config") {
|
||||
# targets, there's no point including the defines in that config here.
|
||||
# TODO(kjellander): Cleanup unused ones and move defines closer to the
|
||||
# source when webrtc:4256 is completed.
|
||||
"HAVE_SRTP",
|
||||
"HAVE_WEBRTC_VIDEO",
|
||||
"HAVE_WEBRTC_VOICE",
|
||||
"LOGGING_INSIDE_WEBRTC",
|
||||
|
||||
@ -19,7 +19,7 @@ group("pc") {
|
||||
}
|
||||
|
||||
config("rtc_pc_config") {
|
||||
defines = [ "HAVE_SRTP" ]
|
||||
defines = []
|
||||
if (rtc_enable_sctp) {
|
||||
defines += [ "HAVE_SCTP" ]
|
||||
}
|
||||
|
||||
@ -14,12 +14,8 @@
|
||||
|
||||
#include "webrtc/base/logging.h"
|
||||
|
||||
#ifdef HAVE_SRTP
|
||||
#include "third_party/libsrtp/crypto/include/crypto_kernel.h"
|
||||
#include "third_party/libsrtp/include/srtp.h"
|
||||
#endif // HAVE_SRTP
|
||||
|
||||
#if defined(HAVE_SRTP)
|
||||
|
||||
// Begin test case 0 */
|
||||
static const uint8_t kExternalHmacTestCase0Key[20] = {
|
||||
@ -150,5 +146,3 @@ srtp_err_status_t external_crypto_init() {
|
||||
}
|
||||
return srtp_err_status_ok;
|
||||
}
|
||||
|
||||
#endif // defined(HAVE_SRTP)
|
||||
|
||||
@ -30,11 +30,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef HAVE_SRTP
|
||||
#include "third_party/libsrtp/crypto/include/auth.h"
|
||||
#endif // HAVE_SRTP
|
||||
|
||||
#if defined(HAVE_SRTP)
|
||||
|
||||
#define EXTERNAL_HMAC_SHA1 SRTP_HMAC_SHA1 + 1
|
||||
#define HMAC_KEY_LENGTH 20
|
||||
@ -71,5 +67,4 @@ srtp_err_status_t external_hmac_compute(ExternalHmacContext* state,
|
||||
|
||||
srtp_err_status_t external_crypto_init();
|
||||
|
||||
#endif // defined(HAVE_SRTP)
|
||||
#endif // WEBRTC_PC_EXTERNALHMAC_H_
|
||||
|
||||
@ -39,13 +39,11 @@ void GetSupportedCryptoSuiteNames(void (*func)(const rtc::CryptoOptions&,
|
||||
std::vector<int>*),
|
||||
const rtc::CryptoOptions& crypto_options,
|
||||
std::vector<std::string>* names) {
|
||||
#ifdef HAVE_SRTP
|
||||
std::vector<int> crypto_suites;
|
||||
func(crypto_options, &crypto_suites);
|
||||
for (const auto crypto : crypto_suites) {
|
||||
names->push_back(rtc::SrtpCryptoSuiteToName(crypto));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@ -131,7 +129,6 @@ static bool CreateCryptoParams(int tag, const std::string& cipher,
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SRTP
|
||||
static bool AddCryptoParams(const std::string& cipher_suite,
|
||||
CryptoParamsVec *out) {
|
||||
int size = static_cast<int>(out->size());
|
||||
@ -160,7 +157,6 @@ bool CreateMediaCryptos(const std::vector<std::string>& crypto_suites,
|
||||
AddMediaCryptos(cryptos, media);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
const CryptoParamsVec* GetCryptos(const MediaContentDescription* media) {
|
||||
if (!media) {
|
||||
@ -185,14 +181,12 @@ bool FindMatchingCrypto(const CryptoParamsVec& cryptos,
|
||||
// For audio, HMAC 32 is prefered over HMAC 80 because of the low overhead.
|
||||
void GetSupportedAudioCryptoSuites(const rtc::CryptoOptions& crypto_options,
|
||||
std::vector<int>* crypto_suites) {
|
||||
#ifdef HAVE_SRTP
|
||||
if (crypto_options.enable_gcm_crypto_suites) {
|
||||
crypto_suites->push_back(rtc::SRTP_AEAD_AES_256_GCM);
|
||||
crypto_suites->push_back(rtc::SRTP_AEAD_AES_128_GCM);
|
||||
}
|
||||
crypto_suites->push_back(rtc::SRTP_AES128_CM_SHA1_32);
|
||||
crypto_suites->push_back(rtc::SRTP_AES128_CM_SHA1_80);
|
||||
#endif
|
||||
}
|
||||
|
||||
void GetSupportedAudioCryptoSuiteNames(const rtc::CryptoOptions& crypto_options,
|
||||
@ -225,13 +219,11 @@ void GetSupportedDataCryptoSuiteNames(const rtc::CryptoOptions& crypto_options,
|
||||
|
||||
void GetDefaultSrtpCryptoSuites(const rtc::CryptoOptions& crypto_options,
|
||||
std::vector<int>* crypto_suites) {
|
||||
#ifdef HAVE_SRTP
|
||||
if (crypto_options.enable_gcm_crypto_suites) {
|
||||
crypto_suites->push_back(rtc::SRTP_AEAD_AES_256_GCM);
|
||||
crypto_suites->push_back(rtc::SRTP_AEAD_AES_128_GCM);
|
||||
}
|
||||
crypto_suites->push_back(rtc::SRTP_AES128_CM_SHA1_80);
|
||||
#endif
|
||||
}
|
||||
|
||||
void GetDefaultSrtpCryptoSuiteNames(const rtc::CryptoOptions& crypto_options,
|
||||
@ -762,7 +754,6 @@ static bool CreateMediaContentOffer(
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SRTP
|
||||
if (secure_policy != SEC_DISABLED) {
|
||||
if (current_cryptos) {
|
||||
AddMediaCryptos(*current_cryptos, offer);
|
||||
@ -773,7 +764,6 @@ static bool CreateMediaContentOffer(
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (secure_policy == SEC_REQUIRED && offer->cryptos().empty()) {
|
||||
return false;
|
||||
|
||||
@ -25,13 +25,9 @@
|
||||
#include "webrtc/pc/mediasession.h"
|
||||
#include "webrtc/pc/srtpfilter.h"
|
||||
|
||||
#ifdef HAVE_SRTP
|
||||
#define ASSERT_CRYPTO(cd, s, cs) \
|
||||
ASSERT_EQ(s, cd->cryptos().size()); \
|
||||
ASSERT_EQ(std::string(cs), cd->cryptos()[0].cipher_suite)
|
||||
#else
|
||||
#define ASSERT_CRYPTO(cd, s, cs) ASSERT_EQ(0, cd->cryptos().size());
|
||||
#endif
|
||||
|
||||
typedef std::vector<cricket::Candidate> Candidates;
|
||||
|
||||
|
||||
@ -29,26 +29,11 @@
|
||||
|
||||
namespace cricket {
|
||||
|
||||
#ifndef HAVE_SRTP
|
||||
|
||||
// This helper function is used on systems that don't (yet) have SRTP,
|
||||
// to log that the functions that require it won't do anything.
|
||||
namespace {
|
||||
bool SrtpNotAvailable(const char *func) {
|
||||
LOG(LS_ERROR) << func << ": SRTP is not available on your system.";
|
||||
return false;
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
#endif // !HAVE_SRTP
|
||||
|
||||
// NOTE: This is called from ChannelManager D'tor.
|
||||
void ShutdownSrtp() {
|
||||
#ifdef HAVE_SRTP
|
||||
// If srtp_dealloc is not executed then this will clear all existing sessions.
|
||||
// This should be called when application is shutting down.
|
||||
SrtpSession::Terminate();
|
||||
#endif
|
||||
}
|
||||
|
||||
SrtpFilter::SrtpFilter() {
|
||||
@ -476,8 +461,6 @@ bool SrtpFilter::ParseKeyParams(const std::string& key_params,
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// SrtpSession
|
||||
|
||||
#ifdef HAVE_SRTP
|
||||
|
||||
bool SrtpSession::inited_ = false;
|
||||
|
||||
// This lock protects SrtpSession::inited_.
|
||||
@ -824,54 +807,9 @@ void SrtpSession::HandleEventThunk(srtp_event_data_t* ev) {
|
||||
}
|
||||
}
|
||||
|
||||
#else // !HAVE_SRTP
|
||||
|
||||
// On some systems, SRTP is not (yet) available.
|
||||
|
||||
SrtpSession::SrtpSession() {
|
||||
LOG(WARNING) << "SRTP implementation is missing.";
|
||||
}
|
||||
|
||||
SrtpSession::~SrtpSession() {
|
||||
}
|
||||
|
||||
bool SrtpSession::SetSend(const std::string& cs, const uint8_t* key, int len) {
|
||||
return SrtpNotAvailable(__FUNCTION__);
|
||||
}
|
||||
|
||||
bool SrtpSession::SetRecv(const std::string& cs, const uint8_t* key, int len) {
|
||||
return SrtpNotAvailable(__FUNCTION__);
|
||||
}
|
||||
|
||||
bool SrtpSession::ProtectRtp(void* data, int in_len, int max_len,
|
||||
int* out_len) {
|
||||
return SrtpNotAvailable(__FUNCTION__);
|
||||
}
|
||||
|
||||
bool SrtpSession::ProtectRtcp(void* data, int in_len, int max_len,
|
||||
int* out_len) {
|
||||
return SrtpNotAvailable(__FUNCTION__);
|
||||
}
|
||||
|
||||
bool SrtpSession::UnprotectRtp(void* data, int in_len, int* out_len) {
|
||||
return SrtpNotAvailable(__FUNCTION__);
|
||||
}
|
||||
|
||||
bool SrtpSession::UnprotectRtcp(void* data, int in_len, int* out_len) {
|
||||
return SrtpNotAvailable(__FUNCTION__);
|
||||
}
|
||||
|
||||
void SrtpSession::set_signal_silent_time(uint32_t signal_silent_time) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
#endif // HAVE_SRTP
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// SrtpStat
|
||||
|
||||
#ifdef HAVE_SRTP
|
||||
|
||||
SrtpStat::SrtpStat()
|
||||
: signal_silent_time_(1000) {
|
||||
}
|
||||
@ -939,35 +877,4 @@ void SrtpStat::HandleSrtpResult(const SrtpStat::FailureKey& key) {
|
||||
}
|
||||
}
|
||||
|
||||
#else // !HAVE_SRTP
|
||||
|
||||
// On some systems, SRTP is not (yet) available.
|
||||
|
||||
SrtpStat::SrtpStat()
|
||||
: signal_silent_time_(1000) {
|
||||
LOG(WARNING) << "SRTP implementation is missing.";
|
||||
}
|
||||
|
||||
void SrtpStat::AddProtectRtpResult(uint32_t ssrc, int result) {
|
||||
SrtpNotAvailable(__FUNCTION__);
|
||||
}
|
||||
|
||||
void SrtpStat::AddUnprotectRtpResult(uint32_t ssrc, int result) {
|
||||
SrtpNotAvailable(__FUNCTION__);
|
||||
}
|
||||
|
||||
void SrtpStat::AddProtectRtcpResult(int result) {
|
||||
SrtpNotAvailable(__FUNCTION__);
|
||||
}
|
||||
|
||||
void SrtpStat::AddUnprotectRtcpResult(int result) {
|
||||
SrtpNotAvailable(__FUNCTION__);
|
||||
}
|
||||
|
||||
void SrtpStat::HandleSrtpResult(const SrtpStat::FailureKey& key) {
|
||||
SrtpNotAvailable(__FUNCTION__);
|
||||
}
|
||||
|
||||
#endif // HAVE_SRTP
|
||||
|
||||
} // namespace cricket
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user