From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.comp.encryption.gpg.gnutls.devel,gmane.emacs.devel Subject: Re: Emacs core TLS support Date: Sun, 12 Sep 2010 12:58:47 +0200 Message-ID: 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> <877hju123h.fsf@stupidchicken.com> <8762yklrdk.fsf@lifelogs.com> <87wrqzhrjv.fsf@lifelogs.com> <87fwxmihyz.fsf@lifelogs.com> <8762ycfhqo.fsf@lifelogs.com> <871v90fhp0.fsf@lifelogs.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1284289145 19489 80.91.229.12 (12 Sep 2010 10:59:05 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 12 Sep 2010 10:59:05 +0000 (UTC) Cc: gnutls-devel@gnu.org, emacs-devel@gnu.org To: Ted Zlatanov Original-X-From: gnutls-devel-bounces+pgp-gnutls-dev=m.gmane.org@gnu.org Sun Sep 12 12:59:04 2010 Return-path: Envelope-to: pgp-gnutls-dev@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 1OukH0-0002Vw-F4 for pgp-gnutls-dev@m.gmane.org; Sun, 12 Sep 2010 12:59:02 +0200 Original-Received: from localhost ([127.0.0.1]:60859 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OukGz-0005qn-BY for pgp-gnutls-dev@m.gmane.org; Sun, 12 Sep 2010 06:59:01 -0400 Original-Received: from [140.186.70.92] (port=60473 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OukGu-0005qf-5v for gnutls-devel@gnu.org; Sun, 12 Sep 2010 06:58:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OukGp-00065o-7K for gnutls-devel@gnu.org; Sun, 12 Sep 2010 06:58:53 -0400 Original-Received: from impaqm5.telefonica.net ([213.4.138.5]:17801) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OukGo-00065Y-Sw for gnutls-devel@gnu.org; Sun, 12 Sep 2010 06:58:51 -0400 Original-Received: from IMPmailhost4.adm.correo ([10.20.102.125]) by IMPaqm5.telefonica.net with bizsmtp id 5lMY1f00e2iL0W23RmyoNm; Sun, 12 Sep 2010 12:58:48 +0200 Original-Received: from ceviche.home ([83.61.39.212]) by IMPmailhost4.adm.correo with BIZ IMP id 5myn1f0054aeRwb1kmynHD; Sun, 12 Sep 2010 12:58:48 +0200 X-Brightmail-Tracker: AAAAAA== X-TE-authinfo: authemail="monnier$movistar.es" |auth_email="monnier@movistar.es" X-TE-AcuTerraCos: auth_cuTerraCos="cosuitnetc01" Original-Received: by ceviche.home (Postfix, from userid 20848) id 427C6660D2; Sun, 12 Sep 2010 12:58:47 +0200 (CEST) In-Reply-To: <871v90fhp0.fsf@lifelogs.com> (Ted Zlatanov's message of "Sat, 11 Sep 2010 10:00:59 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: gnutls-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GnuTLS development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: gnutls-devel-bounces+pgp-gnutls-dev=m.gmane.org@gnu.org Errors-To: gnutls-devel-bounces+pgp-gnutls-dev=m.gmane.org@gnu.org Xref: news.gmane.org gmane.comp.encryption.gpg.gnutls.devel:4503 gmane.emacs.devel:130008 Archived-At: > patch++ Looks good, except for a few coding style conventions: > + } while( rtnval==GNUTLS_E_INTERRUPTED || rtnval==GNUTLS_E_AGAIN); > + fsync(STDOUT_FILENO); Place a space *before* the open-paren and around infix operators. > + /* means the we will only be called again if the library cannot > + * determine which certificate to send > + */ Put the comment-close at the end of the previous line. > + // message ("gnutls: setting the trustfile"); > + > + // if (EQ (type, Qgnutls_x509pki)) > + // { > + // CHECK_STRING (trustfile); > + > + // x509_cred = XPROCESS (proc)->x509_cred; > + // puts("Setting certificate"); > + // puts(XSTRING (trustfile)->data); > + // ret = gnutls_certificate_set_x509_trust_file (x509_cred, > + // XSTRING (trustfile)->data, > + // GNUTLS_X509_FMT_PEM); > + // } > + > + // if (ret != GNUTLS_E_SUCCESS) > + // return gnutls_make_error (ret); We use /*..*/ comments, or "#if 0 ... #endif". > + doc: /* Terminate current GNU TLS connection for PROCESS. > +The connection should have been initiated using gnutls_handshake(). This should mention `gnutls-handshake' rather than gnutls_handshake(). BTW, for functions whose are meant to be "internal" (e.g. only expected to be used via a wrapper in gnutls.el) you can use a "gnutls--" prefix. This is not a widely used convention in Elisp, but some packages try to use it. > +#define GNUTLS_STAGE_EMPTY 0 > +#define GNUTLS_STAGE_CRED_ALLOC 1 > +#define GNUTLS_STAGE_FILES 2 > +#define GNUTLS_STAGE_INIT 3 > +#define GNUTLS_STAGE_PRIORITY 4 > +#define GNUTLS_STAGE_CRED_SET 5 Please use an enum (and use it for the type of the gnutls_initstage field, of course). > +#define GNUTLS_STAGE_HANDSHAKE_CANDO 5 Why is that the same value as GNUTLS_STAGE_CRED_SET? > +#define GNUTLS_STAGE_HANDSHAKE_DONE 6 > +#define GNUTLS_PROCESS_USABLE(proc) ( GNUTLS_INITSTAGE(proc) >= GNUTLS_STAGE_READY ) No need for spaces after the open and before the close paren. > +#ifdef HAVE_GNUTLS > +/* Defined in gnutls.c */ > +extern void syms_of_gnutls (void); > +#endif Why here rather than in gnutls.h? Also gnutls.c and gnutls.h need a GPL notice at the beginning. See other files for the usual boilerplate. > + /* AKA GNUTLS_INITSTAGE(proc) */ Please finish your comments with a full-stop (and follow it by 2 spaces). > + nbytes = emacs_gnutls_read (channel, XPROCESS (proc)->gnutls_state, chars + carryover + 1, readmax - 1); Don't overflow the 80th column. Stefan