[gnutls-help] Truly non-blocking example of gnutls usage

Alex Bligh alex at alex.org.uk
Sun Apr 10 00:59:51 CEST 2016


On 8 Apr 2016, at 18:44, Nikos Mavrogiannopoulos <nmav at gnutls.org> wrote:

>>> The simplest example is mini-eagain.c from the test suite which
>>> verifies the asynchronous operation of gnutls_record_send and recv.
>> Thanks - that was helpful. But it doesn't do a select loop
>> as far as I can tell.
> No. A select loop will be complex and I don't know if one could have a
> reasonable example. If you have one consider contributing it.

I do now:

I've tried to keep it pretty simple, and put all the crypto stuff in
one place (crypto.c).

In essence, it's a very simple version of stunnel. I've tested
compilation on Linux (only). It's designed to work with older
GnuTLS libraries as well.

You're welcome to use it. I'm not convinced I've done all the GnuTLS
stuff right (it's my first attempt at a 'from scratch' piece of
GnuTLS code). In particular I *think* I'm handling GNUTLS_E_AGAIN,
GNUTLS_E_INTERRUPTED and gnutls_record_check_pending right, but I'm
sure they could do with a quick look over.

Also I am conscious my X.509 handling is simplistic (meaning
'borrowed wholesale from the examples'). I've checked it with
a few homemade certificates and it seems to do what it says.

It's MIT licensed at the moment. I think some of your examples
are GPL and some are in the public domain. Hope that's OK. If
not, do shout.

Alex Bligh

More information about the Gnutls-help mailing list