From: Eric Biggers <ebiggers@kernel.org>
To: Antonio Quartulli <antonio@mandelbit.com>
Cc: linux-crypto@vger.kernel.org, Ard Biesheuvel <ardb@kernel.org>,
"Jason A . Donenfeld" <Jason@zx2c4.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
x86@kernel.org
Subject: Re: [RFC PATCH] lib/crypto: x86/aes-gcm: Process short associated data in one asm call
Date: Sat, 5 Dec 2026 18:27:21 -0800 [thread overview]
Message-ID: <20261206022721.GE362402@quark> (raw)
In-Reply-To: <20261205195107.181324-1-antonio@mandelbit.com>
On Sat, Dec 05, 2026 at 08:51:06PM +0100, Antonio Quartulli wrote:
> The one-shot AES-GCM path XORs associated data shorter than one block
> byte by byte into the zeroed GHASH accumulator in memory and then calls
> the GHASH multiplication, which reloads it. Network protocols commonly
> use 8 to 13 bytes of associated data, so this runs once per packet.
>
> Add aes_gcm_ad_short_vaes_avx512(), which loads 1 to 15 bytes of
> associated data with a masked load straight from the caller's buffer,
> multiplies the zero-padded block by H in registers and stores the
> accumulator once, without reading it. Use it from aes_gcm_crypt_x86()
> on the VAES+AVX512 tier, and zero the accumulator only on the other
> paths.
>
> Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Thanks. Yes, I'd like to optimize the 1 <= ad_len <= 15 case a bit
more. That was intentionally left for incremental patches to avoid
bloating the scope of the series too much (as the libgf128hash arch
hooks currently handle full blocks only). So, thanks for taking it up
already. It likely would make more sense to have it be supported at the
libgf128hash layer, but I'll look into it. Another option (which would
be much simpler, though not optimal) is to simply replace the
byte-at-a-time XOR loop with a 8 => 4 => 2 => 1 sequence.
- Eric
next prev parent reply other threads:[~2026-12-06 2:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 20:02 [PATCH 00/11] Migrate x86_64 AES-GCM code into library Eric Biggers
2026-11-29 20:02 ` [PATCH 01/11] crypto: aes - Flush dcache in CBC-CTS and XTS linear fast paths Eric Biggers
2026-11-29 20:02 ` [PATCH 02/11] lib/crypto: gf128hash: Link libgf128hash before libaes Eric Biggers
2026-11-29 20:02 ` [PATCH 03/11] lib/crypto: aes-gcm: Add one-shot AES-GCM arch hooks Eric Biggers
2026-11-29 20:02 ` [PATCH 04/11] crypto: aes - Add linear fast path for AES-GCM Eric Biggers
2026-11-29 20:02 ` [PATCH 05/11] lib/crypto: x86/gf128hash: Optimize GHASH and POLYVAL with PCLMULQDQ and AVX Eric Biggers
2026-11-29 20:02 ` [PATCH 06/11] lib/crypto: x86/gf128hash: Optimize GHASH and POLYVAL with VPCLMULQDQ and AVX2 Eric Biggers
2026-11-29 20:02 ` [PATCH 07/11] lib/crypto: x86/gf128hash: Optimize GHASH and POLYVAL with VPCLMULQDQ and AVX512 Eric Biggers
2026-11-29 20:02 ` [PATCH 08/11] lib/crypto: x86/aes-gcm: Migrate AES-NI optimized code into library Eric Biggers
2026-11-29 20:02 ` [PATCH 09/11] lib/crypto: x86/aes-gcm: Migrate VAES+AVX2 " Eric Biggers
2026-11-29 20:02 ` [PATCH 10/11] lib/crypto: x86/aes-gcm: Migrate VAES+AVX512 " Eric Biggers
2026-11-29 20:02 ` [PATCH 11/11] crypto: x86/aesni-intel - Remove empty module Eric Biggers
2026-12-05 19:51 ` [RFC PATCH] lib/crypto: x86/aes-gcm: Process short associated data in one asm call Antonio Quartulli
2026-12-06 2:27 ` Eric Biggers [this message]
2026-12-06 2:09 ` [PATCH 00/11] Migrate x86_64 AES-GCM code into library Eric Biggers
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=20261206022721.GE362402@quark \
--to=ebiggers@kernel.org \
--cc=Jason@zx2c4.com \
--cc=antonio@mandelbit.com \
--cc=ardb@kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=x86@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