MCPcopy Create free account
hub / github.com/apache/thrift / cleanupOpenSSL

Function cleanupOpenSSL

lib/cpp/src/thrift/transport/TSSLSocket.cpp:144–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142}
143
144void cleanupOpenSSL() {
145 if (!openSSLInitialized) {
146 return;
147 }
148 openSSLInitialized = false;
149
150 // https://wiki.openssl.org/index.php/Library_Initialization#Cleanup
151 // we purposefully do NOT call FIPS_mode_set(0) and leave it up to the enclosing application to manage FIPS entirely
152#if (OPENSSL_VERSION_NUMBER < OPENSSL_ENGINE_CLEANUP_REQUIRED_BEFORE)
153 ENGINE_cleanup(); // https://www.openssl.org/docs/man1.1.0/crypto/ENGINE_cleanup.html - cleanup call is needed before 1.1.0
154#endif
155#if !defined(OPENSSL_IS_BORINGSSL) && !defined(OPENSSL_IS_AWSLC)
156 CONF_modules_unload(1);
157#endif
158 EVP_cleanup();
159 CRYPTO_cleanup_all_ex_data();
160#if OPENSSL_VERSION_NUMBER >= 0x10100000
161 // Do nothing unless an openssl derivative is detected
162# if !defined(OPENSSL_IS_BORINGSSL) && !defined(OPENSSL_IS_AWSLC)
163 // https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_thread_stop.html
164 OPENSSL_thread_stop();
165# endif
166#else
167 // ERR_remove_state() was deprecated in OpenSSL 1.0.0 and ERR_remove_thread_state()
168 // was deprecated in OpenSSL 1.1.0; these functions and should not be used.
169 // https://www.openssl.org/docs/manmaster/man3/ERR_remove_state.html
170 ERR_remove_state(0);
171#endif
172 ERR_free_strings();
173
174 mutexes.reset();
175}
176
177static void buildErrors(string& message, int errno_copy = 0, int sslerrno = 0);
178static bool matchName(const char* host, const char* pattern, int size);

Callers 6

~GlobalFixtureMethod · 0.85
~GlobalFixtureMethod · 0.85
~GlobalFixtureSSLMethod · 0.85
openssl_cleanupFunction · 0.85
~GlobalFixtureSSLMethod · 0.85
~TSSLSocketFactoryMethod · 0.85

Calls 1

resetMethod · 0.45

Tested by 5

~GlobalFixtureMethod · 0.68
~GlobalFixtureMethod · 0.68
~GlobalFixtureSSLMethod · 0.68
openssl_cleanupFunction · 0.68
~GlobalFixtureSSLMethod · 0.68