1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-09 03:00:41 +03:00

Fix LibreSSL support

My previous patch used a wrong if directive, which disabled removed
(de)initialization and threading for LibreSSL. This most likely causes
issues at runtime.
This commit is contained in:
Rosen Penev 2019-07-22 09:48:17 -07:00
parent a9f707c813
commit d57fc3524c
No known key found for this signature in database
GPG Key ID: 36D31CFA845F0E3B

View File

@ -758,7 +758,7 @@ BUF *BigNumToBuf(const BIGNUM *bn)
return b; return b;
} }
#if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
// Return the thread ID // Return the thread ID
static void OpenSSL_Id(CRYPTO_THREADID *id) static void OpenSSL_Id(CRYPTO_THREADID *id)
{ {
@ -769,7 +769,7 @@ static void OpenSSL_Id(CRYPTO_THREADID *id)
// Initialization of the lock of OpenSSL // Initialization of the lock of OpenSSL
void OpenSSL_InitLock() void OpenSSL_InitLock()
{ {
#if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
UINT i; UINT i;
// Initialization of the lock object // Initialization of the lock object
@ -789,7 +789,7 @@ void OpenSSL_InitLock()
// Release of the lock of OpenSSL // Release of the lock of OpenSSL
void OpenSSL_FreeLock() void OpenSSL_FreeLock()
{ {
#if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
UINT i; UINT i;
for (i = 0;i < ssl_lock_num;i++) for (i = 0;i < ssl_lock_num;i++)
@ -807,7 +807,7 @@ void OpenSSL_FreeLock()
// Lock function for OpenSSL // Lock function for OpenSSL
void OpenSSL_Lock(int mode, int n, const char *file, int line) void OpenSSL_Lock(int mode, int n, const char *file, int line)
{ {
#if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
LOCK *lock = ssl_lock_obj[n]; LOCK *lock = ssl_lock_obj[n];
if (mode & CRYPTO_LOCK) if (mode & CRYPTO_LOCK)
@ -3731,7 +3731,7 @@ void FreeCryptLibrary()
openssl_lock = NULL; openssl_lock = NULL;
// RAND_Free_For_SoftEther(); // RAND_Free_For_SoftEther();
OpenSSL_FreeLock(); OpenSSL_FreeLock();
#if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
#ifdef OPENSSL_FIPS #ifdef OPENSSL_FIPS
FIPS_mode_set(0); FIPS_mode_set(0);
#endif #endif
@ -3756,7 +3756,7 @@ void InitCryptLibrary()
{ {
char tmp[16]; char tmp[16];
#if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
// RAND_Init_For_SoftEther() // RAND_Init_For_SoftEther()
openssl_lock = NewLock(); openssl_lock = NewLock();
SSL_library_init(); SSL_library_init();