TLS support

Not much has changed really, just support for GnuTLS which is required to build. One should make a change so that it's possible to compile without it altogether.
I haven't done that, obviously.