Skip to content
Snippets Groups Projects
Commit 0c512390 authored by Andy Green's avatar Andy Green
Browse files

ssl clean recent external CTX patch so doesnt break build

parent 4d9c8fc0
No related branches found
No related tags found
No related merge requests found
...@@ -214,24 +214,15 @@ libwebsocket_create_context(struct lws_context_creation_info *info) ...@@ -214,24 +214,15 @@ libwebsocket_create_context(struct lws_context_creation_info *info)
sizeof(struct libwebsocket), sizeof(struct libwebsocket),
sizeof(struct allocated_headers)); sizeof(struct allocated_headers));
if (lws_context_init_server_ssl(info, context))
#ifdef LWS_OPENSSL_SUPPORT
if (info->provided_client_ssl_ctx){
//use the provided OpenSSL context if given one
context->ssl_client_ctx = info->provided_client_ssl_ctx;
context->user_supplied_ssl_ctx = 1; //mark to not delet the context on cleanup
}
#endif
if (lws_context_init_server_ssl(info, context))
goto bail; goto bail;
if (!context->ssl_client_ctx && lws_context_init_client_ssl(info, context))
if (lws_context_init_client_ssl(info, context))
goto bail; goto bail;
if (lws_context_init_server(info, context)) if (lws_context_init_server(info, context))
goto bail; goto bail;
lwsl_debug(" client SSL ctx %p\n", context->ssl_client_ctx);
lwsl_debug(" server SSL ctx %p\n", context->ssl_ctx);
/* /*
* drop any root privs for this process * drop any root privs for this process
* to listen on port < 1023 we would have needed root, but now we are * to listen on port < 1023 we would have needed root, but now we are
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include "private-libwebsockets.h" #include "private-libwebsockets.h"
#ifndef LWS_NO_SERVER #ifndef LWS_NO_SERVER
#ifdef LWS_OPENSSL_SUPPORT
#if OPENSSL_VERSION_NUMBER >= 0x10002000L #if OPENSSL_VERSION_NUMBER >= 0x10002000L
static int alpn_select_proto_cb(SSL* ssl, static int alpn_select_proto_cb(SSL* ssl,
...@@ -75,4 +76,5 @@ lws_context_init_http2_ssl(struct libwebsocket_context *context) ...@@ -75,4 +76,5 @@ lws_context_init_http2_ssl(struct libwebsocket_context *context)
#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L #endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
} }
#endif
#endif #endif
\ No newline at end of file
...@@ -238,6 +238,14 @@ int lws_context_init_client_ssl(struct lws_context_creation_info *info, ...@@ -238,6 +238,14 @@ int lws_context_init_client_ssl(struct lws_context_creation_info *info,
int n; int n;
SSL_METHOD *method; SSL_METHOD *method;
if (info->provided_client_ssl_ctx) {
/* use the provided OpenSSL context if given one */
context->ssl_client_ctx = info->provided_client_ssl_ctx;
/* nothing for lib to delete */
context->user_supplied_ssl_ctx = 1;
return 0;
}
if (info->port != CONTEXT_PORT_NO_LISTEN) if (info->port != CONTEXT_PORT_NO_LISTEN)
return 0; return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment