From: Eric Biggers <ebiggers@kernel.org>
To: Richard Weinberger <richard@sigma-star.at>
Cc: Christoph Anton Mitterer <calestyo@scientia.org>,
linux-crypto@vger.kernel.org,
Herbert Xu <herbert@gondor.apana.org.au>,
Milan Broz <gmazyland@gmail.com>,
Demi Marie Obenour <demiobenour@gmail.com>
Subject: Re: AF_ALG deprecation fallout
Date: Sun, 26 Jul 2026 08:37:36 -0700 [thread overview]
Message-ID: <20260726153736.GA1673@sol> (raw)
In-Reply-To: <4065668.hXSD6JRtRq@nailgun>
On Sun, Jul 26, 2026 at 01:12:32PM +0200, Richard Weinberger wrote:
> On Mittwoch, 8. Juli 2026 03:11 Eric Biggers wrote:
> > Note that cryptsetup 2.8.7 will further reduce the cases in which it
> > even needs AF_ALG at all. So just because you are using a particular
> > algorithm doesn't necessarily mean you need it in AF_ALG.
> >
> > No algorithms have been proposed to be dropped from dm-crypt (which is
> > *not* the same thing as AF_ALG), by the way. Given that dm-crypt allows
> > some "interesting" algorithms like RC4, DES-ECB, and even the null
> > cipher, I do think we can expect an allowlist for it at some point as
> > well. But that would be separate.
> >
> > I'd indeed like to remove AF_ALG entirely eventually. But that's a long
> > term thing that would be many years from now and would occur only after
> > iwd, bluez, cryptsetup etc. have all fully migrated to userspace crypto.
>
> Since I got already mails from alerted clients, I'd like to highlight
> one particular use case on (deeply) embedded systems and make sure
> this use case is known.
>
> On systems with very little space, like a few megabytes of flash,
> utilizing dm-crypt with LUKS can be a challenge. Adding a crypto
> library to userspace (e.g. initramfs) is a huge burden.
>
> cryptsetup's --with-crypto_backend=kernel helps a lot here.
> So, by completely removing AF_ALG these systems would unnecessarily
> suffer. Please keep both AF_ALG and --with-crypto_backend=kernel around.
I assume the key on these systems tends not to come from user input
(such as a passphrase). So do you know why cryptsetup and LUKS is being
used at all, instead of just using dm-crypt directly?
Even if LUKS is used, it should be feasible to implement with neither
AF_ALG nor an external userspace crypto library, saving space over your
requested solution which bloats the kernel with AF_ALG. Indeed, in
cryptsetup, LUKS keyslot en/decryption already falls back to a temporary
dm-crypt mapping; see lib/utils_storage_wrappers.c. I understand this
wasn't done consistently in old versions, but in v2.8.7 it is.
For key derivation, assuming the LUKS2 defaults are used, cryptsetup
already has built-in Argon2 code, including an implementation of the
BLAKE2b hash function; see lib/crypto_backend/argon2/blake2/.
So it seems the only missing piece for LUKS is actually the metadata
checksums. (I'll assume that 'cryptsetup benchmark' and support for
formatting a file in LUKS format as non-root users aren't needed here;
those seem to be for testing purposes.) For LUKS2 that's SHA-256.
Built-in SHA-256 could be added to cryptsetup; this would be much
smaller than the code for AF_ALG. Alternatively, for new volumes,
support for configuring these to use BLAKE2b could be added, simply
reusing the BLAKE2b code that is already built-in for key derivation...
So it seems quite feasible. But I strongly suspect that direct use of
dm-crypt would be a better solution for these systems, which would
eliminate the need for cryptsetup entirely.
- Eric
prev parent reply other threads:[~2026-07-26 15:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 0:31 AF_ALG deprecation fallout Christoph Anton Mitterer
2026-07-08 1:11 ` Eric Biggers
2026-07-08 2:14 ` Christoph Anton Mitterer
2026-07-08 3:01 ` Eric Biggers
2026-07-09 10:47 ` Milan Broz
2026-07-09 12:38 ` Christoph Anton Mitterer
2026-07-09 15:27 ` Eric Biggers
2026-07-09 15:35 ` Eric Biggers
2026-07-09 17:07 ` Milan Broz
2026-07-26 11:12 ` Richard Weinberger
2026-07-26 15:37 ` 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=20260726153736.GA1673@sol \
--to=ebiggers@kernel.org \
--cc=calestyo@scientia.org \
--cc=demiobenour@gmail.com \
--cc=gmazyland@gmail.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=richard@sigma-star.at \
/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.