1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

mbedtls-client: Enable the version number is correct

After mbedtls version 3.0, support for TLS 1.0 and 1.1 has been removed. For details, please see https://github.com/Mbed-TLS/mbedtls/issues/4286.
If use a new version of mbedtls, connection errors may occur due to version reasons. So we hope it can be configured according to the supported version.

Signed-off-by: makejian <makejian@xiaomi.com>
This commit is contained in:
makejian 2024-04-24 11:30:04 +08:00 committed by Andy Green
parent 032adce8c3
commit 2718a4572f

View file

@ -379,7 +379,7 @@ lws_tls_client_create_vhost_context(struct lws_vhost *vh,
)
{
X509 *d2i_X509(X509 **cert, const unsigned char **buffer, long len);
SSL_METHOD *method = (SSL_METHOD *)TLS_client_method();
SSL_METHOD *method;
unsigned long error;
int n;
@ -389,6 +389,16 @@ lws_tls_client_create_vhost_context(struct lws_vhost *vh,
lws_tls_session_cache(vh, info->tls_session_timeout);
#endif
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
method = (SSL_METHOD *)TLSv1_2_client_method();
#elif defined(MBEDTLS_SSL_PROTO_TLS1_1)
method = (SSL_METHOD *)TLSv1_1_client_method();
#elif defined(MBEDTLS_SSL_PROTO_TLS1)
method = (SSL_METHOD *)TLSv1_client_method();
#else
method = (SSL_METHOD *)TLS_client_method();
#endif
if (!method) {
error = (unsigned long)ERR_get_error();
lwsl_err("problem creating ssl method %lu: %s\n",