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

Unified Diff: net/cert/x509_util_openssl.cc

Issue 2682413003: Add a CRYPTO_BUFFER_POOL to SSLClientSocketImpl. (Closed)
Patch Set: Created 3 years, 10 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 | « net/cert/x509_util_openssl.h ('k') | net/socket/ssl_client_socket_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/x509_util_openssl.cc
diff --git a/net/cert/x509_util_openssl.cc b/net/cert/x509_util_openssl.cc
index 4a2aba01dc60aa7df5163741d2faab3526e25f96..4e79ad8a2115cad3b04d4e9048ad8efe7e094be1 100644
--- a/net/cert/x509_util_openssl.cc
+++ b/net/cert/x509_util_openssl.cc
@@ -25,6 +25,7 @@
#include "third_party/boringssl/src/include/openssl/asn1.h"
#include "third_party/boringssl/src/include/openssl/digest.h"
#include "third_party/boringssl/src/include/openssl/mem.h"
+#include "third_party/boringssl/src/include/openssl/pool.h"
namespace net {
@@ -190,6 +191,19 @@ class DERCacheInitSingleton {
base::LazyInstance<DERCacheInitSingleton>::Leaky g_der_cache_singleton =
LAZY_INSTANCE_INITIALIZER;
+class BufferPoolSingleton {
+ public:
+ BufferPoolSingleton() : pool_(CRYPTO_BUFFER_POOL_new()) {}
+ CRYPTO_BUFFER_POOL* pool() { return pool_; }
+
+ private:
+ // The singleton is leaky, so there is no need to use a smart pointer.
+ CRYPTO_BUFFER_POOL* pool_;
+};
+
+base::LazyInstance<BufferPoolSingleton>::Leaky g_buffer_pool_singleton =
+ LAZY_INSTANCE_INITIALIZER;
+
} // namespace
bool CreateSelfSignedCert(crypto::RSAPrivateKey* key,
@@ -347,6 +361,10 @@ bool GetTLSServerEndPointChannelBinding(const X509Certificate& certificate,
return true;
}
+CRYPTO_BUFFER_POOL* GetBufferPool() {
+ return g_buffer_pool_singleton.Get().pool();
+}
+
} // namespace x509_util
} // namespace net
« no previous file with comments | « net/cert/x509_util_openssl.h ('k') | net/socket/ssl_client_socket_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698