mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-04-13 09:59:31 +00:00
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 <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
ecf889b70b
commit
85b84327b3
1 changed files with 3 additions and 5 deletions
|
@ -27,8 +27,6 @@
|
||||||
|
|
||||||
#define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000e
|
#define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000e
|
||||||
|
|
||||||
static const struct crypto_type crypto_ahash_type;
|
|
||||||
|
|
||||||
static int shash_async_setkey(struct crypto_ahash *tfm, const u8 *key,
|
static int shash_async_setkey(struct crypto_ahash *tfm, const u8 *key,
|
||||||
unsigned int keylen)
|
unsigned int keylen)
|
||||||
{
|
{
|
||||||
|
@ -511,7 +509,7 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
|
||||||
|
|
||||||
crypto_ahash_set_statesize(hash, alg->halg.statesize);
|
crypto_ahash_set_statesize(hash, alg->halg.statesize);
|
||||||
|
|
||||||
if (tfm->__crt_alg->cra_type != &crypto_ahash_type)
|
if (tfm->__crt_alg->cra_type == &crypto_shash_type)
|
||||||
return crypto_init_shash_ops_async(tfm);
|
return crypto_init_shash_ops_async(tfm);
|
||||||
|
|
||||||
hash->init = alg->init;
|
hash->init = alg->init;
|
||||||
|
@ -535,7 +533,7 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
|
||||||
|
|
||||||
static unsigned int crypto_ahash_extsize(struct crypto_alg *alg)
|
static unsigned int crypto_ahash_extsize(struct crypto_alg *alg)
|
||||||
{
|
{
|
||||||
if (alg->cra_type != &crypto_ahash_type)
|
if (alg->cra_type == &crypto_shash_type)
|
||||||
return sizeof(struct crypto_shash *);
|
return sizeof(struct crypto_shash *);
|
||||||
|
|
||||||
return crypto_alg_extsize(alg);
|
return crypto_alg_extsize(alg);
|
||||||
|
@ -760,7 +758,7 @@ bool crypto_hash_alg_has_setkey(struct hash_alg_common *halg)
|
||||||
{
|
{
|
||||||
struct crypto_alg *alg = &halg->base;
|
struct crypto_alg *alg = &halg->base;
|
||||||
|
|
||||||
if (alg->cra_type != &crypto_ahash_type)
|
if (alg->cra_type == &crypto_shash_type)
|
||||||
return crypto_shash_alg_has_setkey(__crypto_shash_alg(alg));
|
return crypto_shash_alg_has_setkey(__crypto_shash_alg(alg));
|
||||||
|
|
||||||
return __crypto_ahash_alg(alg)->setkey != NULL;
|
return __crypto_ahash_alg(alg)->setkey != NULL;
|
||||||
|
|
Loading…
Add table
Reference in a new issue