summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/idevice.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/idevice.c b/src/idevice.c
index 89724ff..21b10ba 100644
--- a/src/idevice.c
+++ b/src/idevice.c
@@ -697,7 +697,11 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_enable_ssl(idevice_conne
697 return IDEVICE_E_INVALID_ARG; 697 return IDEVICE_E_INVALID_ARG;
698 698
699 idevice_error_t ret = IDEVICE_E_SSL_ERROR; 699 idevice_error_t ret = IDEVICE_E_SSL_ERROR;
700#ifdef HAVE_OPENSSL
700 uint32_t return_me = 0; 701 uint32_t return_me = 0;
702#else
703 int return_me = 0;
704#endif
701 plist_t pair_record = NULL; 705 plist_t pair_record = NULL;
702 706
703 userpref_read_pair_record(connection->udid, &pair_record); 707 userpref_read_pair_record(connection->udid, &pair_record);
@@ -817,14 +821,17 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_enable_ssl(idevice_conne
817 if (errno) { 821 if (errno) {
818 debug_info("WARNING: errno says %s before handshake!", strerror(errno)); 822 debug_info("WARNING: errno says %s before handshake!", strerror(errno));
819 } 823 }
820 return_me = gnutls_handshake(ssl_data_loc->session); 824
825 do {
826 return_me = gnutls_handshake(ssl_data_loc->session);
827 } while(return_me == GNUTLS_E_AGAIN || return_me == GNUTLS_E_INTERRUPTED);
828
821 debug_info("GnuTLS handshake done..."); 829 debug_info("GnuTLS handshake done...");
822 830
823 if (return_me != GNUTLS_E_SUCCESS) { 831 if (return_me != GNUTLS_E_SUCCESS) {
824 internal_ssl_cleanup(ssl_data_loc); 832 internal_ssl_cleanup(ssl_data_loc);
825 free(ssl_data_loc); 833 free(ssl_data_loc);
826 debug_info("GnuTLS reported something wrong."); 834 debug_info("GnuTLS reported something wrong: %s", gnutls_strerror(return_me));
827 gnutls_perror(return_me);
828 debug_info("oh.. errno says %s", strerror(errno)); 835 debug_info("oh.. errno says %s", strerror(errno));
829 } else { 836 } else {
830 connection->ssl_data = ssl_data_loc; 837 connection->ssl_data = ssl_data_loc;