Skip to content

Commit 00420a6

Browse files
committed
crypto: shash - Fix has_key setting
The has_key logic is wrong for shash algorithms as they always have a setkey function. So we should instead be testing against shash_no_setkey. Fixes: a5596d6 ("crypto: hash - Add crypto_ahash_has_setkey") Cc: [email protected] Reported-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]> Tested-by: Stephan Mueller <[email protected]>
1 parent 625b4a9 commit 00420a6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

crypto/shash.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,10 @@ int crypto_init_shash_ops_async(struct crypto_tfm *tfm)
354354
crt->final = shash_async_final;
355355
crt->finup = shash_async_finup;
356356
crt->digest = shash_async_digest;
357+
crt->setkey = shash_async_setkey;
358+
359+
crt->has_setkey = alg->setkey != shash_no_setkey;
357360

358-
if (alg->setkey) {
359-
crt->setkey = shash_async_setkey;
360-
crt->has_setkey = true;
361-
}
362361
if (alg->export)
363362
crt->export = shash_async_export;
364363
if (alg->import)

0 commit comments

Comments
 (0)