need help adding GnuTLS support to Emacs

Ted Zlatanov tzz at
Tue Aug 17 16:36:10 CEST 2010

On Sat, 14 Aug 2010 01:53:02 +0200 Simon Josefsson <simon at> wrote: 

SJ> Ted Zlatanov <tzz at> writes:
>> Thanks for your advice.  Attached is a revised version of the patch,
>> rebased against today's Emacs.

SJ> Nice work!

SJ> It reminds me of the fun I had with similar ideas some time ago... see

Simon, this *is* your patch! :)

>> +DEFUN ("gnutls-global-init", Fgnutls_global_init, 

SJ> Do you really want to expose this function to elisp?  It is
SJ> thread-unsafe.  It makes more sense if Emacs initialized the GnuTLS
SJ> library on startup instead.

Chong Yidong had the same question on the emacs-devel mailing list.  I
was trying to keep your original patch mostly intact but I guess it can
be done better.  I'll also put it all into gnutls.c instead of sending
out patches to process.c.  I'll probably look at implementing a seamless
"open stream" operation with all the options bundled in, instead of the
"initialize, build, open" sequence that's familiar on the C side.

>> +DEFUN ("gnutls-protocol-set-priority", Fgnutls_protocol_set_priority, 
>> +DEFUN ("gnutls-cipher-set-priority", Fgnutls_cipher_set_priority, 
>> +DEFUN ("gnutls-compression-set-priority", Fgnutls_compression_set_priority, 

SJ> Don't expose these deprecated APIs, instead just expose a
SJ> gnutls-set-priority interface that takes a priority string.  It should
SJ> be possible to specify all protocol/cipher/compression/MAC/etc variants
SJ> using one simple string.

I need to read up on GnuTLS.  Is there a particular example in the
source that is best adapted to the Emacs use case (embedded, exposed
through a secondary API, should handle as many options and errors as
possible, could be a server or a client)?

Yidong also had concerns about all the defconst's in the patch.  If we
can use strings to specify options, that makes it much easier (although
the Emacs Lisp side may still need work to assemble those options

Thanks for writing back, I appreciate yours and everyone else's help
with this.  My C is very rusty so expect slow progress.


More information about the Gnutls-devel mailing list