Re: [PATCH v5 2/5] crypto: dun - data-unit-number dispatch template

From: Herbert Xu

Date: Sun Jul 12 2026 - 22:26:04 EST


On Tue, Jun 30, 2026 at 08:34:28AM +0000, Leonid Ravich wrote:
> Add a dun(...) skcipher template that wraps an inner skcipher whose IV
> is a wide data-unit-number counter (e.g. dun(xts(aes),le)). When the
> caller sets skcipher_request::data_unit_size, the template splits the
> request into cryptlen / data_unit_size sub-requests on the inner cipher,
> walking the IV +1 per unit. Each inner ->encrypt/->decrypt is a direct
> call, so only the outer dispatch into the crypto API is indirect -- the
> per-unit work is not.

This shouldn't be a template. The default data-unit handling
should go into the mid-API layer (so skcipher.c). It should
transparently split things up *if* the underlying algorithm does
not support multiple units.

The eventual goal of course it to add unit support to all underlying
algorithms so that the mid-API code does not trigger. But for your
patch-set this would keep the work to a minimum.

Again you should align this with the existing acomp patch-set:

https://lore.kernel.org/all/20260125033537.334628-15-kanchana.p.sridhar@xxxxxxxxx/

In face as the acomp work has not been merged yet, just cherry-pick
that patch.

Thanks,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt