-diff --git a/src/Mayaqua/Encrypt.c b/src/Mayaqua/Encrypt.c
-index f3b3908..06b7fea 100644
--- a/src/Mayaqua/Encrypt.c
+++ b/src/Mayaqua/Encrypt.c
@@ -120,6 +120,7 @@
#include <openssl/des.h>\r
#include <openssl/aes.h>\r
#include <openssl/dh.h>\r
-@@ -625,7 +627,7 @@ UINT CipherProcess(CIPHER *c, void *iv, void *dest, void *src, UINT size)
+@@ -627,7 +629,7 @@ UINT CipherProcess(CIPHER *c, void *iv, void *dest, void *src, UINT size)
return 0;\r
}\r
\r
{\r
return 0;\r
}\r
-@@ -924,6 +926,7 @@ BUF *BigNumToBuf(const BIGNUM *bn)
+@@ -926,6 +928,7 @@ BUF *BigNumToBuf(const BIGNUM *bn)
// Initialization of the lock of OpenSSL\r
void OpenSSL_InitLock()\r
{\r
UINT i;\r
\r
// Initialization of the lock object\r
-@@ -937,11 +940,13 @@ void OpenSSL_InitLock()
+@@ -939,11 +942,13 @@ void OpenSSL_InitLock()
// Setting the lock function\r
CRYPTO_set_locking_callback(OpenSSL_Lock);\r
CRYPTO_set_id_callback(OpenSSL_Id);\r
UINT i;\r
\r
for (i = 0;i < ssl_lock_num;i++)\r
-@@ -953,11 +958,13 @@ void OpenSSL_FreeLock()
+@@ -955,11 +960,13 @@ void OpenSSL_FreeLock()
\r
CRYPTO_set_locking_callback(NULL);\r
CRYPTO_set_id_callback(NULL);\r
LOCK *lock = ssl_lock_obj[n];\r
\r
if (mode & CRYPTO_LOCK)\r
-@@ -970,12 +977,15 @@ void OpenSSL_Lock(int mode, int n, const char *file, int line)
+@@ -972,12 +979,15 @@ void OpenSSL_Lock(int mode, int n, const char *file, int line)
// Unlock\r
Unlock(lock);\r
}\r
}\r
\r
// Get the display name of the certificate\r
-@@ -1899,8 +1909,8 @@ X509 *NewX509(K *pub, K *priv, X *ca, NAME *name, UINT days, X_SERIAL *serial)
+@@ -1901,8 +1911,8 @@ X509 *NewX509(K *pub, K *priv, X *ca, NAME *name, UINT days, X_SERIAL *serial)
X509_set_version(x509, 2L);\r
\r
// Set the Expiration\r
if (!UINT64ToAsn1Time(t1, notBefore))\r
{\r
FreeX509(x509);\r
-@@ -2041,8 +2051,8 @@ X509 *NewRootX509(K *pub, K *priv, NAME *name, UINT days, X_SERIAL *serial)
+@@ -2043,8 +2053,8 @@ X509 *NewRootX509(K *pub, K *priv, NAME *name, UINT days, X_SERIAL *serial)
X509_set_version(x509, 2L);\r
\r
// Set the Expiration\r
}\r
\r
// Release the Crypt library\r
-@@ -4130,13 +4177,16 @@ void InitCryptLibrary()
+@@ -4130,12 +4177,14 @@ void InitCryptLibrary()
CheckIfIntelAesNiSupportedInit();\r
// RAND_Init_For_SoftEther()\r
openssl_lock = NewLock();\r
OpenSSL_add_all_digests();\r
ERR_load_crypto_strings();\r
SSL_load_error_strings();\r
--\r
-+#else\r
-+ OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL);\r
+#endif\r
- #ifdef OS_UNIX\r
- {\r
- char *name1 = "/dev/random";\r
+ \r
+ ssl_clientcert_index = SSL_get_ex_new_index(0, "struct SslClientCertInfo *", NULL, NULL, NULL);\r
+ \r
+--- a/src/Mayaqua/Encrypt.h
++++ b/src/Mayaqua/Encrypt.h
+@@ -105,7 +105,7 @@
+ #ifndef ENCRYPT_H\r
+ #define ENCRYPT_H\r
+ \r
+-#if OPENSSL_VERSION_NUMBER >= 0x10100000L\r
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(OPENSSL_NO_CHACHA) && !defined(LIBRESSL_VERSION_NUMBER)\r
+ #define USE_OPENSSL_AEAD_CHACHA20POLY1305\r
+ #endif\r
+ \r
+--- a/src/Mayaqua/Network.c
++++ b/src/Mayaqua/Network.c
+@@ -18172,7 +18172,7 @@ struct ssl_ctx_st *NewSSLCtx(bool server_mode)
+ SSL_CTX_set_ecdh_auto(ctx, 1);\r
+ #endif // SSL_CTX_set_ecdh_auto\r
+ \r
+-#if OPENSSL_VERSION_NUMBER >= 0x1010100fL\r
++#if OPENSSL_VERSION_NUMBER >= 0x1010100fL && !defined(LIBRESSL_VERSION_NUMBER)\r
+ // For compatibility with VPN 3.0 or older\r
+ SSL_CTX_set_security_level(ctx, 0);\r
+ #endif\r
+--- a/src/Mayaqua/Secure.c
++++ b/src/Mayaqua/Secure.c
+@@ -127,6 +127,7 @@
+ #include <openssl/pkcs7.h>\r
+ #include <openssl/pkcs12.h>\r
+ #include <openssl/rc4.h>\r
++#include <openssl/rsa.h>\r
+ #include <openssl/md5.h>\r
+ #include <openssl/sha.h>\r
+ #include <Mayaqua/Mayaqua.h>\r
-diff --git a/src/Mayaqua/Mayaqua.h b/src/Mayaqua/Mayaqua.h
-index 194f8e6..177129e 100644
--- a/src/Mayaqua/Mayaqua.h
+++ b/src/Mayaqua/Mayaqua.h
@@ -283,7 +283,7 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, char *CmdLine, int CmdShow)
typedef void *iconv_t;\r
iconv_t iconv_open (__const char *__tocode, __const char *__fromcode);\r
size_t iconv (iconv_t __cd, char **__restrict __inbuf,\r
-diff --git a/src/makefiles/linux_32bit.mak b/src/makefiles/linux_32bit.mak
-index 8219d5d..8020290 100644
--- a/src/makefiles/linux_32bit.mak
+++ b/src/makefiles/linux_32bit.mak
@@ -68,7 +68,7 @@ OPTIONS_LINK_DEBUG=-g -fsigned-char -lm -ldl -lrt -lpthread -lssl -lcrypto -lrea
INSTALL_BINDIR=/usr/bin/
INSTALL_VPNSERVER_DIR=/usr/vpnserver/
-diff --git a/src/makefiles/linux_64bit.mak b/src/makefiles/linux_64bit.mak
-index 7f81b58..a36e0de 100644
--- a/src/makefiles/linux_64bit.mak
+++ b/src/makefiles/linux_64bit.mak
@@ -68,7 +68,7 @@ OPTIONS_LINK_DEBUG=-g -fsigned-char -m64 -lm -ldl -lrt -lpthread -lssl -lcrypto