From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephan Mueller Subject: Re: [PATCH 5/7] esp6: Switch to new AEAD interface Date: Tue, 26 May 2015 09:02:14 +0200 Message-ID: <716314578.9tHrBnOAvv@tauon> References: <20150521103938.GA23035@gondor.apana.org.au> <20150522071923.GA2777@gondor.apana.org.au> <2306681.gksi6E3i3N@tachyon.chronox.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: Linux Crypto Mailing List , netdev@vger.kernel.org, "David S. Miller" , Johannes Berg , Marcel Holtmann , Steffen Klassert To: Herbert Xu Return-path: Received: from mail.eperm.de ([89.247.134.16]:58272 "EHLO mail.eperm.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752068AbbEZHCQ (ORCPT ); Tue, 26 May 2015 03:02:16 -0400 In-Reply-To: <2306681.gksi6E3i3N@tachyon.chronox.de> Sender: netdev-owner@vger.kernel.org List-ID: Am Dienstag, 26. Mai 2015, 08:39:56 schrieb Stephan Mueller: Hi, >Am Freitag, 22. Mai 2015, 15:19:23 schrieb Herbert Xu: > >Hi Herbert, > >> On Fri, May 22, 2015 at 09:16:08AM +0200, Stephan Mueller wrote: >> > Thanks for the pointer, but there I do not really see the functionality I >> > am looking for. I see patch 10/16 which seems to indicate that the geniv >> > logic is now to be invoked as a normal AEAD cipher. I yet fail to see >> > where the distinction is made in the code that an IV is to be generated >> > versus the given IV is to be used. >> >> Only IV generators algorithms will generate IV. The generated IV >> will be placed at the start of cipher text. See patches 14-16 for >> the actual implementation. > >Thanks for the help. > >May I also ask where I can find the generated IV when using >rfc4106(gcm(aes))? The old invocation used aead_givcrypt_set_crypt(req, >iv->data, 0) which delivered the 64 bit value generated by seqiv. > >With the new invocation, I use the SGL with AD || IV space || PT > > ivlen = crypto_aead_ivsize(tfm); > sg_init_table(sg, 3); > sg_set_buf(&sg[0], aead_assoc->data, aead_assoc->len); > /* iv->data should be filled by seqiv */ > sg_set_buf(&sg[1], iv->data, ivlen); > sg_set_buf(&sg[2], data->data, data->len + > (enc ? authsize : 0)); > aead_request_set_ad(req, aead_assoc->len, 0); > aead_request_set_crypt(req, sg, sg, data->len + ivlen, iv->data); > >But in iv->data, there is nothing to be found after performing the encrypt >operation. To be more precise, in iv->data, there is some data. But it is always static (seqiv's uses a random number) and does not seem to be the IV used for GCM when checking with a reference implementation. > >Thanks a lot. Ciao Stephan