crypto: hash - Require export/import in ahash
Export and import are mandatory in async hash. As drivers were rewritten, drop empty wrappers and correct init of ahash transformation. Signed-off-by: Kamil Konieczny <k.konieczny@partner.samsung.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>hifive-unleashed-5.1
parent
f1b298103e
commit
6f221f7e86
|
@ -446,24 +446,12 @@ static int ahash_def_finup(struct ahash_request *req)
|
||||||
return ahash_def_finup_finish1(req, err);
|
return ahash_def_finup_finish1(req, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ahash_no_export(struct ahash_request *req, void *out)
|
|
||||||
{
|
|
||||||
return -ENOSYS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ahash_no_import(struct ahash_request *req, const void *in)
|
|
||||||
{
|
|
||||||
return -ENOSYS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
|
static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
|
||||||
{
|
{
|
||||||
struct crypto_ahash *hash = __crypto_ahash_cast(tfm);
|
struct crypto_ahash *hash = __crypto_ahash_cast(tfm);
|
||||||
struct ahash_alg *alg = crypto_ahash_alg(hash);
|
struct ahash_alg *alg = crypto_ahash_alg(hash);
|
||||||
|
|
||||||
hash->setkey = ahash_nosetkey;
|
hash->setkey = ahash_nosetkey;
|
||||||
hash->export = ahash_no_export;
|
|
||||||
hash->import = ahash_no_import;
|
|
||||||
|
|
||||||
if (tfm->__crt_alg->cra_type != &crypto_ahash_type)
|
if (tfm->__crt_alg->cra_type != &crypto_ahash_type)
|
||||||
return crypto_init_shash_ops_async(tfm);
|
return crypto_init_shash_ops_async(tfm);
|
||||||
|
@ -473,16 +461,14 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
|
||||||
hash->final = alg->final;
|
hash->final = alg->final;
|
||||||
hash->finup = alg->finup ?: ahash_def_finup;
|
hash->finup = alg->finup ?: ahash_def_finup;
|
||||||
hash->digest = alg->digest;
|
hash->digest = alg->digest;
|
||||||
|
hash->export = alg->export;
|
||||||
|
hash->import = alg->import;
|
||||||
|
|
||||||
if (alg->setkey) {
|
if (alg->setkey) {
|
||||||
hash->setkey = alg->setkey;
|
hash->setkey = alg->setkey;
|
||||||
if (!(alg->halg.base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY))
|
if (!(alg->halg.base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY))
|
||||||
crypto_ahash_set_flags(hash, CRYPTO_TFM_NEED_KEY);
|
crypto_ahash_set_flags(hash, CRYPTO_TFM_NEED_KEY);
|
||||||
}
|
}
|
||||||
if (alg->export)
|
|
||||||
hash->export = alg->export;
|
|
||||||
if (alg->import)
|
|
||||||
hash->import = alg->import;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue