From: Antonio Quartulli <antonio@mandelbit.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
Steffen Klassert <steffen.klassert@secunet.com>
Cc: Antonio Quartulli <antonio@mandelbit.com>,
"David S. Miller" <davem@davemloft.net>,
Wang Jinchao <wangjinchao@xfusion.com>,
linux-crypto@vger.kernel.org
Subject: [PATCH v2 0/2] crypto: pcrypt - Make sure the instance can be found by the requested name
Date: Fri, 4 Dec 2026 23:37:31 +0100 [thread overview]
Message-ID: <20261204223734.4111964-1-antonio@mandelbit.com> (raw)
v1 refused to wrap a pcrypt instance. As Herbert suggested, patch 1
instead refuses to create an instance that cannot be found under the
requested name. pcrypt keeps the inner cra_name, so this means the inner
algorithm must be named by its driver name.
This can break existing setups, so please decide whether that is
acceptable. Requesting pcrypt with a generic inner name, e.g.
pcrypt(rfc4106(gcm(aes))), has always returned an error (-EAGAIN, or
-ENAMETOOLONG once nesting overflows the name), but as a side effect it
registered a pcrypt instance, which later allocations by the generic name
pick up by priority. Setups may rely on that despite the error. With
patch 1 such requests fail with -EINVAL and register nothing, so those
setups silently stop using pcrypt.
The only in-tree example is the setup in tcrypt_speed_compare.py. Under
virtme-ng on v7.4-rc4, its mode 211 run benchmarks
pcrypt(rfc4106-gcm-aes-lib) before patch 1 and rfc4106-gcm-aes-lib after.
Patch 2 makes it wrap the driver name.
If generic names should keep working, an alternative is to name the
instance after the request (driver name pcrypt(rfc4106(gcm(aes)))) so the
lookup finds it, at the cost of the driver name no longer identifying the
inner implementation.
Tested on v7.4-rc4 with virtme-ng: generic-name requests through
crypto_user NEWALG and AF_ALG fail with -EINVAL and register nothing
(before: one more nesting level per NEWALG); driver-name requests work
as before and pass the selftests; a generic-name request with a pcrypt
instance present no longer nests.
v1: https://lore.kernel.org/linux-crypto/20261124132443.3666372-1-antonio@mandelbit.com/
Antonio Quartulli (2):
crypto: pcrypt - Make sure the instance can be found by the requested
name
crypto: tcrypt - Wrap the driver name in the pcrypt speed example
crypto/pcrypt.c | 17 ++++++++++++++---
tools/crypto/tcrypt/tcrypt_speed_compare.py | 13 +++++++++++--
2 files changed, 25 insertions(+), 5 deletions(-)
--
2.56.1
next reply other threads:[~2026-12-04 22:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 22:37 Antonio Quartulli [this message]
2026-12-04 22:37 ` [PATCH v2 1/2] crypto: pcrypt - Make sure the instance can be found by the requested name Antonio Quartulli
2026-12-04 22:37 ` [PATCH v2 2/2] crypto: tcrypt - Wrap the driver name in the pcrypt speed example Antonio Quartulli
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=20261204223734.4111964-1-antonio@mandelbit.com \
--to=antonio@mandelbit.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=steffen.klassert@secunet.com \
--cc=wangjinchao@xfusion.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