[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnutls-dev] SSL_connect and non-blocking i/o

From: Jefferson Ogata
Subject: [gnutls-dev] SSL_connect and non-blocking i/o
Date: Thu, 13 Jul 2006 00:53:00 +0000
User-agent: Mozilla/4.0 (compatible;MSIE 5.5; Windows 98)

In libextra/gnutls_openssl.c, we have:

SSL_connect (SSL * ssl)
  err = gnutls_handshake (ssl->gnutls_state);

Meanwhile, the gnutls_handshake() docs indicate that gnutls_handshake()
should be called repeatedly until err == 0 or gnutls_error_is_fatal(err)
is true.

So I'm debugging an application that uses the gnutls/OpenSSL
compatibility and is using a non-blocking socket for the underlying
transport; it returns from SSL_connect() without completing a handshake.
I tweak gnutls libextra/gnutls_openssl.c as follows and that fixes my

-    err = gnutls_handshake(ssl->gnutls_state);
+    do
+    {
+       err = gnutls_handshake(ssl->gnutls_state);
+    } while (err < 0 && !gnutls_error_is_fatal (err));

I can't be the only person who has run into this, can I?

Jefferson Ogata <address@hidden>
NOAA Computer Incident Response Team (N-CIRT) <address@hidden>
"Never try to retrieve anything from a bear."--National Park Service

reply via email to

[Prev in Thread] Current Thread [Next in Thread]