Skip to content

Commit 85b8432

Browse files
ebiggersherbertx
authored andcommitted
crypto: ahash - check for shash type instead of not ahash type
Since the previous patch made crypto_shash_type visible to ahash.c, change checks for '->cra_type != &crypto_ahash_type' to '->cra_type == &crypto_shash_type'. This makes more sense and avoids having to forward-declare crypto_ahash_type. The result is still the same, since the type is either shash or ahash here. Signed-off-by: Eric Biggers <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent ecf889b commit 85b8432

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

crypto/ahash.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727

2828
#define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000e
2929

30-
static const struct crypto_type crypto_ahash_type;
31-
3230
static int shash_async_setkey(struct crypto_ahash *tfm, const u8 *key,
3331
unsigned int keylen)
3432
{
@@ -511,7 +509,7 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
511509

512510
crypto_ahash_set_statesize(hash, alg->halg.statesize);
513511

514-
if (tfm->__crt_alg->cra_type != &crypto_ahash_type)
512+
if (tfm->__crt_alg->cra_type == &crypto_shash_type)
515513
return crypto_init_shash_ops_async(tfm);
516514

517515
hash->init = alg->init;
@@ -535,7 +533,7 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
535533

536534
static unsigned int crypto_ahash_extsize(struct crypto_alg *alg)
537535
{
538-
if (alg->cra_type != &crypto_ahash_type)
536+
if (alg->cra_type == &crypto_shash_type)
539537
return sizeof(struct crypto_shash *);
540538

541539
return crypto_alg_extsize(alg);
@@ -760,7 +758,7 @@ bool crypto_hash_alg_has_setkey(struct hash_alg_common *halg)
760758
{
761759
struct crypto_alg *alg = &halg->base;
762760

763-
if (alg->cra_type != &crypto_ahash_type)
761+
if (alg->cra_type == &crypto_shash_type)
764762
return crypto_shash_alg_has_setkey(__crypto_shash_alg(alg));
765763

766764
return __crypto_ahash_alg(alg)->setkey != NULL;

0 commit comments

Comments
 (0)