Skip to content

Commit 6f221f7

Browse files
Kamil Koniecznyherbertx
authored andcommitted
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 <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent f1b2981 commit 6f221f7

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

crypto/ahash.c

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -446,24 +446,12 @@ static int ahash_def_finup(struct ahash_request *req)
446446
return ahash_def_finup_finish1(req, err);
447447
}
448448

449-
static int ahash_no_export(struct ahash_request *req, void *out)
450-
{
451-
return -ENOSYS;
452-
}
453-
454-
static int ahash_no_import(struct ahash_request *req, const void *in)
455-
{
456-
return -ENOSYS;
457-
}
458-
459449
static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
460450
{
461451
struct crypto_ahash *hash = __crypto_ahash_cast(tfm);
462452
struct ahash_alg *alg = crypto_ahash_alg(hash);
463453

464454
hash->setkey = ahash_nosetkey;
465-
hash->export = ahash_no_export;
466-
hash->import = ahash_no_import;
467455

468456
if (tfm->__crt_alg->cra_type != &crypto_ahash_type)
469457
return crypto_init_shash_ops_async(tfm);
@@ -473,16 +461,14 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
473461
hash->final = alg->final;
474462
hash->finup = alg->finup ?: ahash_def_finup;
475463
hash->digest = alg->digest;
464+
hash->export = alg->export;
465+
hash->import = alg->import;
476466

477467
if (alg->setkey) {
478468
hash->setkey = alg->setkey;
479469
if (!(alg->halg.base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY))
480470
crypto_ahash_set_flags(hash, CRYPTO_TFM_NEED_KEY);
481471
}
482-
if (alg->export)
483-
hash->export = alg->export;
484-
if (alg->import)
485-
hash->import = alg->import;
486472

487473
return 0;
488474
}

0 commit comments

Comments
 (0)