From d4c9158d88502041d0e9375cd51ad109ca8ff35d Mon Sep 17 00:00:00 2001 From: Nate Karstens Date: Fri, 20 Oct 2023 13:25:09 -0500 Subject: [PATCH] openssl: Add lws ctx ref to client vhost's SSL_CTX Adds a reference to the libwebsockets context to the OpenSSL context used by the client vhost. This allows SSL info callbacks to work correctly for clients, like it currently does for servers. Co-authored-by: Marty Flickinger Signed-off-by: Marty Flickinger Signed-off-by: Nate Karstens --- lib/tls/openssl/openssl-client.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/tls/openssl/openssl-client.c b/lib/tls/openssl/openssl-client.c index a46083a0dd..da72ecba2a 100644 --- a/lib/tls/openssl/openssl-client.c +++ b/lib/tls/openssl/openssl-client.c @@ -924,6 +924,10 @@ lws_tls_client_create_vhost_context(struct lws_vhost *vh, return 1; } + SSL_CTX_set_ex_data(vh->tls.ssl_client_ctx, + openssl_SSL_CTX_private_data_index, + (char *)vh->context); + lws_plat_vhost_tls_client_ctx_init(vh); tcr = lws_zalloc(sizeof(*tcr), "client ctx tcr");