Fix build with LibreSSL
authorValery Kartel <valery.kartel@gmail.com>
Wed, 26 Jul 2017 14:12:14 +0000 (17:12 +0300)
committerValery Kartel <valery.kartel@gmail.com>
Wed, 26 Jul 2017 14:12:14 +0000 (17:12 +0300)
libfreerdp/crypto/crypto.c
winpr/libwinpr/utils/ssl.c
winpr/tools/makecert/makecert.c

index 15e65d5..f3bb595 100644 (file)
@@ -388,7 +388,7 @@ BOOL x509_verify_certificate(CryptoCert cert, char* certificate_store_path)
        if (cert_ctx == NULL)
                goto end;
 
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
        OpenSSL_add_all_algorithms();
 #else
        OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \
index b674e21..78cbab1 100644 (file)
@@ -255,7 +255,7 @@ static BOOL CALLBACK _winpr_openssl_initialize(PINIT_ONCE once, PVOID param, PVO
        }
 #endif
        /* SSL_load_error_strings() is void */
-#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
        SSL_load_error_strings();
        /* SSL_library_init() always returns "1" */
        SSL_library_init();
@@ -296,7 +296,7 @@ BOOL winpr_CleanupSSL(DWORD flags)
 #ifdef WINPR_OPENSSL_LOCKING_REQUIRED
                _winpr_openssl_cleanup_locking();
 #endif
-#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
                CRYPTO_cleanup_all_ex_data();
                ERR_free_strings();
                EVP_cleanup();
@@ -307,7 +307,7 @@ BOOL winpr_CleanupSSL(DWORD flags)
 #ifdef WINPR_OPENSSL_LOCKING_REQUIRED
        if (flags & WINPR_SSL_CLEANUP_THREAD)
        {
-#if (OPENSSL_VERSION_NUMBER < 0x10000000L)
+#if (OPENSSL_VERSION_NUMBER < 0x10000000L) || defined(LIBRESSL_VERSION_NUMBER)
                ERR_remove_state(0);
 #else
                ERR_remove_thread_state(NULL);
index a9efb35..c9e3820 100644 (file)
@@ -620,7 +620,7 @@ int makecert_context_output_certificate_file(MAKECERT_CONTEXT* context, char* pa
                                printf("Using default export password \"password\"\n");
                        }
 
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
                        OpenSSL_add_all_algorithms();
                        OpenSSL_add_all_ciphers();
                        OpenSSL_add_all_digests();
@@ -1008,7 +1008,7 @@ int makecert_context_process(MAKECERT_CONTEXT* context, int argc, char** argv)
                key_length = atoi(arg->Value);
        }
 
-#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
        context->rsa = RSA_generate_key(key_length, RSA_F4, NULL, NULL);
 #else
        {
@@ -1043,7 +1043,7 @@ int makecert_context_process(MAKECERT_CONTEXT* context, int argc, char** argv)
        {
                ASN1_TIME* before;
                ASN1_TIME* after;
-#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
                before = X509_get_notBefore(context->x509);
                after = X509_get_notAfter(context->x509);
 #else