diff --git a/libfreerdp/crypto/tls.c b/libfreerdp/crypto/tls.c
index 1b9d165..e76c78c 100644
--- a/libfreerdp/crypto/tls.c
+++ b/libfreerdp/crypto/tls.c
@@ -220,9 +220,9 @@ static long bio_rdp_tls_ctrl(BIO* bio, int cmd, long num, void* ptr)
 		case BIO_CTRL_RESET:
 			SSL_shutdown(tls->ssl);
 
-			if (tls->ssl->handshake_func == tls->ssl->method->ssl_connect)
+			if (SSL_in_connect_init(tls->ssl))
 				SSL_set_connect_state(tls->ssl);
-			else if (tls->ssl->handshake_func == tls->ssl->method->ssl_accept)
+			else if (SSL_in_accept_init(tls->ssl))
 				SSL_set_accept_state(tls->ssl);
 
 			SSL_clear(tls->ssl);
