mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-12-27 10:39:53 +03:00
Switch to OpenSSL THREADID API
The old threading API was deprecated in OpenSSL 1.0.
This commit is contained in:
parent
24f426162c
commit
a9f707c813
@ -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);
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user