1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-09-18 01:33:00 +03:00

Switch to OpenSSL THREADID API

The old threading API was deprecated in OpenSSL 1.0.
This commit is contained in:
Rosen Penev 2019-07-22 09:40:43 -07:00
parent 24f426162c
commit a9f707c813
No known key found for this signature in database
GPG Key ID: 36D31CFA845F0E3B
2 changed files with 10 additions and 9 deletions

View File

@ -758,6 +758,14 @@ BUF *BigNumToBuf(const BIGNUM *bn)
return b;
}
#if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
// Return the thread ID
static void OpenSSL_Id(CRYPTO_THREADID *id)
{
CRYPTO_THREADID_set_numeric(id, (unsigned long)ThreadId());
}
#endif
// Initialization of the lock of OpenSSL
void OpenSSL_InitLock()
{
@ -774,7 +782,7 @@ void OpenSSL_InitLock()
// Setting the lock function
CRYPTO_set_locking_callback(OpenSSL_Lock);
CRYPTO_set_id_callback(OpenSSL_Id);
CRYPTO_THREADID_set_callback(OpenSSL_Id);
#endif
}
@ -792,7 +800,7 @@ void OpenSSL_FreeLock()
ssl_lock_obj = NULL;
CRYPTO_set_locking_callback(NULL);
CRYPTO_set_id_callback(NULL);
CRYPTO_THREADID_set_callback(NULL);
#endif
}
@ -815,12 +823,6 @@ void OpenSSL_Lock(int mode, int n, const char *file, int line)
#endif
}
// Return the thread ID
unsigned long OpenSSL_Id(void)
{
return (unsigned long)ThreadId();
}
char *OpenSSL_Error()
{
return ERR_error_string(ERR_get_error(), NULL);

View File

@ -416,7 +416,6 @@ bool IsAesNiSupported();
void OpenSSL_InitLock();
void OpenSSL_FreeLock();
void OpenSSL_Lock(int mode, int n, const char *file, int line);
unsigned long OpenSSL_Id(void);
void FreeOpenSSLThreadState();
char *OpenSSL_Error();