mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-26 19:39:53 +03:00
Encrypt: improve FreeOpenSSLThreadState() and FreeCryptLibrary(), in order to clean up the library correctly
https://wiki.openssl.org/index.php/Library_Initialization#Cleanup
This commit is contained in:
parent
1e8cf1dc5d
commit
2da755135a
@ -3643,9 +3643,14 @@ void Rand(void *buf, UINT size)
|
|||||||
// Delete a thread-specific information that OpenSSL has holded
|
// Delete a thread-specific information that OpenSSL has holded
|
||||||
void FreeOpenSSLThreadState()
|
void FreeOpenSSLThreadState()
|
||||||
{
|
{
|
||||||
|
CRYPTO_cleanup_all_ex_data();
|
||||||
ERR_remove_state(0);
|
ERR_remove_state(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||||
|
#define SSL_COMP_free_compression_methods() (sk_free(SSL_COMP_get_compression_methods()))
|
||||||
|
#endif
|
||||||
|
|
||||||
// Release the Crypt library
|
// Release the Crypt library
|
||||||
void FreeCryptLibrary()
|
void FreeCryptLibrary()
|
||||||
{
|
{
|
||||||
@ -3655,6 +3660,17 @@ void FreeCryptLibrary()
|
|||||||
openssl_lock = NULL;
|
openssl_lock = NULL;
|
||||||
// RAND_Free_For_SoftEther();
|
// RAND_Free_For_SoftEther();
|
||||||
OpenSSL_FreeLock();
|
OpenSSL_FreeLock();
|
||||||
|
|
||||||
|
FIPS_mode_set(0);
|
||||||
|
ENGINE_cleanup();
|
||||||
|
CONF_modules_unload(1);
|
||||||
|
EVP_cleanup();
|
||||||
|
|
||||||
|
FreeOpenSSLThreadState();
|
||||||
|
|
||||||
|
ERR_free_strings();
|
||||||
|
|
||||||
|
SSL_COMP_free_compression_methods();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the Crypt library
|
// Initialize the Crypt library
|
||||||
|
Loading…
Reference in New Issue
Block a user