From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: libnettle/libhogweed WIP Date: Sat, 22 Jul 2017 12:10:34 +0300 Message-ID: <83zibw96r9.fsf@gnu.org> References: <874lxmtxyy.fsf@lifelogs.com> <87r30prvwt.fsf@lifelogs.com> <8337d4csez.fsf@gnu.org> <87r30nq9el.fsf@lifelogs.com> <83inlyc1k2.fsf@gnu.org> <87inlyrfni.fsf@lifelogs.com> <837f2eb845.fsf@gnu.org> <87ziedpyy1.fsf@lifelogs.com> <83d1b75u8a.fsf@gnu.org> <87r2znntaq.fsf@lifelogs.com> <87o9u8q4a5.fsf@lifelogs.com> <83tw3xbklg.fsf@gnu.org> <87zictm415.fsf@lifelogs.com> <83podoqchd.fsf@gnu.org> <87podnnbi2.fsf@lifelogs.com> <8760ewi3rw.fsf@lifelogs.com> <87r2xjgilq.fsf@lifelogs.com> <83iniug7ql.fsf@gnu.org> <87fudyhkhy.fsf@lifelogs.com> <8360euf4d3.fsf@gnu.org> <87r2xhfsre.fsf@lifelogs.com> <83o9slecp0.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1500714652 4057 195.159.176.226 (22 Jul 2017 09:10:52 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 22 Jul 2017 09:10:52 +0000 (UTC) Cc: emacs-devel@gnu.org To: tzz@lifelogs.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 22 11:10:48 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 1dYqQv-0000k8-9P for ged-emacs-devel@m.gmane.org; Sat, 22 Jul 2017 11:10:45 +0200 Original-Received: from localhost ([::1]:46211 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYqR0-0002uG-Tw for ged-emacs-devel@m.gmane.org; Sat, 22 Jul 2017 05:10:50 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60098) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYqQu-0002uA-17 for emacs-devel@gnu.org; Sat, 22 Jul 2017 05:10:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYqQq-0005PM-Pw for emacs-devel@gnu.org; Sat, 22 Jul 2017 05:10:43 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42475) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYqQq-0005PA-Da; Sat, 22 Jul 2017 05:10:40 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3396 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dYqQp-0003xL-Rd; Sat, 22 Jul 2017 05:10:40 -0400 In-reply-to: <83o9slecp0.fsf@gnu.org> (message from Eli Zaretskii on Sat, 15 Jul 2017 22:12:59 +0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e 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:216931 Archived-At: Ping! Anything further on this? Anything I can do to help debugging this problem? > Date: Sat, 15 Jul 2017 22:12:59 +0300 > From: Eli Zaretskii > Cc: emacs-devel@gnu.org > > > From: Ted Zlatanov > > Date: Sat, 15 Jul 2017 14:40:37 -0400 > > > > The size of the output is determined by the cipher's parameters. So we > > need to know the parameters, which are in cplist. > > As I wrote, the problem happens on the first iteration through the > loop in test-gnutls-005-aead-ciphers, so the cipher's parameters > should be known, as they are set up by the code. But in case this > isn't telling the whole story, you will see the values below. > > > Can you capture the full parameters and memory buffers passed into the > > GnuTLS functions? > > I attach below the GDB transcript with this information. Let me know > if you need more data. > > > Here's the sequence we expect in the test, this in a let* form: > > > > 1. The IV may be actual data or it may be a list of 'iv-auto and ivsize > > which tells extract_data_from_object() to generate a random IV (which is > > returned as the second element by `gnutls-symmetric-encrypt'). > > > > 2. We call (gnutls-symmetric-encrypt cplist (copy-sequence key) iv input (copy-sequence auth)) > > > > 3. We need to make sure the cplist, key, iv, input, and auth make it > > down to the GnuTLS C functions. > > > > 4. We need to look at the output returned from the GnuTLS C function and > > make sure it makes it to the return of `gnutls-symmetric-encrypt' > > together with the actual IV used. > > > > 5. We need to do the same as steps 1-4 for decryption. > > That's what I did, and my observations were in the previous mail. I > just didn't know what to expect, so I couldn't tell whether some of > the data was incorrect. > > > If you can provide a recipe for testing your case, that would be > > helpful. > > I'm just running test-gnutls-005-aead-ciphers in an interactive > session after loading gnutls-tests.el by hand. > > Here's the GDB transcript: > > (gdb) break Fgnutls_symmetric_encrypt > Breakpoint 3 at 0x12aa8f5: file gnutls.c, line 2142. > (gdb) break Fgnutls_symmetric_decrypt > Breakpoint 4 at 0x12aa98b: file gnutls.c, line 2169. > (gdb) r -Q > > Thread 1 hit Breakpoint 3, Fgnutls_symmetric_encrypt ( > cipher=XIL(0xc000000006c4c2a0), key=XIL(0x8000000006c336f0), > iv=XIL(0x8000000006c33700), input=XIL(0x8000000006c34990), > aead_auth=XIL(0)) at gnutls.c:2142 > 2142 return gnutls_symmetric (true, cipher, key, iv, input, aead_auth); > (gdb) pp cipher > (:cipher-id 16 :type gnutls-symmetric-cipher :cipher-aead-capable t :cipher-tagsize 16 :cipher-blocksize 16 :cipher-keysize 32 :cipher-ivsize 12) > (gdb) pp key > " mykey" > (gdb) pp iv > " " > (gdb) pp input > " " > (gdb) pp aead_auth > nil > (gdb) c > Continuing. > > Thread 1 hit Breakpoint 4, Fgnutls_symmetric_decrypt ( > cipher=XIL(0xc000000006c4c2a0), key=XIL(0x8000000006c32fa0), > iv=XIL(0x8000000006c336a0), input=XIL(0x8000000006c32fb0), > aead_auth=XIL(0)) at gnutls.c:2169 > 2169 return gnutls_symmetric (false, cipher, key, iv, input, aead_auth); > (gdb) pp cipher > (:cipher-id 16 :type gnutls-symmetric-cipher :cipher-aead-capable t :cipher-tagsize 16 :cipher-blocksize 16 :cipher-keysize 32 :cipher-ivsize 12) > (gdb) pp key > " mykey" > (gdb) pp iv > " " > (gdb) pp input > "% F[MM ¼ t > E ↑ % >*Rº [z " > (gdb) p input > $1 = XIL(0x8000000006c32fb0) > (gdb) xstring > $2 = (struct Lisp_String *) 0x6c32fb0 > "%\231F[MM∩\237\212¼µ≤t\212\nEπ \030\376%τµ>*Rº╬[zו\200" > (gdb) p *$ > $3 = { > size = 32, > size_byte = -1, > intervals = 0x0, > data = 0x6ce0a40 "%\231F[MM∩\237\212¼µ≤t\212\nEπ \030\376%τµ>*Rº╬[zו\200" > } > (gdb) pp aead_auth > nil > >