From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.50 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796423868; b=tEvmZLVPeUDv8bNMduJl6OuEje0hIEBBUIsInbNa5UiPKmAxmjuDX/RBMV2tiQEXA6EZ T6+MjFzhcIc0UQi7M3Ra3i/F/kFxc/gFormEKPFoxXHEcWRV5KOmgeNp2PqaV58lvXuxg KjnBHjGWW3gPzjOgqVmRruOzMjiqxUsN0fgYJlUnDvuD+E8L+joXjZapSANjsXdIPj3kL KD7VqWTxLRoGdbP7Oy/Olqbh+X00QPR/PU4fo2XH9+w+iu+tYJkrGeRnZ1XO5G6F0qyiY TLnyMchgFaDYOFopHEPvVy6LUVAmLMTb2TvYTLDgmD3V7nsfdVWjdJU2H+TzdvKnw8g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796423868; h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date: Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding: X-Rspamd-Queue-Id; bh=pJ8elDVe7v/L38NtjP0nxiGF+S8LRw9U9k7dYMiQKk8=; b=ociOcHe7TJ0F6nnKcpmk9c0w+fRi7FSWMvqA4lFo5TDnnTymPICWnxje6gvvr+T12f4m eakxrMrf5e7jify4a7NBRFe8RRP5sMNW9P6bi3hW4W95l4LwTWYEVnFSyPcfE/LP5H6K1 TgNsAxlC+BIFUnD74zHPxDS4C3vsa737imBBKX9GRAK3paBD2zOWyyx6HIyrNJFMQppgu czoqhn18aOVoqTztQ/nsfuHZ7vtrz9JucXrL6FzQ65lf//xVLIhILdc4NfkXGOtFxUcOF aZqjVGpQHScqNz4P5QGE0WbJrSHpJGapE38M4SJIV3uBZKRLzve4naJ90TfdLeMMMbQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=mandelbit.com; spf=pass smtp.mailfrom=mandelbit.com; dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b="bZl/A74K"; arc=none smtp.remote-ip=195.10.208.50 Received: from mout-b-105.mailbox.org (mout-b-105.mailbox.org [195.10.208.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C0862606A32C for ; Fri, 4 Dec 2026 22:37:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C0862606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mandelbit.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mandelbit.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=bZl/A74K Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-b-105.mailbox.org (Postfix) with ESMTPS id 4jh5wd2l9Zz9tT7; Fri, 04 Dec 2026 23:37:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1796423857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=pJ8elDVe7v/L38NtjP0nxiGF+S8LRw9U9k7dYMiQKk8=; b=bZl/A74K47KC1eURhyqLELTP+B3Ip6JAwuq6Dqz3e327ebX3dhaomh6G3r/iA5WZRLKtOz ZAJWRwRXKvpHeUV65sT3H/lXPDdvgzq6/wDjUqhJVhy17vbe0H6pTQDHBEUlqnmNS8WTnz mELPdNYjWytGpf3S5ELt92x45maZA0964nPEVO8YpBr58/9smQdDDtDLxzeUwjA8NoFvk7 jKBLCN/IMdjJkxJusUJ/JJ8v2KduiEhOjh2LMr4WXn2XMXiZpBhfK60mmVJe24khrf9UlA V6qqzfH9XNNMnZx65rApFbyEb0gtwnDAt8i1bhF5kS2sq+F6txUogRg5GMbr3A== Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of antonio@mandelbit.com designates 2001:67c:2050:b231:465::2 as permitted sender) smtp.mailfrom=antonio@mandelbit.com From: Antonio Quartulli To: Herbert Xu , Steffen Klassert Cc: Antonio Quartulli , "David S. Miller" , Wang Jinchao , 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 Message-ID: <20261204223734.4111964-1-antonio@mandelbit.com> X-Mailer: git-send-email 2.56.1 X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4jh5wd2l9Zz9tT7 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