Update libjingle to 61514460
TBR=tommi@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/8649004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@5545 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/talk/base/opensslstreamadapter.cc b/talk/base/opensslstreamadapter.cc
index 576b4245..cafef92 100644
--- a/talk/base/opensslstreamadapter.cc
+++ b/talk/base/opensslstreamadapter.cc
@@ -37,7 +37,6 @@
#include <openssl/crypto.h>
#include <openssl/err.h>
#include <openssl/rand.h>
-#include <openssl/ssl.h>
#include <openssl/x509v3.h>
#include <vector>
@@ -45,6 +44,7 @@
#include "talk/base/common.h"
#include "talk/base/logging.h"
#include "talk/base/stream.h"
+#include "talk/base/openssl.h"
#include "talk/base/openssladapter.h"
#include "talk/base/openssldigest.h"
#include "talk/base/opensslidentity.h"
@@ -53,15 +53,6 @@
namespace talk_base {
-#if (OPENSSL_VERSION_NUMBER >= 0x10001000L)
-#define HAVE_DTLS_SRTP
-#endif
-
-#if (OPENSSL_VERSION_NUMBER >= 0x10000000L)
-#define HAVE_DTLS
-#endif
-
-#ifdef HAVE_DTLS_SRTP
// SRTP cipher suite table
struct SrtpCipherMapEntry {
const char* external_name;
@@ -74,7 +65,6 @@
{"AES_CM_128_HMAC_SHA1_32", "SRTP_AES128_CM_SHA1_32"},
{NULL, NULL}
};
-#endif
//////////////////////////////////////////////////////////////////////
// StreamBIO
@@ -248,7 +238,6 @@
bool use_context,
uint8* result,
size_t result_len) {
-#ifdef HAVE_DTLS_SRTP
int i;
i = SSL_export_keying_material(ssl_, result, result_len,
@@ -260,9 +249,6 @@
return false;
return true;
-#else
- return false;
-#endif
}
bool OpenSSLStreamAdapter::SetDtlsSrtpCiphers(
@@ -272,7 +258,6 @@
if (state_ != SSL_NONE)
return false;
-#ifdef HAVE_DTLS_SRTP
for (std::vector<std::string>::const_iterator cipher = ciphers.begin();
cipher != ciphers.end(); ++cipher) {
bool found = false;
@@ -298,13 +283,9 @@
srtp_ciphers_ = internal_ciphers;
return true;
-#else
- return false;
-#endif
}
bool OpenSSLStreamAdapter::GetDtlsSrtpCipher(std::string* cipher) {
-#ifdef HAVE_DTLS_SRTP
ASSERT(state_ == SSL_CONNECTED);
if (state_ != SSL_CONNECTED)
return false;
@@ -326,9 +307,6 @@
ASSERT(false); // This should never happen
return false;
-#else
- return false;
-#endif
}
int OpenSSLStreamAdapter::StartSSLWithServer(const char* server_name) {
@@ -665,14 +643,12 @@
case SSL_ERROR_WANT_READ: {
LOG(LS_VERBOSE) << " -- error want read";
-#ifdef HAVE_DTLS
struct timeval timeout;
if (DTLSv1_get_timeout(ssl_, &timeout)) {
int delay = timeout.tv_sec * 1000 + timeout.tv_usec/1000;
Thread::Current()->PostDelayed(delay, this, MSG_TIMEOUT, 0);
}
-#endif
}
break;
@@ -727,9 +703,7 @@
// Process our own messages and then pass others to the superclass
if (MSG_TIMEOUT == msg->message_id) {
LOG(LS_INFO) << "DTLS timeout expired";
-#ifdef HAVE_DTLS
DTLSv1_handle_timeout(ssl_);
-#endif
ContinueSSL();
} else {
StreamInterface::OnMessage(msg);
@@ -740,19 +714,11 @@
SSL_CTX *ctx = NULL;
if (role_ == SSL_CLIENT) {
-#ifdef HAVE_DTLS
ctx = SSL_CTX_new(ssl_mode_ == SSL_MODE_DTLS ?
DTLSv1_client_method() : TLSv1_client_method());
-#else
- ctx = SSL_CTX_new(TLSv1_client_method());
-#endif
} else {
-#ifdef HAVE_DTLS
ctx = SSL_CTX_new(ssl_mode_ == SSL_MODE_DTLS ?
DTLSv1_server_method() : TLSv1_server_method());
-#else
- ctx = SSL_CTX_new(TLSv1_server_method());
-#endif
}
if (ctx == NULL)
return NULL;
@@ -771,14 +737,12 @@
SSL_CTX_set_verify_depth(ctx, 4);
SSL_CTX_set_cipher_list(ctx, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
-#ifdef HAVE_DTLS_SRTP
if (!srtp_ciphers_.empty()) {
if (SSL_CTX_set_tlsext_use_srtp(ctx, srtp_ciphers_.c_str())) {
SSL_CTX_free(ctx);
return NULL;
}
}
-#endif
return ctx;
}
@@ -852,27 +816,15 @@
}
bool OpenSSLStreamAdapter::HaveDtls() {
-#ifdef HAVE_DTLS
return true;
-#else
- return false;
-#endif
}
bool OpenSSLStreamAdapter::HaveDtlsSrtp() {
-#ifdef HAVE_DTLS_SRTP
return true;
-#else
- return false;
-#endif
}
bool OpenSSLStreamAdapter::HaveExporter() {
-#ifdef HAVE_DTLS_SRTP
return true;
-#else
- return false;
-#endif
}
} // namespace talk_base