mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-14 18:02:31 +08:00
Remove unused OpenSSL code
This commit is contained in:
parent
8a6bb8611a
commit
8b77c8d79a
@ -29,13 +29,6 @@ else()
|
||||
if(OPENSSL_FOUND)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||
set(WITH_TLS ON)
|
||||
add_compile_options(-DHAVE_OPENSSL)
|
||||
check_symbol_exists("OPENSSL_INIT_NO_ATEXIT" "openssl/crypto.h" OPENSSL_HAS_NO_ATEXIT)
|
||||
if(OPENSSL_HAS_NO_ATEXIT)
|
||||
add_compile_options(-DHAVE_OPENSSL_INIT_NO_AT_EXIT)
|
||||
else()
|
||||
message(STATUS "Found OpenSSL without OPENSSL_INIT_NO_ATEXIT: assuming BoringSSL")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "OpenSSL was not found - Will compile without TLS Support")
|
||||
message(STATUS "You can set OPENSSL_ROOT_DIR to help cmake find it")
|
||||
|
@ -2188,10 +2188,8 @@ void setupNetwork(uint64_t transportId, UseMetrics useMetrics) {
|
||||
networkOptions.logClientInfo = true;
|
||||
|
||||
setupGlobalKnobs();
|
||||
TLS::DisableOpenSSLAtExitHandler();
|
||||
g_network = newNet2(tlsConfig, false, useMetrics || networkOptions.traceDirectory.present());
|
||||
g_network->addStopCallback(Net2FileSystem::stop);
|
||||
g_network->addStopCallback(TLS::DestroyOpenSSLGlobalState);
|
||||
FlowTransport::createInstance(true, transportId, WLTOKEN_RESERVED_COUNT);
|
||||
Net2FileSystem::newFileSystem();
|
||||
|
||||
|
@ -25,28 +25,6 @@
|
||||
// To force typeinfo to only be emitted once.
|
||||
TLSPolicy::~TLSPolicy() {}
|
||||
|
||||
namespace TLS {
|
||||
|
||||
void DisableOpenSSLAtExitHandler() {
|
||||
#ifdef HAVE_OPENSSL_INIT_NO_ATEXIT
|
||||
static bool once = false;
|
||||
if (!once) {
|
||||
once = true;
|
||||
int success = OPENSSL_init_crypto(OPENSSL_INIT_NO_ATEXIT, nullptr);
|
||||
if (!success) {
|
||||
throw tls_error();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void DestroyOpenSSLGlobalState() {
|
||||
#ifdef HAVE_OPENSSL_INIT_NO_ATEXIT
|
||||
OPENSSL_cleanup();
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace TLS
|
||||
#ifdef TLS_DISABLED
|
||||
|
||||
void LoadedTLSConfig::print(FILE* fp) {
|
||||
|
@ -37,22 +37,6 @@
|
||||
#include "flow/Knobs.h"
|
||||
#include "flow/flow.h"
|
||||
|
||||
namespace TLS {
|
||||
|
||||
// Force OpenSSL to not register an atexit handler to clean up global state before process exit.
|
||||
// If you call this, you must also call DestroyOpenSSLGlobalState() before the program exits.
|
||||
// Calls OPENSSL_init_crypto with OPENSSL_INIT_NO_ATEXIT.
|
||||
// Must be called before any other OpenSSL function.
|
||||
void DisableOpenSSLAtExitHandler();
|
||||
|
||||
// Frees all global state maintained by OpenSSL.
|
||||
// Calls OPENSSL_cleanup.
|
||||
// Must be called before program exit if using DisableOpenSSLAtExitHandler.
|
||||
// No OpenSSL code may be run after calling this function.
|
||||
void DestroyOpenSSLGlobalState();
|
||||
|
||||
} // namespace TLS
|
||||
|
||||
#ifndef TLS_DISABLED
|
||||
|
||||
#include <openssl/x509.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user