From: Horia Geantă Date: Wed, 12 Sep 2018 13:20:48 +0000 (+0300) Subject: crypto: tcrypt - fix ghash-generic speed test X-Git-Tag: v4.18.19~114 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c00600a96550216a4b6a6c77c2c641691d4aa1a6;p=thirdparty%2Fkernel%2Fstable.git crypto: tcrypt - fix ghash-generic speed test commit 331351f89c36bf7d03561a28b6f64fa10a9f6f3a upstream. ghash is a keyed hash algorithm, thus setkey needs to be called. Otherwise the following error occurs: $ modprobe tcrypt mode=318 sec=1 testing speed of async ghash-generic (ghash-generic) tcrypt: test 0 ( 16 byte blocks, 16 bytes per update, 1 updates): tcrypt: hashing failed ret=-126 Cc: # 4.6+ Fixes: 0660511c0bee ("crypto: tcrypt - Use ahash") Tested-by: Franck Lenormand Signed-off-by: Horia Geantă Acked-by: Ard Biesheuvel Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index d5bcdd905007a..ee4f2a175bdad 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c @@ -1097,6 +1097,9 @@ static void test_ahash_speed_common(const char *algo, unsigned int secs, break; } + if (speed[i].klen) + crypto_ahash_setkey(tfm, tvmem[0], speed[i].klen); + pr_info("test%3u " "(%5u byte blocks,%5u bytes per update,%4u updates): ", i, speed[i].blen, speed[i].plen, speed[i].blen / speed[i].plen);