Skip to content

Commit

Permalink
update wifi_start_ssl_client api for fix ssl connect problem
Browse files Browse the repository at this point in the history
  • Loading branch information
lyzsuper committed Dec 16, 2020
1 parent d03fd99 commit 945aa4d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/wifi/wifi_ssl_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,6 @@ int wifi_start_ssl_client(wifi_sslclient_context *ssl_client, const char *host,

//log_v("Setting hostname :%s for TLS session...", host);

// // Hostname set here should match CN in server certificate
// if ((ret = mbedtls_ssl_set_hostname(&ssl_client->ssl_ctx, host)) != 0)
// {
// return handle_error(ret);
// }

if ((ret = mbedtls_ssl_setup(&ssl_client->ssl_ctx, &ssl_client->ssl_conf)) != 0)
{
Expand All @@ -439,6 +434,13 @@ int wifi_start_ssl_client(wifi_sslclient_context *ssl_client, const char *host,

mbedtls_ssl_set_bio(&ssl_client->ssl_ctx, &ssl_client->socket, mbedtls_net_send, mbedtls_net_recv, NULL);

// Hostname set here should match CN in server certificate
if ((ret = mbedtls_ssl_set_hostname(&ssl_client->ssl_ctx, host)) != 0)
{
printf("wifi_start_ssl_client mbedtls_ssl_set_hostname failed \r\n");
return handle_error(ret);
}

log_v("Performing the SSL/TLS handshake...");
unsigned long handshake_start_time = millis();
while ((ret = mbedtls_ssl_handshake(&ssl_client->ssl_ctx)) != 0)
Expand Down

0 comments on commit 945aa4d

Please sign in to comment.