Linux cryptographic layer development
 help / color / mirror / Atom feed
* [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

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