Emacs core TLS support

Andreas Schwab schwab at linux-m68k.org
Mon Sep 6 17:53:46 CEST 2010


Ted Zlatanov <tzz at lifelogs.com> writes:

>>> +DEFUN ("gnutls-init", Fgnutls_init, Sgnutls_init, 2, 2, 0,
> ...
>>> +  ret = gnutls_init((gnutls_session_t*)&(XPROCESS(proc)->gnutls_state), 
>
> AS> Aliasing violation.
>
> Can you explain please?

The function wants to store a value of one type into an object of a
different type.  BAD.  The compiler is allowed to assume the object was
never changed.

> AS> IMHO all your functions should return t on success and either some error
> AS> symbol on failure or even raise an error.
>
> Yes, but I'm not sure which one.  Can you recommend?

Take your pick.  I don't know anything about gnutls.

>>> === modified file 'src/process.h'
>>> +
>>> +#ifdef HAVE_GNUTLS
>>> +    /* XXX Store GNU TLS state and auth mechanisms in Lisp_Objects. */
>>> +    Lisp_Object gnutls_state;
>>> +    Lisp_Object x509_cred, x509_callback;
>>> +    Lisp_Object anon_cred;
>>> +    Lisp_Object srp_cred;
>>> +#endif
>
> AS> None of them should be Lisp_Objects.  Also make sure the resources are
> AS> properly released when the process object is deleted.
>
> I don't know enough (the choice of using Lisp_Objects was in the
> original patch) to know what to do instead of using Lisp_Objects.  Why
> not, first of all?

You never store Lisp_Object values in there, so what's the point?
x509_callback is never used, btw.

Andreas.

-- 
Andreas Schwab, schwab at linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




More information about the Gnutls-devel mailing list