Subject: ssl: fix OpenSSL client method detection
authorMartin Milata <martin@martinmilata.cz>
Thu, 6 Apr 2017 13:46:37 +0000 (15:46 +0200)
committerAndy Green <andy@warmcat.com>
Thu, 6 Apr 2017 14:51:42 +0000 (22:51 +0800)
CMakeLists.txt
lib/ssl-client.c

index abc5052..6e90505 100644 (file)
@@ -474,10 +474,6 @@ CHECK_FUNCTION_EXISTS(_snprintf LWS_HAVE__SNPRINTF)
 CHECK_FUNCTION_EXISTS(_vsnprintf LWS_HAVE__VSNPRINTF)
 CHECK_FUNCTION_EXISTS(getloadavg LWS_HAVE_GETLOADAVG)
 
-CHECK_FUNCTION_EXISTS(TLS_client_method LWS_HAVE_TLS_CLIENT_METHOD)
-CHECK_FUNCTION_EXISTS(TLSv1_2_client_method LWS_HAVE_TLSV1_2_CLIENT_METHOD)
-
-
 if (NOT LWS_HAVE_GETIFADDRS)
        if (LWS_WITHOUT_BUILTIN_GETIFADDRS)
                message(FATAL_ERROR "No getifaddrs was found on the system. Turn off the LWS_WITHOUT_BUILTIN_GETIFADDRS compile option to use the supplied BSD version.")
@@ -1032,6 +1028,8 @@ set (temp ${CMAKE_REQUIRED_LIBRARIES})
 set(CMAKE_REQUIRED_LIBRARIES ${LIB_LIST})
 CHECK_FUNCTION_EXISTS(SSL_CTX_set1_param LWS_HAVE_SSL_CTX_set1_param)
 CHECK_FUNCTION_EXISTS(X509_VERIFY_PARAM_set1_host LWS_HAVE_X509_VERIFY_PARAM_set1_host)
+CHECK_FUNCTION_EXISTS(TLS_client_method LWS_HAVE_TLS_CLIENT_METHOD)
+CHECK_FUNCTION_EXISTS(TLSv1_2_client_method LWS_HAVE_TLSV1_2_CLIENT_METHOD)
 set(CMAKE_REQUIRED_LIBRARIES ${temp})
 # Generate the lws_config.h that includes all the public compilation settings.
 configure_file(
index 89fc57e..45c9fb7 100644 (file)
@@ -472,12 +472,11 @@ int lws_context_init_client_ssl(struct lws_context_creation_info *info,
        /* choose the most recent spin of the api */
 #if defined(LWS_HAVE_TLS_CLIENT_METHOD)
        method = (SSL_METHOD *)TLS_client_method();
-#if defined(LWS_HAVE_TLSV1_2_CLIENT_METHOD)
+#elif defined(LWS_HAVE_TLSV1_2_CLIENT_METHOD)
        method = (SSL_METHOD *)TLSv1_2_client_method();
 #else
        method = (SSL_METHOD *)SSLv23_client_method();
 #endif
-#endif
        if (!method) {
                error = ERR_get_error();
                lwsl_err("problem creating ssl method %lu: %s\n",