aboutsummaryrefslogtreecommitdiff
path: root/lib/vtls
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2015-10-29 22:57:09 +0100
committerDaniel Stenberg <daniel@haxx.se>2015-10-29 22:57:09 +0100
commitf6ce8c9abb880bc1fe605e5b2dce5bae3df66a8e (patch)
tree8186c1fd0deee6b8b94399b40a464cc2fe1c9f34 /lib/vtls
parent4c62066cec18b8fa98bc1aa02ab80e4b489d5bc1 (diff)
mbedtls: fix "Logically dead code"
CID 1332128
Diffstat (limited to 'lib/vtls')
-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;
-
}
}