summaryrefslogtreecommitdiffstats
path: root/crypto/ahash.c
diff options
context:
space:
mode:
authorKamil Konieczny <k.konieczny@partner.samsung.com>2018-01-18 13:34:04 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2018-02-15 10:24:59 -0500
commit6f221f7e864bcee69b69a49ae0c43465e8633297 (patch)
tree40e735e33391033bfd833bbdbfdf7e6be804a86c /crypto/ahash.c
parentf1b298103e141e70616a6f69bec922c669a2732f (diff)
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>
Diffstat (limited to 'crypto/ahash.c')
-rw-r--r--crypto/ahash.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/crypto/ahash.c b/crypto/ahash.c
index 266fc1d64f61..f732dd9dedf9 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -446,24 +446,12 @@ static int ahash_def_finup(struct ahash_request *req)
446 return ahash_def_finup_finish1(req, err); 446 return ahash_def_finup_finish1(req, err);
447} 447}
448 448
449static int ahash_no_export(struct ahash_request *req, void *out)
450{
451 return -ENOSYS;
452}
453
454static int ahash_no_import(struct ahash_request *req, const void *in)
455{
456 return -ENOSYS;
457}
458
459static int crypto_ahash_init_tfm(struct crypto_tfm *tfm) 449static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
460{ 450{
461 struct crypto_ahash *hash = __crypto_ahash_cast(tfm); 451 struct crypto_ahash *hash = __crypto_ahash_cast(tfm);
462 struct ahash_alg *alg = crypto_ahash_alg(hash); 452 struct ahash_alg *alg = crypto_ahash_alg(hash);
463 453
464 hash->setkey = ahash_nosetkey; 454 hash->setkey = ahash_nosetkey;
465 hash->export = ahash_no_export;
466 hash->import = ahash_no_import;
467 455
468 if (tfm->__crt_alg->cra_type != &crypto_ahash_type) 456 if (tfm->__crt_alg->cra_type != &crypto_ahash_type)
469 return crypto_init_shash_ops_async(tfm); 457 return crypto_init_shash_ops_async(tfm);
@@ -473,16 +461,14 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
473 hash->final = alg->final; 461 hash->final = alg->final;
474 hash->finup = alg->finup ?: ahash_def_finup; 462 hash->finup = alg->finup ?: ahash_def_finup;
475 hash->digest = alg->digest; 463 hash->digest = alg->digest;
464 hash->export = alg->export;
465 hash->import = alg->import;
476 466
477 if (alg->setkey) { 467 if (alg->setkey) {
478 hash->setkey = alg->setkey; 468 hash->setkey = alg->setkey;
479 if (!(alg->halg.base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY)) 469 if (!(alg->halg.base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY))
480 crypto_ahash_set_flags(hash, CRYPTO_TFM_NEED_KEY); 470 crypto_ahash_set_flags(hash, CRYPTO_TFM_NEED_KEY);
481 } 471 }
482 if (alg->export)
483 hash->export = alg->export;
484 if (alg->import)
485 hash->import = alg->import;
486 472
487 return 0; 473 return 0;
488} 474}