* [RFC] crypto: adiantum - Switch to the ChaCha library
@ 2026-11-27 23:36 Laveesh Bansal
2026-11-28 0:10 ` Eric Biggers
0 siblings, 1 reply; 2+ messages in thread
From: Laveesh Bansal @ 2026-11-27 23:36 UTC (permalink / raw)
To: Eric Biggers; +Cc: Herbert Xu, linux-crypto
Hi Eric
In the thread for your setkey patch
(https://lore.kernel.org/all/20261127184407.GB1974@quark/) you wrote:
> Later we should shrink the required stack space by switching
> from crypto_skcipher to the ChaCha library.
If you have not started on this, I would like to do it as a follow-up
once your setkey and AES library patches are applied. I have a
prototype and would like to check the approach with you first.
It is two patches on top of yours. The first makes adiantum_setkey()
derive the subkeys with chacha_init(), hchacha_block() and
chacha_crypt(), so the skcipher request on the stack goes away. The
second makes adiantum_crypt() call the library directly. It walks src
and dst with two scatter_walks, rounds each step down to a multiple of
64 bytes unless it is the last, and uses a 64-byte bounce buffer for
shorter pieces. It removes the child tfm and the spawn. The
algorithm names stay the same.
I tested on arm64 with gcc 13.3.0 and KASAN, lockdep and
CRYPTO_SELFTESTS enabled (and _FULL with both patches applied). Random
cases through AF_ALG give the same ciphertext as the code with and
without your patches. A test module with odd scatterlist splits, in
and out of place, also passes. I saw no KASAN or lockdep reports
and no selftest failures. The adiantum_setkey() stack frame is much
smaller than with your patch. The adiantum_crypt() frame is larger than
before, and the data path as a whole stays about the same depth. I have
not tried x86_64 or s390x yet.
There is no second adiantum driver for testmgr to compare against, so
its vectors are the only in-tree check. None of them has full ChaCha
blocks followed by a partial one. Before the cleanup I can add a few
that do.
Do the overall design and direction look fine to you? If so, I can
start with the vectors and then send the cleanup patch series.
Thanks
Laveesh
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFC] crypto: adiantum - Switch to the ChaCha library
2026-11-27 23:36 [RFC] crypto: adiantum - Switch to the ChaCha library Laveesh Bansal
@ 2026-11-28 0:10 ` Eric Biggers
0 siblings, 0 replies; 2+ messages in thread
From: Eric Biggers @ 2026-11-28 0:10 UTC (permalink / raw)
To: Laveesh Bansal; +Cc: Herbert Xu, linux-crypto
On Fri, Nov 27, 2026 at 03:36:36PM -0800, Laveesh Bansal wrote:
> Hi Eric
>
> In the thread for your setkey patch
> (https://lore.kernel.org/all/20261127184407.GB1974@quark/) you wrote:
>
> > Later we should shrink the required stack space by switching
> > from crypto_skcipher to the ChaCha library.
>
> If you have not started on this, I would like to do it as a follow-up
> once your setkey and AES library patches are applied. I have a
> prototype and would like to check the approach with you first.
>
> It is two patches on top of yours. The first makes adiantum_setkey()
> derive the subkeys with chacha_init(), hchacha_block() and
> chacha_crypt(), so the skcipher request on the stack goes away. The
> second makes adiantum_crypt() call the library directly. It walks src
> and dst with two scatter_walks, rounds each step down to a multiple of
> 64 bytes unless it is the last, and uses a 64-byte bounce buffer for
> shorter pieces. It removes the child tfm and the spawn. The
> algorithm names stay the same.
>
> I tested on arm64 with gcc 13.3.0 and KASAN, lockdep and
> CRYPTO_SELFTESTS enabled (and _FULL with both patches applied). Random
> cases through AF_ALG give the same ciphertext as the code with and
> without your patches. A test module with odd scatterlist splits, in
> and out of place, also passes. I saw no KASAN or lockdep reports
> and no selftest failures. The adiantum_setkey() stack frame is much
> smaller than with your patch. The adiantum_crypt() frame is larger than
> before, and the data path as a whole stays about the same depth. I have
> not tried x86_64 or s390x yet.
>
> There is no second adiantum driver for testmgr to compare against, so
> its vectors are the only in-tree check. None of them has full ChaCha
> blocks followed by a partial one. Before the cleanup I can add a few
> that do.
>
> Do the overall design and direction look fine to you? If so, I can
> start with the vectors and then send the cleanup patch series.
Probably. I'd like to provide Adiantum support in lib/crypto/, but this
might be another worthwhile intermediate step. If you want to do what
you proposed, go ahead and send the patches, making sure to include the
base-commit and prerequisite-patch-id lines so that it's clear how to
apply them. Besides that, the pace of everything has picked up due to
AI coding tools, so I don't think I can be expected to give detailed
feedback on an AI-assisted email like this where there are no patches.
Once there are patches it will be more concrete what you mean.
- Eric
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-28 0:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 23:36 [RFC] crypto: adiantum - Switch to the ChaCha library Laveesh Bansal
2026-11-28 0:10 ` Eric Biggers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox