All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Laveesh Bansal <laveeshb@laveeshbansal.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>, linux-crypto@vger.kernel.org
Subject: Re: [RFC] crypto: adiantum - Switch to the ChaCha library
Date: Fri, 27 Nov 2026 16:10:32 -0800	[thread overview]
Message-ID: <20261128001032.GA179262@quark> (raw)
In-Reply-To: <20261127233636.7172-1-laveeshb@laveeshbansal.com>

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

      reply	other threads:[~2026-11-28  0:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 23:36 [RFC] crypto: adiantum - Switch to the ChaCha library Laveesh Bansal
2026-11-28  0:10 ` Eric Biggers [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=20261128001032.GA179262@quark \
    --to=ebiggers@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=laveeshb@laveeshbansal.com \
    --cc=linux-crypto@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.