From 483f7edce871905077d99b975cf006db37e7114b Mon Sep 17 00:00:00 2001 From: Joel Goguen Date: Thu, 2 Apr 2015 16:37:50 -0700 Subject: [PATCH] Add static method to skip SSL init Summary: Some things like gSOAP, initialize SSL only to have SSLContext stomp over their work. Add a method to allow flagging SSLContext as "initialized" to use the existing global state. Test Plan: Tested running mcrouter and paymentnegined to verify existing functionality appears normal. Reviewed By: subodh@fb.com Subscribers: ssl-diffs@, folly-diffs@, yfeldblum, chalfant, dihde FB internal diff: D1959936 Tasks: 6655251 Signature: t1:1959936:1427994292:8b2be1742ef17a5ec2c7b3ad37787d2cf4d142a6 --- folly/io/async/SSLContext.cpp | 5 +++++ folly/io/async/SSLContext.h | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/folly/io/async/SSLContext.cpp b/folly/io/async/SSLContext.cpp index c05fe330..38dddf97 100644 --- a/folly/io/async/SSLContext.cpp +++ b/folly/io/async/SSLContext.cpp @@ -682,6 +682,11 @@ void SSLContext::setSSLLockTypes(std::map inLockTypes) { lockTypes() = inLockTypes; } +void SSLContext::markInitialized() { + std::lock_guard g(mutex_); + initialized_ = true; +} + void SSLContext::initializeOpenSSL() { std::lock_guard g(mutex_); initializeOpenSSLLocked(); diff --git a/folly/io/async/SSLContext.h b/folly/io/async/SSLContext.h index 6947ac7f..7101b561 100644 --- a/folly/io/async/SSLContext.h +++ b/folly/io/async/SSLContext.h @@ -403,6 +403,13 @@ class SSLContext { static void initializeOpenSSL(); static void cleanupOpenSSL(); + /** + * Mark openssl as initialized without actually performing any initialization. + * Please use this only if you are using a library which requires that it must + * make its own calls to SSL_library_init() and related functions. + */ + static void markInitialized(); + /** * Default randomize method. */ -- 2.34.1