Locking is no longer required with BoringSSL.

BoringSSL handles locking internally, so the various callback methods
are no longer required in this case.

R=juberti@webrtc.org

Review URL: https://codereview.webrtc.org/1158573008

Cr-Commit-Position: refs/heads/master@{#9388}
diff --git a/webrtc/base/openssladapter.cc b/webrtc/base/openssladapter.cc
index 56610fa..c906ebb 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 @@
   MUTEX_TYPE mutex;
 };
 
+#endif  // #ifndef OPENSSL_IS_BORINGSSL
+
 //////////////////////////////////////////////////////////////////////
 // SocketBIO
 //////////////////////////////////////////////////////////////////////
@@ -172,6 +176,8 @@
 
 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 @@
   delete l;
 }
 
+#endif  // #ifndef OPENSSL_IS_BORINGSSL
+
 VerificationCallback OpenSSLAdapter::custom_verify_callback_ = NULL;
 
 bool OpenSSLAdapter::InitializeSSL(VerificationCallback callback) {
@@ -230,6 +238,9 @@
 }
 
 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 @@
   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 @@
     MUTEX_CLEANUP(mutex_buf[i]);
   delete [] mutex_buf;
   mutex_buf = NULL;
+#endif  // #ifndef OPENSSL_IS_BORINGSSL
   return true;
 }