Linux cryptographic layer development
 help / color / mirror / Atom feed
* [PATCH v2 0/2] crypto: pcrypt - Make sure the instance can be found by the requested name
@ 2026-12-04 22:37 Antonio Quartulli
  2026-12-04 22:37 ` [PATCH v2 1/2] " Antonio Quartulli
  2026-12-04 22:37 ` [PATCH v2 2/2] crypto: tcrypt - Wrap the driver name in the pcrypt speed example Antonio Quartulli
  0 siblings, 2 replies; 3+ messages in thread
From: Antonio Quartulli @ 2026-12-04 22:37 UTC (permalink / raw)
  To: Herbert Xu, Steffen Klassert
  Cc: Antonio Quartulli, David S. Miller, Wang Jinchao, linux-crypto

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-04 22:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 22:37 [PATCH v2 0/2] crypto: pcrypt - Make sure the instance can be found by the requested name Antonio Quartulli
2026-12-04 22:37 ` [PATCH v2 1/2] " Antonio Quartulli
2026-12-04 22:37 ` [PATCH v2 2/2] crypto: tcrypt - Wrap the driver name in the pcrypt speed example Antonio Quartulli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox