session server UPDATE wrap TLS
diff --git a/src/session_server.c b/src/session_server.c
index 94dd5d5..f152cd6 100644
--- a/src/session_server.c
+++ b/src/session_server.c
@@ -33,11 +33,6 @@
 #include <time.h>
 #include <unistd.h>
 
-#ifdef NC_ENABLED_SSH_TLS
-#include <curl/curl.h>
-#include <libssh/libssh.h>
-#endif
-
 #include "compat.h"
 #include "config.h"
 #include "log_p.h"
@@ -48,6 +43,12 @@
 #include "session_p.h"
 #include "session_server.h"
 #include "session_server_ch.h"
+#include "session_wrapper.h"
+
+#ifdef NC_ENABLED_SSH_TLS
+#include <curl/curl.h>
+#include <libssh/libssh.h>
+#endif
 
 struct nc_server_opts server_opts = {
     .config_lock = PTHREAD_RWLOCK_INITIALIZER,
@@ -1650,10 +1651,10 @@
         }
         break;
     case NC_TI_OPENSSL:
-        r = SSL_pending(session->ti.tls);
+        r = nc_tls_have_pending_wrap(session->ti.tls.session);
         if (!r) {
             /* no data pending in the SSL buffer, poll fd */
-            pfd.fd = SSL_get_rfd(session->ti.tls);
+            pfd.fd = nc_tls_get_fd_wrap(session);
             if (pfd.fd < 0) {
                 sprintf(msg, "Internal error (%s:%d)", __FILE__, __LINE__);
                 ret = NC_PSPOLL_ERROR;
diff --git a/src/session_server.h b/src/session_server.h
index d386b62..4fd2ce8 100644
--- a/src/session_server.h
+++ b/src/session_server.h
@@ -24,17 +24,17 @@
 #include <stdint.h>
 #include <sys/types.h>
 
-#ifdef NC_ENABLED_SSH_TLS
-# include <openssl/x509.h>
 
+#include "config.h"
+#include "netconf.h"
+#include "session.h"
+
+#ifdef NC_ENABLED_SSH_TLS
 # include <libssh/callbacks.h>
 # include <libssh/libssh.h>
 # include <libssh/server.h>
 #endif /* NC_ENABLED_SSH_TLS */
 
-#include "netconf.h"
-#include "session.h"
-
 /**
  * @defgroup server_session Server Session
  * @ingroup server
@@ -553,7 +553,7 @@
  * @param[in] session Session to get the information from.
  * @return Const session client certificate.
  */
-const X509 *nc_session_get_client_cert(const struct nc_session *session);
+const void *nc_session_get_client_cert(const struct nc_session *session);
 
 /**
  * @brief Set TLS authentication additional verify callback.