mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-28 07:28:13 +08:00
SSL_CTX_new can fail
SSLv23_ methods deprecated
This commit is contained in:
parent
a9902b55d8
commit
4dcc4e3308
@ -12567,8 +12567,12 @@ void mg_tls_init(struct mg_connection *c, const struct mg_tls_opts *opts) {
|
|||||||
s_initialised++;
|
s_initialised++;
|
||||||
}
|
}
|
||||||
MG_DEBUG(("%lu Setting TLS", c->id));
|
MG_DEBUG(("%lu Setting TLS", c->id));
|
||||||
tls->ctx = c->is_client ? SSL_CTX_new(SSLv23_client_method())
|
tls->ctx = c->is_client ? SSL_CTX_new(TLS_client_method())
|
||||||
: SSL_CTX_new(SSLv23_server_method());
|
: SSL_CTX_new(TLS_server_method());
|
||||||
|
if (tls->ctx == NULL) {
|
||||||
|
mg_error(c, "SSL_CTX_new");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
#ifdef MG_TLS_SSLKEYLOGFILE
|
#ifdef MG_TLS_SSLKEYLOGFILE
|
||||||
SSL_CTX_set_keylog_callback(tls->ctx, ssl_keylog_cb);
|
SSL_CTX_set_keylog_callback(tls->ctx, ssl_keylog_cb);
|
||||||
#endif
|
#endif
|
||||||
|
@ -134,8 +134,12 @@ void mg_tls_init(struct mg_connection *c, const struct mg_tls_opts *opts) {
|
|||||||
s_initialised++;
|
s_initialised++;
|
||||||
}
|
}
|
||||||
MG_DEBUG(("%lu Setting TLS", c->id));
|
MG_DEBUG(("%lu Setting TLS", c->id));
|
||||||
tls->ctx = c->is_client ? SSL_CTX_new(SSLv23_client_method())
|
tls->ctx = c->is_client ? SSL_CTX_new(TLS_client_method())
|
||||||
: SSL_CTX_new(SSLv23_server_method());
|
: SSL_CTX_new(TLS_server_method());
|
||||||
|
if (tls->ctx == NULL) {
|
||||||
|
mg_error(c, "SSL_CTX_new");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
#ifdef MG_TLS_SSLKEYLOGFILE
|
#ifdef MG_TLS_SSLKEYLOGFILE
|
||||||
SSL_CTX_set_keylog_callback(tls->ctx, ssl_keylog_cb);
|
SSL_CTX_set_keylog_callback(tls->ctx, ssl_keylog_cb);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user