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

Unified Diff: webrtc/base/openssladapter.cc

Issue 1158573008: Locking is no longer required with BoringSSL. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/openssladapter.cc
diff --git a/webrtc/base/openssladapter.cc b/webrtc/base/openssladapter.cc
index 56610fa240dfeae26f1aacdd6e115209632e7f87..c906ebb4b49b27e302886aa1c3088879d84f2659 100644
--- a/webrtc/base/openssladapter.cc
+++ b/webrtc/base/openssladapter.cc
@@ -39,6 +39,8 @@
#include "webrtc/base/stringutils.h"
#include "webrtc/base/thread.h"
+#ifndef OPENSSL_IS_BORINGSSL
+
// TODO: Use a nicer abstraction for mutex.
#if defined(WEBRTC_WIN)
@@ -63,6 +65,8 @@ struct CRYPTO_dynlock_value {
MUTEX_TYPE mutex;
};
+#endif // #ifndef OPENSSL_IS_BORINGSSL
+
//////////////////////////////////////////////////////////////////////
// SocketBIO
//////////////////////////////////////////////////////////////////////
@@ -172,6 +176,8 @@ static long socket_ctrl(BIO* b, int cmd, long num, void* ptr) {
namespace rtc {
+#ifndef OPENSSL_IS_BORINGSSL
+
// This array will store all of the mutexes available to OpenSSL.
static MUTEX_TYPE* mutex_buf = NULL;
@@ -213,6 +219,8 @@ static void dyn_destroy_function(CRYPTO_dynlock_value* l,
delete l;
}
+#endif // #ifndef OPENSSL_IS_BORINGSSL
+
VerificationCallback OpenSSLAdapter::custom_verify_callback_ = NULL;
bool OpenSSLAdapter::InitializeSSL(VerificationCallback callback) {
@@ -230,6 +238,9 @@ bool OpenSSLAdapter::InitializeSSL(VerificationCallback callback) {
}
bool OpenSSLAdapter::InitializeSSLThread() {
+ // BoringSSL is doing the locking internally, so the callbacks are not used
+ // in this case (and are no-ops anyways).
+#ifndef OPENSSL_IS_BORINGSSL
mutex_buf = new MUTEX_TYPE[CRYPTO_num_locks()];
if (!mutex_buf)
return false;
@@ -243,10 +254,12 @@ bool OpenSSLAdapter::InitializeSSLThread() {
CRYPTO_set_dynlock_create_callback(dyn_create_function);
CRYPTO_set_dynlock_lock_callback(dyn_lock_function);
CRYPTO_set_dynlock_destroy_callback(dyn_destroy_function);
+#endif // #ifndef OPENSSL_IS_BORINGSSL
return true;
}
bool OpenSSLAdapter::CleanupSSL() {
+#ifndef OPENSSL_IS_BORINGSSL
if (!mutex_buf)
return false;
CRYPTO_set_id_callback(NULL);
@@ -258,6 +271,7 @@ bool OpenSSLAdapter::CleanupSSL() {
MUTEX_CLEANUP(mutex_buf[i]);
delete [] mutex_buf;
mutex_buf = NULL;
+#endif // #ifndef OPENSSL_IS_BORINGSSL
return true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698