aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2015-10-29 22:59:27 +0100
committerDaniel Stenberg <daniel@haxx.se>2015-10-29 22:59:27 +0100
commitfbf09b77752930b0a9f6758bd97d7064ff835d3d (patch)
tree160bce62e6829f0c05bb246144c52fcf22a9d78c /lib
parentf6ce8c9abb880bc1fe605e5b2dce5bae3df66a8e (diff)
mbedtls: fix "Structurally dead code"
CID 1332129
Diffstat (limited to 'lib')
-rw-r--r--lib/vtls/mbedtls.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c
index fa445afd5..0616e6836 100644
--- a/lib/vtls/mbedtls.c
+++ b/lib/vtls/mbedtls.c
@@ -414,27 +414,23 @@ mbedtls_connect_step2(struct connectdata *conn,
conn->recv[sockindex] = mbedtls_recv;
conn->send[sockindex] = mbedtls_send;
- for(;;) {
- 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) {
+ ret = mbedtls_ssl_handshake(&connssl->ssl);
+
+ 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) {
#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;
- }
+ failf(data, "ssl_handshake returned - mbedTLS: (-0x%04X) %s",
+ -ret, errorbuf);
+ return CURLE_SSL_CONNECT_ERROR;
}
infof(data, "mbedTLS: Handshake complete, cipher is %s\n",