Skip to content

Commit

Permalink
ssl: OpenSSL v1.1 deprecated TLSv1_2_client_method
Browse files Browse the repository at this point in the history
  • Loading branch information
lws-team committed Apr 6, 2017
1 parent 6cae994 commit 00081a2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,10 @@ 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.")
Expand Down
11 changes: 10 additions & 1 deletion lib/ssl-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ lws_ssl_client_connect2(struct lws *wsi)
int lws_context_init_client_ssl(struct lws_context_creation_info *info,
struct lws_vhost *vhost)
{
SSL_METHOD *method;
SSL_METHOD *method = NULL;
struct lws wsi;
unsigned long error;
#if !defined(LWS_WITH_ESP32)
Expand Down Expand Up @@ -468,7 +468,16 @@ int lws_context_init_client_ssl(struct lws_context_creation_info *info,

/* basic openssl init already happened in context init */


/* 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)
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",
Expand Down
6 changes: 6 additions & 0 deletions lws_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,10 @@
#cmakedefine LWS_AVOID_SIGPIPE_IGN

#cmakedefine LWS_FALLBACK_GETHOSTBYNAME

/* OpenSSL various APIs */

#cmakedefine LWS_HAVE_TLS_CLIENT_METHOD
#cmakedefine LWS_HAVE_TLSV1_2_CLIENT_METHOD

${LWS_SIZEOFPTR_CODE}

0 comments on commit 00081a2

Please sign in to comment.