Skip to content

Commit 2b74af4

Browse files
ThePassionatelws-team
authored andcommitted
lws/mbedtls-wrapper: Align SSL_CTX_new function declaration with OpenSSL
SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth) is the declaration of openssl Signed-off-by: makejian <[email protected]>
1 parent 5f77374 commit 2b74af4

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

lib/tls/mbedtls/mbedtls-client.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ lws_tls_client_create_vhost_context(struct lws_vhost *vh,
407407
return 1;
408408
}
409409
/* create context */
410-
vh->tls.ssl_client_ctx = SSL_CTX_new(method, &vh->context->mcdc);
410+
vh->tls.ssl_client_ctx = SSL_CTX_new(method);
411411
if (!vh->tls.ssl_client_ctx) {
412412
error = (unsigned long)ERR_get_error();
413413
lwsl_err("problem creating ssl context %lu: %s\n",
@@ -416,6 +416,7 @@ lws_tls_client_create_vhost_context(struct lws_vhost *vh,
416416
return 1;
417417
}
418418

419+
vh->tls.ssl_client_ctx->rngctx = &vh->context->mcdc;
419420
if (!ca_filepath && (!ca_mem || !ca_mem_len)) {
420421
#if defined(LWS_HAVE_SSL_CTX_load_verify_dir)
421422
if (!SSL_CTX_load_verify_dir(

lib/tls/mbedtls/mbedtls-server.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,13 @@ lws_tls_server_vhost_backend_init(const struct lws_context_creation_info *info,
199199
lws_filepos_t flen;
200200
int n;
201201

202-
vhost->tls.ssl_ctx = SSL_CTX_new(method, &vhost->context->mcdc); /* create context */
202+
vhost->tls.ssl_ctx = SSL_CTX_new(method); /* create context */
203203
if (!vhost->tls.ssl_ctx) {
204204
lwsl_err("problem creating ssl context\n");
205205
return 1;
206206
}
207207

208+
vhost->tls.ssl_ctx->rngctx = &vhost->context->mcdc;
208209
if (!vhost->tls.use_ssl ||
209210
(!info->ssl_cert_filepath && !info->server_ssl_cert_mem))
210211
return 0;

lib/tls/mbedtls/wrapper/include/openssl/ssl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
*
6161
* @return the context point
6262
*/
63-
SSL_CTX* SSL_CTX_new(const SSL_METHOD *method, void *rngctx);
63+
SSL_CTX* SSL_CTX_new(const SSL_METHOD *method);
6464

6565
/**
6666
* @brief free a SSL context

lib/tls/mbedtls/wrapper/library/ssl_lib.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ const char *mbedtls_client_preload_filepath;
185185
/**
186186
* @brief create a SSL context
187187
*/
188-
SSL_CTX* SSL_CTX_new(const SSL_METHOD *method, void *rngctx)
188+
SSL_CTX* SSL_CTX_new(const SSL_METHOD *method)
189189
{
190190
SSL_CTX *ctx;
191191
CERT *cert;
@@ -220,7 +220,6 @@ SSL_CTX* SSL_CTX_new(const SSL_METHOD *method, void *rngctx)
220220
ctx->method = method;
221221
ctx->client_CA = client_ca;
222222
ctx->cert = cert;
223-
ctx->rngctx = rngctx;
224223

225224
ctx->version = method->version;
226225

0 commit comments

Comments
 (0)