From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: libnettle/libhogweed WIP Date: Tue, 11 Apr 2017 16:05:16 -0400 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87lgr6yakj.fsf@lifelogs.com> References: <83a89gq3us.fsf@gnu.org> <87bmtjiv0w.fsf_-_@lifelogs.com> <83o9xjn06c.fsf@gnu.org> <87shmeb5ln.fsf_-_@lifelogs.com> <83y3w5z1ez.fsf@gnu.org> Reply-To: emacs-devel@gnu.org NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1491941134 6381 195.159.176.226 (11 Apr 2017 20:05:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 11 Apr 2017 20:05:34 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 11 22:05:30 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cy22c-0001bL-4w for ged-emacs-devel@m.gmane.org; Tue, 11 Apr 2017 22:05:30 +0200 Original-Received: from localhost ([::1]:40964 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cy22i-0000ox-4n for ged-emacs-devel@m.gmane.org; Tue, 11 Apr 2017 16:05:36 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37872) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cy22c-0000os-Cy for emacs-devel@gnu.org; Tue, 11 Apr 2017 16:05:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cy22Z-0000eo-86 for emacs-devel@gnu.org; Tue, 11 Apr 2017 16:05:30 -0400 Original-Received: from [195.159.176.226] (port=56650 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cy22Z-0000eY-1B for emacs-devel@gnu.org; Tue, 11 Apr 2017 16:05:27 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cy22Q-0001T5-OX for emacs-devel@gnu.org; Tue, 11 Apr 2017 22:05:18 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 47 Original-X-Complaints-To: usenet@blaine.gmane.org X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Mail-Copies-To: never Cancel-Lock: sha1:279HHPBm6xmcdhwuDLQ/U/D3VyE= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:213886 Archived-At: I updated the branch scratch/tzz/nettle with comprehensive tests. It now mirrors the low-level API in the GnuTLS crypto.h functions, so there's no libnettle/libhogweed dependency. The API was pretty different so I had to rewrite almost everything. The tests show usage and exercise many edge cases (e.g. AEAD with a nil auth string). There are many things still missing but I have some notes following up to Eli's previous comments and my own, and think it's good enough for another review round. Just keep the following in mind. * the AEAD ciphers "CHACHA20-POLY1305" "AES-128-CCM-8" "AES-256-CCM-8" are not working yet. * For AEAD, I pin to GnuTLS 3.4.0 instead of AC_CHECK_FUNCS_ONCE because I couldn't get that autoconf macro to work! * the ERT tests look at the environment variable `GNUTLS_TEST_VERBOSE=1' to trigger verbose behavior. I'm not sure if there's a better way, and would like verbosity control and maybe even per-test-tag output settings (to make a specific type of test more verbose). It feels like something ERT should provide. * other TODO: add the PK algorithms * bookkeeping TODO list before merge: doc strings, additions to the manual and NEWS * should I cache `gnutls-macs' and `gnutls-ciphers'? I'm not sure. It seems unnecessary, these are very fast and produce small data structures. * should I distinguish between an AEAD decryption failure (e.g. bad auth) and a general error? Right now both return nil, but I could have the decryption failure return 'fail. * TODO from Eli: avoid allocating a scratch buffer and then copying its data (inside make_unibyte_string) into a newly-allocated string. Instead, use make_uninit_string. * I believe all data is wiped at the C level by the GnuTLS API, but I don't make special efforts at the Lisp level to wipe inputs, keys, IVs, or auth strings. If you think it's worthwhile, let me know what's a good way to do it (or point me to an example in the C code). Thanks Ted