Re: [PATCH 5/7] esp6: Switch to new AEAD interface

Stephan Mueller
2015-05-26T07:02:16Z

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