Don't call CRYPTO_add in BoringSSL.

The old OpenSSL threading hooks were removed in favor of the library knowing
about threads internally. Instead of CRYPTO_add, use FOO_up_ref wrappers that
don't require reaching into the type.

BUG=none
R=jiayl@webrtc.org, juberti@google.com

Review URL: https://webrtc-codereview.appspot.com/54579004

Cr-Commit-Position: refs/heads/master@{#9324}
diff --git a/webrtc/base/opensslidentity.cc b/webrtc/base/opensslidentity.cc
index 9daad9b..dbb040e 100644
--- a/webrtc/base/opensslidentity.cc
+++ b/webrtc/base/opensslidentity.cc
@@ -157,7 +157,11 @@
 }
 
 void OpenSSLKeyPair::AddReference() {
+#if defined(OPENSSL_IS_BORINGSSL)
+  EVP_PKEY_up_ref(pkey_);
+#else
   CRYPTO_add(&pkey_->references, 1, CRYPTO_LOCK_EVP_PKEY);
+#endif
 }
 
 #ifdef _DEBUG
@@ -341,7 +345,11 @@
 
 void OpenSSLCertificate::AddReference() const {
   ASSERT(x509_ != NULL);
+#if defined(OPENSSL_IS_BORINGSSL)
+  X509_up_ref(x509_);
+#else
   CRYPTO_add(&x509_->references, 1, CRYPTO_LOCK_X509);
+#endif
 }
 
 OpenSSLIdentity::OpenSSLIdentity(OpenSSLKeyPair* key_pair,