diff --git a/src/Mayaqua/Encrypt.c b/src/Mayaqua/Encrypt.c index 73f15e41..5901f0cc 100644 --- a/src/Mayaqua/Encrypt.c +++ b/src/Mayaqua/Encrypt.c @@ -34,7 +34,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -759,6 +761,7 @@ BUF *BigNumToBuf(const BIGNUM *bn) // Initialization of the lock of OpenSSL void OpenSSL_InitLock() { +#if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) UINT i; // Initialization of the lock object @@ -772,11 +775,13 @@ void OpenSSL_InitLock() // Setting the lock function CRYPTO_set_locking_callback(OpenSSL_Lock); CRYPTO_set_id_callback(OpenSSL_Id); +#endif } // Release of the lock of OpenSSL void OpenSSL_FreeLock() { +#if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) UINT i; for (i = 0;i < ssl_lock_num;i++) @@ -788,11 +793,13 @@ void OpenSSL_FreeLock() CRYPTO_set_locking_callback(NULL); CRYPTO_set_id_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) LOCK *lock = ssl_lock_obj[n]; if (mode & CRYPTO_LOCK) @@ -805,6 +812,7 @@ void OpenSSL_Lock(int mode, int n, const char *file, int line) // Unlock Unlock(lock); } +#endif } // Return the thread ID @@ -1604,7 +1612,7 @@ X509 *NewX509(K *pub, K *priv, X *ca, NAME *name, UINT days, X_SERIAL *serial) { X509 *x509; UINT64 notBefore, notAfter; - ASN1_TIME *t1, *t2; + const ASN1_TIME *t1, *t2; X509_NAME *subject_name, *issuer_name; X509_EXTENSION *ex = NULL; X509_EXTENSION *eku = NULL; @@ -1638,8 +1646,8 @@ X509 *NewX509(K *pub, K *priv, X *ca, NAME *name, UINT days, X_SERIAL *serial) X509_set_version(x509, 2L); // Set the Expiration - t1 = X509_get_notBefore(x509); - t2 = X509_get_notAfter(x509); + t1 = X509_get0_notBefore(x509); + t2 = X509_get0_notAfter(x509); if (!UINT64ToAsn1Time(t1, notBefore)) { FreeX509(x509); @@ -1742,7 +1750,7 @@ X509 *NewRootX509(K *pub, K *priv, NAME *name, UINT days, X_SERIAL *serial) { X509 *x509; UINT64 notBefore, notAfter; - ASN1_TIME *t1, *t2; + const ASN1_TIME *t1, *t2; X509_NAME *subject_name, *issuer_name; X509_EXTENSION *ex = NULL; X509_EXTENSION *eku = NULL; @@ -1780,8 +1788,8 @@ X509 *NewRootX509(K *pub, K *priv, NAME *name, UINT days, X_SERIAL *serial) X509_set_version(x509, 2L); // Set the Expiration - t1 = X509_get_notBefore(x509); - t2 = X509_get_notAfter(x509); + t1 = X509_get0_notBefore(x509); + t2 = X509_get0_notAfter(x509); if (!UINT64ToAsn1Time(t1, notBefore)) { FreeX509(x509); @@ -3721,7 +3729,7 @@ void FreeCryptLibrary() openssl_lock = NULL; // RAND_Free_For_SoftEther(); OpenSSL_FreeLock(); - +#if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) #ifdef OPENSSL_FIPS FIPS_mode_set(0); #endif @@ -3738,6 +3746,7 @@ void FreeCryptLibrary() #ifndef OPENSSL_NO_COMP SSL_COMP_free_compression_methods(); #endif +#endif } // Initialize the Crypt library @@ -3745,6 +3754,7 @@ void InitCryptLibrary() { char tmp[16]; +#if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) // RAND_Init_For_SoftEther() openssl_lock = NewLock(); SSL_library_init(); @@ -3753,6 +3763,7 @@ void InitCryptLibrary() OpenSSL_add_all_digests(); ERR_load_crypto_strings(); SSL_load_error_strings(); +#endif ssl_clientcert_index = SSL_get_ex_new_index(0, "struct SslClientCertInfo *", NULL, NULL, NULL); diff --git a/src/Mayaqua/Secure.c b/src/Mayaqua/Secure.c index c67c5a06..69eef15b 100644 --- a/src/Mayaqua/Secure.c +++ b/src/Mayaqua/Secure.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include