From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796524043; b=iZwcW+SXjYCt8T44ylg0cRfwH1FrKLqC110rQtEPTNRdul5+GKQktc2O0PHz5/asEkOJ 7uT6m0XUAU/GcmA87EXkwuN59khQ4Hy2TaePRhAyu2K6Ugu1Ffwq5g6zFGLtBEIa6+QYt MpXAQyQMeEuFtSmNIGls7Oh0PrLyFYJWSm3CQ9beDQDNKjXEQeaFSsdEOXVniBE/9+C2j 3Qdrlr236BbKO9f3M6MhAHnt/IBtHLqPPiGZqCJ0prf78PpaujWtpxLnVtGal9CORhbIN GCjIBL6mzufvcXJlgfZ9obp64+JE/9atJaljVu8gGPpjeb/n32JHpJIB+ahD/MUY71g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796524043; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=Rozh3AbJ/ze171hMj/q6rxObYewmNgCByXRjcSLJm8I=; b=AbErcMg20pSJ+NxYu4DBA5zMeWXeK55h2gNPSUBertUJYzhHHTCbUmSjpgkbTe1Nsc+M CP7zU1NTbmUTNW0JLigY2uRXApqoYO3uJdSvWlv+hCBNHqt9+HIy66cMERmrTEb54/boZ cLvgLQHBUNx41Q93n3wn6oly+1WX2tbK3BmM6LFlsOuoeEWTu8uNHkrh0+E+mnvvGr/jZ O+DYv/NB9tBgnP1jGfGdJE2vQMiAhLqIzfueXs0JEEmFMkZ2l5CTo1Qv3cmZdB/w++57/ eSY9u1ZBN0MtXGDuK9rH0lzMUmg5ONkGKi2Ccmjwe9zsLUEJ6s2YsLv/NysLPD+n3eA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=aLtcG1tY; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 852D1606A31F for ; Sun, 6 Dec 2026 02:27:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=aLtcG1tY Received: by smtp.kernel.org (Postfix) with ESMTPSA id 230331F0092B; Sun, 6 Dec 2026 02:27:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796524043; bh=Rozh3AbJ/ze171hMj/q6rxObYewmNgCByXRjcSLJm8I=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=aLtcG1tYEbvzA8g4WeaowQYeRu9tnc/qKOdRKSgT1UhsnUj+TrdlPdx850HiezQWf 4aqxHZOsoqbIYFwS3eICponfBE/zXXqM/M2CZHgMY0p/JNoQahqlWBRrbzvqHZ1cP6 ItmX9ynYuIUBh31yACfXG1zlb8D3c/FdManpBdAnBo9X8dB5NP+HVPRR6d2H/44JvR mNtqeJoszfDfWzVA4xtvOiIPfjKxGH00AK3FsOGj30NrleTcwajOYSXIR9fNCaQ/r/ JKXLSBaXTT+2HA70yzCljn1PISfX1wYLfze5+rOoCPi5ATzMqQ3HqTLcaJY6G2X03Y SbEsYbJi3NHWA== Date: Sat, 5 Dec 2026 18:27:21 -0800 From: Eric Biggers To: Antonio Quartulli Cc: linux-crypto@vger.kernel.org, Ard Biesheuvel , "Jason A . Donenfeld" , Herbert Xu , x86@kernel.org Subject: Re: [RFC PATCH] lib/crypto: x86/aes-gcm: Process short associated data in one asm call Message-ID: <20261206022721.GE362402@quark> References: <20261129200245.146503-1-ebiggers@kernel.org> <20261205195107.181324-1-antonio@mandelbit.com> X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 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