From: Eric Biggers <ebiggers@kernel.org>
To: Richard Weinberger <richard.weinberger@gmail.com>
Cc: Dominique Martinet <asmadeus@codewreck.org>,
demiobenour@gmail.com,
Harald Freudenberger <freude@linux.ibm.com>,
acme@kernel.org, adrian.hunter@intel.com,
alexander.shishkin@linux.intel.com, ardb@kernel.org,
axboe@kernel.dk, corbet@lwn.net, davem@davemloft.net,
edumazet@google.com, herbert@gondor.apana.org.au,
horms@kernel.org, io-uring@vger.kernel.org, irogers@google.com,
james.clark@linaro.org, jolsa@kernel.org, kuba@kernel.org,
kuniyu@google.com, linux-crypto@vger.kernel.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-perf-users@vger.kernel.org, mark.rutland@arm.com,
mingo@redhat.com, namhyung@kernel.org, netdev@vger.kernel.org,
pabeni@redhat.com, peterz@infradead.org,
skhan@linuxfoundation.org, willemb@google.com,
linux-s390@vger.kernel.org
Subject: Re: [PATCH 2/3] AF_ALG: Drop support for off-CPU cryptography
Date: Sun, 26 Jul 2026 08:50:24 -0700 [thread overview]
Message-ID: <20260726155024.GB1673@sol> (raw)
In-Reply-To: <CAFLxGvyBGzfwh61F5YkYqctNPCQJCpFOwTtKfDs4L+iK8WJZpQ@mail.gmail.com>
On Sun, Jul 26, 2026 at 09:28:14AM +0200, Richard Weinberger wrote:
> On Sun, Jul 26, 2026 at 12:04 AM Eric Biggers <ebiggers@kernel.org> wrote:
> > > You can create a CAAM BLOB (a generated and sealed key) using the
> > > trusted keys subsystem and use this BLOB
> > > later in AF_ALG to perform AES with a key invisible to userspace.
> > >
> > > e.g.
> > > kid=$(keyctl add trusted mykey "new 32 pk" @s)
> > > keyctl print $kid | xxd -r -p > blob.bin
> > > Then just create a caam_pkey_info in userspace and feed it into AF_ALG
> > > and perform AES with it.
> >
> > Well, specifically AES-CBC. That's the only one that is in the driver.
>
> Yes.
>
> > > So, pretty please, if you kill AF_ALG and all this, offer some way to
> > > achieve the same in userspace.
> >
> > If needed, "cbc(paes)" and/or "cbc-paes-caam" (whichever name it is
> > being accessed as) can be allowed as a special case, as a stop-gap.
>
> Would be great.
>
> > This would need confirmed use of that specific algorithm with upstream,
> > which we don't quite have yet. Dominique had a confirmed use of
> > "tk(cbc(aes))", but that has never existed upstream in the first place,
> > so it's not something that could be allowlisted upstream.
>
> It's "cbc(paes)".
>
> From one of my demo applications:
>
> struct sockaddr_alg sa = {
> .salg_family = AF_ALG,
> .salg_type = "skcipher",
> .salg_name = "cbc(paes)",
> };
>
> > You've only mentioned that it "can" be used in this way in upstream.
> > Can you confirm that it *is* used, and with an actual upstream algorithm
> > name, and if so which one(s)? And if so, would you also be able to
> > share whether this is for dm-crypt or not? We should remember that
> > dm-crypt accepts keys directly and AF_ALG is not needed to use it.
>
> Well, if you require me to point to some open source application, sorry I can't.
>
> But no, the use cases I know about are not dm-crypt.
> It's more allowing to encrypt/decrypt data in userspace without being able to
> extract the key from the device. Since the key is hardware bound too,
> it is device
> specific and you cannot decrypt on device B what you have encrypted on A, even
> if you share the BLOB.
> So, it's more like a building block for a poor man's secure element.
>
> At $dayjob we've been recommending AF_ALG because it's a standard interface.
> Not like other ad-hoc horrors via sysfs or worse we've seen on some BSPs.
Then I would suggest that skcipher_bind() should check if the name is
"cbc(paes)", and if so use 0 instead of AF_ALG_CRYPTOAPI_MASK. Please
go ahead and send a patch against mainline (for v7.2-rc6) if you're
interested.
On cryptodev/master (future 7.3) it should get an entry in the new
skcipher_allowlist as well: { "cbc(paes)", true }. That would be a
separate patch.
With those it will keep working as root. (And you mentioned in your
other email it's used only as root anyway.)
- Eric
next prev parent reply other threads:[~2026-07-26 15:52 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-23 19:43 [PATCH 0/3] AF_ALG: Remove support for AIO and old-style drivers Demi Marie Obenour via B4 Relay
2026-05-23 19:43 ` [PATCH 1/3] net: Remove support for AIO on sockets Demi Marie Obenour via B4 Relay
2026-05-25 8:03 ` Christoph Hellwig
2026-05-26 15:58 ` Jens Axboe
2026-05-27 8:13 ` Christoph Hellwig
2026-05-28 16:56 ` Jens Axboe
2026-05-29 13:59 ` Christoph Hellwig
2026-05-27 1:40 ` Jakub Kicinski
2026-05-23 19:43 ` [PATCH 2/3] AF_ALG: Drop support for off-CPU cryptography Demi Marie Obenour via B4 Relay
2026-06-03 13:33 ` Harald Freudenberger
2026-07-24 15:35 ` Dominique Martinet
2026-07-24 16:00 ` Eric Biggers
2026-07-24 16:32 ` Dominique Martinet
2026-07-24 18:09 ` Eric Biggers
2026-07-25 7:37 ` Dominique Martinet
2026-07-25 10:18 ` Simon Richter
2026-07-25 17:38 ` Demi Marie Obenour
2026-07-25 17:49 ` Eric Biggers
2026-07-24 20:35 ` Demi Marie Obenour
2026-07-25 20:55 ` Richard Weinberger
2026-07-25 22:04 ` Eric Biggers
2026-07-25 23:09 ` Eric Biggers
2026-07-26 7:30 ` Richard Weinberger
2026-07-26 7:28 ` Richard Weinberger
2026-07-26 15:50 ` Eric Biggers [this message]
2026-05-23 19:43 ` [PATCH 3/3] AF_ALG: Document that it is *always* slower Demi Marie Obenour via B4 Relay
2026-05-29 6:09 ` [PATCH 0/3] AF_ALG: Remove support for AIO and old-style drivers Herbert Xu
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=20260726155024.GB1673@sol \
--to=ebiggers@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=ardb@kernel.org \
--cc=asmadeus@codewreck.org \
--cc=axboe@kernel.dk \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=demiobenour@gmail.com \
--cc=edumazet@google.com \
--cc=freude@linux.ibm.com \
--cc=herbert@gondor.apana.org.au \
--cc=horms@kernel.org \
--cc=io-uring@vger.kernel.org \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peterz@infradead.org \
--cc=richard.weinberger@gmail.com \
--cc=skhan@linuxfoundation.org \
--cc=willemb@google.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox