Linux cryptographic layer development
 help / color / mirror / Atom feed
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 2/2] crypto: tcrypt - Wrap the driver name in the pcrypt speed example
Date: Fri,  4 Dec 2026 23:37:33 +0100	[thread overview]
Message-ID: <20261204223734.4111964-3-antonio@mandelbit.com> (raw)
In-Reply-To: <20261204223734.4111964-1-antonio@mandelbit.com>

pcrypt now refuses a generic inner algorithm name, so the example setup
in tcrypt_speed_compare.py no longer creates a pcrypt instance and the
benchmark silently measures rfc4106(gcm(aes)) without pcrypt.

Look up the driver name of rfc4106(gcm(aes)) and wrap that instead.

Cc: Wang Jinchao <wangjinchao@xfusion.com>
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
---
 tools/crypto/tcrypt/tcrypt_speed_compare.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/tools/crypto/tcrypt/tcrypt_speed_compare.py b/tools/crypto/tcrypt/tcrypt_speed_compare.py
index f3f5783cdc06..2accb80bab01 100755
--- a/tools/crypto/tcrypt/tcrypt_speed_compare.py
+++ b/tools/crypto/tcrypt/tcrypt_speed_compare.py
@@ -27,17 +27,26 @@ sec=0
 num_mb=8
 mode=211
 
+# pcrypt must be given the driver name of the algorithm it wraps
+setup_pcrypt() {
+	modprobe tcrypt alg="rfc4106(gcm(aes))" type=3
+	drv=$(awk -F': ' '/^name/ { n = $2 } /^driver/ { d = $2 }
+		/^priority/ && n == "rfc4106(gcm(aes))" && d !~ /^pcrypt/ &&
+		$2 + 0 > p { p = $2 + 0; best = d } END { print best }' /proc/crypto)
+	modprobe tcrypt alg="pcrypt($drv)" type=3
+}
+
 # base speed test
 lsmod | grep pcrypt && modprobe -r pcrypt
 dmesg -C
-modprobe tcrypt alg="pcrypt(rfc4106(gcm(aes)))" type=3
+setup_pcrypt
 modprobe tcrypt mode=${mode} sec=${sec} num_mb=${num_mb}
 dmesg > ${seq_num}_base_dmesg.log
 
 # new speed test
 lsmod | grep pcrypt && modprobe -r pcrypt
 dmesg -C
-modprobe tcrypt alg="pcrypt(rfc4106(gcm(aes)))" type=3
+setup_pcrypt
 modprobe tcrypt mode=${mode} sec=${sec} num_mb=${num_mb}
 dmesg > ${seq_num}_new_dmesg.log
 lsmod | grep pcrypt && modprobe -r pcrypt
-- 
2.56.1


      parent 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 [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 ` Antonio Quartulli [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=20261204223734.4111964-3-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