genericize a bit to handle gnutls versions