linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: Eric Biggers <ebiggers@kernel.org>
Cc: linux-crypto@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	 herbert@gondor.apana.org.au, will@kernel.org,
	kernel-team@android.com
Subject: Re: [PATCH v5 5/5] crypto: arm64/aes-ccm - avoid by-ref argument for ce_aes_ccm_auth_data
Date: Wed, 26 May 2021 11:14:15 +0200	[thread overview]
Message-ID: <CAMj1kXGRj+OUuJRXgi6QoCGMzjArYH0Hx08hvsvsbPqOLwD3wQ@mail.gmail.com> (raw)
In-Reply-To: <YKwgSnb4RJr40Ns2@gmail.com>

On Mon, 24 May 2021 at 23:53, Eric Biggers <ebiggers@kernel.org> wrote:
>
> On Fri, May 21, 2021 at 12:20:53PM +0200, Ard Biesheuvel wrote:
> > With the SIMD code path removed, we can clean up the CCM auth-only path
> > a bit further, by passing the 'macp' input buffer pointer by value,
> > rather than by reference, and taking the output value from the
> > function's return value.
> >
> > This way, the compiler is no longer forced to allocate macp on the
> > stack. This is not expected to make any difference in practice, it just
> > makes for slightly cleaner code.
> >
> > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> > ---
> >  arch/arm64/crypto/aes-ce-ccm-core.S | 23 ++++++++++----------
> >  arch/arm64/crypto/aes-ce-ccm-glue.c | 17 +++++----------
> >  2 files changed, 17 insertions(+), 23 deletions(-)
> >
> > diff --git a/arch/arm64/crypto/aes-ce-ccm-core.S b/arch/arm64/crypto/aes-ce-ccm-core.S
> > index 8adff299fcd3..b03f7f71f893 100644
> > --- a/arch/arm64/crypto/aes-ce-ccm-core.S
> > +++ b/arch/arm64/crypto/aes-ce-ccm-core.S
> > @@ -12,22 +12,21 @@
> >       .arch   armv8-a+crypto
> >
> >       /*
> > -      * void ce_aes_ccm_auth_data(u8 mac[], u8 const in[], u32 abytes,
> > -      *                           u32 *macp, u8 const rk[], u32 rounds);
> > +      * u32 ce_aes_ccm_auth_data(u8 mac[], u8 const in[], u32 abytes,
> > +      *                          u32 macp, u8 const rk[], u32 rounds);
>
> How is this different from 'u8 mac[]' which is already one of the parameters?
>

mac[] is the combined digest/input buffer, and macp is the index into
it that keeps track on how much new input we have accumulated. I.e.,
instead of having a separate buffer of the same size, and accumulating
bytes until we can perform the XOR + AES transformation, the partial
input is accumulated into mac[] using XOR directly.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2021-05-26 11:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-21 10:20 [PATCH v5 0/5] running kernel mode SIMD with softirqs disabled Ard Biesheuvel
2021-05-21 10:20 ` [PATCH v5 1/5] crypto: arm64/gcm-aes-ce - remove non-SIMD fallback path Ard Biesheuvel
2021-05-24 21:46   ` Eric Biggers
2021-05-21 10:20 ` [PATCH v5 2/5] crypto: arm64/aes-neonbs - stop using SIMD helper for skciphers Ard Biesheuvel
2021-05-24 21:46   ` Eric Biggers
2021-05-21 10:20 ` [PATCH v5 3/5] crypto: arm64/aes-ce " Ard Biesheuvel
2021-05-24 21:47   ` Eric Biggers
2021-05-21 10:20 ` [PATCH v5 4/5] crypto: arm64/aes-ccm - remove non-SIMD fallback path Ard Biesheuvel
2021-05-24 21:51   ` Eric Biggers
2021-05-26  9:12     ` Ard Biesheuvel
2021-05-21 10:20 ` [PATCH v5 5/5] crypto: arm64/aes-ccm - avoid by-ref argument for ce_aes_ccm_auth_data Ard Biesheuvel
2021-05-24 21:53   ` Eric Biggers
2021-05-26  9:14     ` Ard Biesheuvel [this message]

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=CAMj1kXGRj+OUuJRXgi6QoCGMzjArYH0Hx08hvsvsbPqOLwD3wQ@mail.gmail.com \
    --to=ardb@kernel.org \
    --cc=ebiggers@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=kernel-team@android.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=will@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).