factor out OpenSSL TLS support to allow for GnuTLS