From: Herbert Xu <herbert@gondor.apana.org.au>
To: Karl Mehltretter <kmehltretter@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>,
Cyrille Pitchen <cyrille.pitchen@atmel.com>,
linux-crypto@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crypto: atmel: handle authenc requests without plaintext
Date: Fri, 2 Oct 2026 18:22:41 +1000 [thread overview]
Message-ID: <ar9p0Z7wA-5TDQA7@gondor.apana.org.au> (raw)
In-Reply-To: <20260922051705.15329-1-kmehltretter@gmail.com>
On Tue, Sep 22, 2026 at 07:17:04AM +0200, Karl Mehltretter wrote:
> Authenc permits a nonempty associated-data string with no plaintext. The
> Atmel driver accepts such a request, has SHA process the associated data,
> and then unconditionally asks AES DMA to transfer zero bytes. The Atmel
> DMA engines reject the zero-length descriptor, so the valid request fails,
> normally with -ENOMEM.
>
> Skip the AES transfer when textlen is zero and proceed directly to SHA
> finalization.
>
> Once an HMAC transform has cached its inner and outer states, SHA can
> complete this path synchronously. The forced ahash completion callback
> then invokes the AES finalizer through a void function and discards its
> return value. This loses -EBADMSG for a mismatched tag and reports
> successful decryption.
>
> For synchronous SHA completion, release the SHA device without invoking
> the ahash callback and call the AES finalizer directly. Its result then
> propagates through the synchronous call chain. Keep the existing callback
> path for asynchronous completion.
>
> On a SAM9X75, the unpatched driver failed valid AAD-only requests and
> returned success for a bad tag after the transform had been used once. With
> this change, bad tags return -EBADMSG for both fresh and reused transforms.
>
> Fixes: 89a82ef87e01 ("crypto: atmel-authenc - add support to authenc(hmac(shaX), Y(aes)) modes")
> Assisted-by: LLM
> Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
> ---
> drivers/crypto/atmel-aes.c | 2 ++
> drivers/crypto/atmel-sha.c | 14 ++++++++++++++
> 2 files changed, 16 insertions(+)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
prev parent reply other threads:[~2026-10-02 8:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 5:17 [PATCH] crypto: atmel: handle authenc requests without plaintext Karl Mehltretter
2026-10-02 8:22 ` Herbert Xu [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=ar9p0Z7wA-5TDQA7@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=alexandre.belloni@bootlin.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=cyrille.pitchen@atmel.com \
--cc=davem@davemloft.net \
--cc=kmehltretter@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
/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