From: Johannes Berg <johannes@sipsolutions.net>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: "<linux-wireless@vger.kernel.org>"
<linux-wireless@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>,
"<netdev@vger.kernel.org>" <netdev@vger.kernel.org>,
Jouni Malinen <jouni@qca.qualcomm.com>
Subject: Re: [PATCH v3 1/2] mac80211: fils_aead: Use crypto api CMAC shash rather than bare cipher
Date: Wed, 08 Feb 2017 08:46:48 +0100 [thread overview]
Message-ID: <1486540008.4603.3.camel@sipsolutions.net> (raw)
In-Reply-To: <CAKv+Gu9Be-bA-Trn5cMwVvf4+yMm8w2Krm59WGAhdM3bxBSJfw@mail.gmail.com> (sfid-20170208_084553_216930_7D2DAE1D)
On Wed, 2017-02-08 at 07:45 +0000, Ard Biesheuvel wrote:
> On 8 February 2017 at 07:00, Johannes Berg <johannes@sipsolutions.net
> > wrote:
> > This looks strange to me:
> >
> > > +static int aes_s2v(struct crypto_shash *tfm,
> > > size_t num_elem, const u8 *addr[], size_t len[],
> > > u8 *v)
> > > {
> > > - u8 d[AES_BLOCK_SIZE], tmp[AES_BLOCK_SIZE];
> > > + u8 d[AES_BLOCK_SIZE], tmp[AES_BLOCK_SIZE] = {};
> > > + SHASH_DESC_ON_STACK(desc, tfm);
> >
> > desc declared
> >
> > >
> > > + crypto_shash_digest(desc, tmp, AES_BLOCK_SIZE, d);
> >
> > used here
> >
>
> Each digest() call combines a init()/update()/final() sequence
>
> > > + crypto_shash_init(desc);
> >
> > but initialized now?
> >
>
> ... for the 6th time, or so. The final vector may require two
> update()s, so we cannot use digest() here. But we can use finup() for
> the last one, which combines update() and final().
>
> Hence,
>
> init()/finup()
>
> or
>
> init()/update()/finup()
>
> depending on the length of the last vector.
Great, thanks for the explanation :)
johannes
next prev parent reply other threads:[~2017-02-08 7:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-06 10:49 [PATCH v3 0/2] mac80211: use crypto shash for AES cmac Ard Biesheuvel
2017-02-06 10:49 ` Ard Biesheuvel
2017-02-06 10:49 ` [PATCH v3 1/2] mac80211: fils_aead: Use crypto api CMAC shash rather than bare cipher Ard Biesheuvel
2017-02-08 7:00 ` Johannes Berg
2017-02-08 7:00 ` Johannes Berg
2017-02-08 7:45 ` Ard Biesheuvel
2017-02-08 7:45 ` Ard Biesheuvel
2017-02-08 7:46 ` Johannes Berg [this message]
2017-02-06 10:49 ` [PATCH v3 2/2] mac80211: aes-cmac: switch to shash CMAC driver Ard Biesheuvel
2017-02-08 8:19 ` [PATCH v3 0/2] mac80211: use crypto shash for AES cmac Johannes Berg
2017-02-08 8:19 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1486540008.4603.3.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=ard.biesheuvel@linaro.org \
--cc=davem@davemloft.net \
--cc=jouni@qca.qualcomm.com \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.