+#if HAVE_GNUTLS_H
+ state->cred_ptr = st->cred_ptr;
+ state->session = 0;
+ if (st->cred_ptr)
+ {
+ int res;
+
+ (state->cred_ptr->ref)++;
+ gnutls_init(&state->session, GNUTLS_SERVER);
+ if (!state->session)
+ {
+ xfree(cnew);
+ xfree(state);
+ return 0;
+ }
+ res = gnutls_set_default_priority(state->session);
+ if (res != GNUTLS_E_SUCCESS)
+ {
+ xfree(cnew);
+ xfree(state);
+ return 0;
+ }
+ res = gnutls_credentials_set(state->session,
+ GNUTLS_CRD_CERTIFICATE,
+ st->cred_ptr->xcred);
+ if (res != GNUTLS_E_SUCCESS)
+ {
+ xfree(cnew);
+ xfree(state);
+ return 0;
+ }
+ gnutls_transport_set_ptr(state->session,
+ (gnutls_transport_ptr_t) cnew->iofile);
+ }
+#elif HAVE_OPENSSL_SSL_H