[Help-gnutls] GNU TLS inside a loop: what to do at each iteration?

Stephane Bortzmeyer bortzmeyer at nic.fr
Thu Nov 6 10:31:26 CET 2003


On Thu, Nov 06, 2003 at 11:12:20AM +0200,
 Nikos Mavroyanopoulos <nmav at gnutls.org> wrote 
 a message of 34 lines which said:

> > I then tried:
> > gnutls_init(&session, GNU_TLS_CLIENT);
> > gnutls_transport_set_ptr (session, gnutls_transport_ptr) sockfd);
> > gnutls_handshake (session);
> > ... Work
> > gnutls_bye (channel.tls, GNUTLS_SHUT_RDWR);
> > gnutls_deinit (session); 
> > And it fails at the second iteration (ASN1 parser: Element was not
> > found. (Bad file descriptor).
> 
> You probably haven't called gnutls_global_init(). 

Of course I did. I just showed only the instructions that are
loop-specific but, at the beginning of the program, before starting
the loop, I have:

      gnutls_global_init ();
      gnutls_certificate_allocate_credentials (&xcred);

> In any case try reading the examples on how to properly initialize a
> TLS session.

No example on the Web site covers the case of a loop.





More information about the Gnutls-help mailing list