aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
authorSaeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>2026-03-02 16:06:40 -0800
committerHerbert Xu <herbert@gondor.apana.org.au>2026-03-14 14:03:19 +0900
commit03170b8f84354f1649a757e57c2130e1de237f5d (patch)
treea75b7cd4ace135016f24e99722b18309dd8132d2 /crypto
parent32e76e3757e89f370bf2ac8dba8aeb133071834e (diff)
downloadlinux-next-history-03170b8f84354f1649a757e57c2130e1de237f5d.tar.gz
crypto: tcrypt - stop ahash speed tests when setkey fails
The async hash speed path ignores the return code from crypto_ahash_setkey(). If the caller picks an unsupported key length, the transform keeps whatever key state it already has and the speed test still runs, producing misleading numbers, hence bail out of the loop when setkey fails. Signed-off-by: Saeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/tcrypt.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 61c8cf55c4f1e..db860f45765fb 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -911,8 +911,14 @@ static void test_ahash_speed_common(const char *algo, unsigned int secs,
break;
}
- if (klen)
- crypto_ahash_setkey(tfm, tvmem[0], klen);
+ if (klen) {
+ ret = crypto_ahash_setkey(tfm, tvmem[0], klen);
+ if (ret) {
+ pr_err("setkey() failed flags=%x: %d\n",
+ crypto_ahash_get_flags(tfm), ret);
+ break;
+ }
+ }
pr_info("test%3u "
"(%5u byte blocks,%5u bytes per update,%4u updates): ",