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

Simon Josefsson jas at extundo.com
Thu Jul 13 09:29:42 CEST 2006


Jefferson Ogata <Jefferson.Ogata at noaa.gov> writes:

> In libextra/gnutls_openssl.c, we have:
>
> int
> 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
> problem:
>
> -    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?

I installed this in SSL_connect and SSL_accept.

Thanks,
Simon



More information about the Gnutls-dev mailing list