mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-23 01:49:53 +03:00
Merge pull request #953 from neheb/op
Merge PR #953: Deprecated OpenSSL API fixes.
This commit is contained in:
commit
3f9b610c80
@ -12,7 +12,7 @@ build_openssl () {
|
||||
if [[ "$(cat ${OPENSSL_INSTALL_DIR}/.openssl-version)" != "${OPENSSL_VERSION}" ]]; then
|
||||
tar zxf "download-cache/openssl-${OPENSSL_VERSION}.tar.gz"
|
||||
cd "openssl-${OPENSSL_VERSION}/"
|
||||
./config shared --prefix="${OPENSSL_INSTALL_DIR}" --openssldir="${OPENSSL_INSTALL_DIR}" -DPURIFY
|
||||
./config shared no-deprecated --prefix="${OPENSSL_INSTALL_DIR}" --openssldir="${OPENSSL_INSTALL_DIR}" -DPURIFY
|
||||
make -j $(nproc || sysctl -n hw.ncpu || echo 4) all
|
||||
make install_sw
|
||||
echo "${OPENSSL_VERSION}" > "${OPENSSL_INSTALL_DIR}/.openssl-version"
|
||||
|
@ -758,10 +758,18 @@ 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()
|
||||
{
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
|
||||
UINT i;
|
||||
|
||||
// Initialization of the lock object
|
||||
@ -774,14 +782,14 @@ 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
|
||||
}
|
||||
|
||||
// Release of the lock of OpenSSL
|
||||
void OpenSSL_FreeLock()
|
||||
{
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
|
||||
UINT i;
|
||||
|
||||
for (i = 0;i < ssl_lock_num;i++)
|
||||
@ -792,14 +800,14 @@ void OpenSSL_FreeLock()
|
||||
ssl_lock_obj = NULL;
|
||||
|
||||
CRYPTO_set_locking_callback(NULL);
|
||||
CRYPTO_set_id_callback(NULL);
|
||||
CRYPTO_THREADID_set_callback(NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Lock function for OpenSSL
|
||||
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];
|
||||
|
||||
if (mode & CRYPTO_LOCK)
|
||||
@ -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);
|
||||
@ -3729,7 +3731,7 @@ void FreeCryptLibrary()
|
||||
openssl_lock = NULL;
|
||||
// RAND_Free_For_SoftEther();
|
||||
OpenSSL_FreeLock();
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
|
||||
#ifdef OPENSSL_FIPS
|
||||
FIPS_mode_set(0);
|
||||
#endif
|
||||
@ -3754,7 +3756,7 @@ void InitCryptLibrary()
|
||||
{
|
||||
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()
|
||||
openssl_lock = NewLock();
|
||||
SSL_library_init();
|
||||
|
@ -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