aboutsummaryrefslogtreecommitdiff
path: root/lib/vtls/mbedtls.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/vtls/mbedtls.c')
-rw-r--r--lib/vtls/mbedtls.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c
index b2627e4e9..fa445afd5 100644
--- a/lib/vtls/mbedtls.c
+++ b/lib/vtls/mbedtls.c
@@ -415,30 +415,25 @@ mbedtls_connect_step2(struct connectdata *conn,
conn->send[sockindex] = mbedtls_send;
for(;;) {
- if(!(ret = mbedtls_ssl_handshake(&connssl->ssl)))
+ ret = mbedtls_ssl_handshake(&connssl->ssl);
+ if(!ret)
break;
+ if(ret == MBEDTLS_ERR_SSL_WANT_READ) {
+ connssl->connecting_state = ssl_connect_2_reading;
+ return CURLE_OK;
+ }
+ else if(ret == MBEDTLS_ERR_SSL_WANT_WRITE) {
+ connssl->connecting_state = ssl_connect_2_writing;
+ return CURLE_OK;
+ }
else if(ret != MBEDTLS_ERR_SSL_WANT_READ &&
ret != MBEDTLS_ERR_SSL_WANT_WRITE) {
#ifdef MBEDTLS_ERROR_C
- mbedtls_strerror(ret, errorbuf, sizeof(errorbuf));
+ mbedtls_strerror(ret, errorbuf, sizeof(errorbuf));
#endif /* MBEDTLS_ERROR_C */
- failf(data, "ssl_handshake returned - mbedTLS: (-0x%04X) %s",
- -ret, errorbuf);
-
- return CURLE_SSL_CONNECT_ERROR;
- }
- else {
- if(ret == MBEDTLS_ERR_SSL_WANT_READ) {
- connssl->connecting_state = ssl_connect_2_reading;
- return CURLE_OK;
- }
- if(ret == MBEDTLS_ERR_SSL_WANT_WRITE) {
- connssl->connecting_state = ssl_connect_2_writing;
- return CURLE_OK;
- }
- failf(data, "SSL_connect failed with error %d.", ret);
+ failf(data, "ssl_handshake returned - mbedTLS: (-0x%04X) %s",
+ -ret, errorbuf);
return CURLE_SSL_CONNECT_ERROR;
-
}
}