From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: Emacs core TLS support Date: Fri, 13 Aug 2010 20:15:30 -0400 Message-ID: <877hju123h.fsf@stupidchicken.com> References: <878wc1vfh3.fsf@lifelogs.com> <87r5ptpnz2.fsf@stupidchicken.com> <871vhsvkut.fsf@lifelogs.com> <87d41csktn.fsf@lifelogs.com> <87k4v0n0m8.fsf@lifelogs.com> <87wrrvfnc4.fsf@lifelogs.com> <87r5i2d00q.fsf@lifelogs.com> <87zkwqijye.fsf@stupidchicken.com> <878w4actmg.fsf@lifelogs.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1281744951 29185 80.91.229.12 (14 Aug 2010 00:15:51 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 14 Aug 2010 00:15:51 +0000 (UTC) Cc: emacs-devel@gnu.org To: Ted Zlatanov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Aug 14 02:15:50 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ok4PX-0004RN-Jg for ged-emacs-devel@m.gmane.org; Sat, 14 Aug 2010 02:15:44 +0200 Original-Received: from localhost ([127.0.0.1]:60715 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ok4PW-0007pG-6X for ged-emacs-devel@m.gmane.org; Fri, 13 Aug 2010 20:15:42 -0400 Original-Received: from [140.186.70.92] (port=56497 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ok4PN-0007p7-Sk for emacs-devel@gnu.org; Fri, 13 Aug 2010 20:15:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ok4PM-0007Oi-JH for emacs-devel@gnu.org; Fri, 13 Aug 2010 20:15:33 -0400 Original-Received: from pantheon-po45.its.yale.edu ([130.132.50.79]:39256) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ok4PM-0007Oc-EF for emacs-devel@gnu.org; Fri, 13 Aug 2010 20:15:32 -0400 Original-Received: from furry (dhcp128036014221.central.yale.edu [128.36.14.221]) (authenticated bits=0) by pantheon-po45.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o7E0FUXL014437 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 13 Aug 2010 20:15:31 -0400 Original-Received: by furry (Postfix, from userid 1000) id 532D616D402; Fri, 13 Aug 2010 20:15:30 -0400 (EDT) In-Reply-To: <878w4actmg.fsf@lifelogs.com> (Ted Zlatanov's message of "Fri, 13 Aug 2010 12:25:27 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:128645 Archived-At: Ted Zlatanov writes: > Simon's code included a gnutls.el library, attached here. It shows how > to use it. OK, that makes sense. Though I feel queasy about this: (defconst gnutls-cipher-null 1) (defconst gnutls-cipher-arcfour 2) ... being intended to map to typedef enum gnutls_cipher_algorithm { GNUTLS_CIPHER_UNKNOWN = 0, GNUTLS_CIPHER_NULL = 1, GNUTLS_CIPHER_ARCFOUR_128, ... from gnutls.h. The more Emacs-Lisp-y approach is to let the gnutls-* built-in functions accept symbols rather than integers, i.e. instead of (gnutls-protocol-set-priority proc gnutls-tls1 gnutls-ssl3) it should be called as (gnutls-protocol-set-priority proc 'gnutls-tls1 'gnutls-ssl3), and `gnutls-protocol-set-priority' should internally convert those symbol arguments to GNUTLS_SSL3 and GNUTLS_TLS1, and pass them to the GnuTLS function gnutls_protocol_set_priority. I think this can be done by taking Fsymbol_name of each argument, and using the accessor functionss provided by the GnuTLS library, e.g. `gnutls_protocol_get_id'. (We thus avoid defining many dozens of Lisp symbols beforehand, like Qssl3, Qtls1, etc.). We can also be fancy, by not requiring the `gnutls' part of the symbol argument and appending it in the C code: (gnutls-protocol-set-priority proc 'tls1 'ssl3) I realize this is a rather invasive change to the patch. I suggest separating the GnuTLS code into a separate file, gnutls.c, adding it to the Emacs repository, and work from there. Then you don't have to keep sending the patch to the mailing list.