diff options
author | Eric Biggers <ebiggers@google.com> | 2018-01-24 22:09:07 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2018-02-15 10:26:45 -0500 |
commit | edbd1ecbd8b8fde1b69cc0d20f7d50532e225a0f (patch) | |
tree | dc06d5f0f02c4de449f495b2f5f3249a5ff40179 | |
parent | 40b776ae9fee71aa0761d7ceb876731780f92d87 (diff) |
crypto: mcryptd - remove pointless wrapper functions
There is no need for ahash_mcryptd_{update,final,finup,digest}(); we
should just call crypto_ahash_*() directly.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Acked-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | crypto/mcryptd.c | 34 | ||||
-rw-r--r-- | include/crypto/internal/hash.h | 5 |
2 files changed, 4 insertions, 35 deletions
diff --git a/crypto/mcryptd.c b/crypto/mcryptd.c index fe5129d6ff4e..f14152147ce8 100644 --- a/crypto/mcryptd.c +++ b/crypto/mcryptd.c | |||
@@ -367,7 +367,7 @@ static void mcryptd_hash_update(struct crypto_async_request *req_async, int err) | |||
367 | goto out; | 367 | goto out; |
368 | 368 | ||
369 | rctx->out = req->result; | 369 | rctx->out = req->result; |
370 | err = ahash_mcryptd_update(&rctx->areq); | 370 | err = crypto_ahash_update(&rctx->areq); |
371 | if (err) { | 371 | if (err) { |
372 | req->base.complete = rctx->complete; | 372 | req->base.complete = rctx->complete; |
373 | goto out; | 373 | goto out; |
@@ -394,7 +394,7 @@ static void mcryptd_hash_final(struct crypto_async_request *req_async, int err) | |||
394 | goto out; | 394 | goto out; |
395 | 395 | ||
396 | rctx->out = req->result; | 396 | rctx->out = req->result; |
397 | err = ahash_mcryptd_final(&rctx->areq); | 397 | err = crypto_ahash_final(&rctx->areq); |
398 | if (err) { | 398 | if (err) { |
399 | req->base.complete = rctx->complete; | 399 | req->base.complete = rctx->complete; |
400 | goto out; | 400 | goto out; |
@@ -420,7 +420,7 @@ static void mcryptd_hash_finup(struct crypto_async_request *req_async, int err) | |||
420 | if (unlikely(err == -EINPROGRESS)) | 420 | if (unlikely(err == -EINPROGRESS)) |
421 | goto out; | 421 | goto out; |
422 | rctx->out = req->result; | 422 | rctx->out = req->result; |
423 | err = ahash_mcryptd_finup(&rctx->areq); | 423 | err = crypto_ahash_finup(&rctx->areq); |
424 | 424 | ||
425 | if (err) { | 425 | if (err) { |
426 | req->base.complete = rctx->complete; | 426 | req->base.complete = rctx->complete; |
@@ -455,7 +455,7 @@ static void mcryptd_hash_digest(struct crypto_async_request *req_async, int err) | |||
455 | rctx->complete, req_async); | 455 | rctx->complete, req_async); |
456 | 456 | ||
457 | rctx->out = req->result; | 457 | rctx->out = req->result; |
458 | err = ahash_mcryptd_digest(desc); | 458 | err = crypto_ahash_init(desc) ?: crypto_ahash_finup(desc); |
459 | 459 | ||
460 | out: | 460 | out: |
461 | local_bh_disable(); | 461 | local_bh_disable(); |
@@ -612,32 +612,6 @@ struct mcryptd_ahash *mcryptd_alloc_ahash(const char *alg_name, | |||
612 | } | 612 | } |
613 | EXPORT_SYMBOL_GPL(mcryptd_alloc_ahash); | 613 | EXPORT_SYMBOL_GPL(mcryptd_alloc_ahash); |
614 | 614 | ||
615 | int ahash_mcryptd_digest(struct ahash_request *desc) | ||
616 | { | ||
617 | return crypto_ahash_init(desc) ?: ahash_mcryptd_finup(desc); | ||
618 | } | ||
619 | |||
620 | int ahash_mcryptd_update(struct ahash_request *desc) | ||
621 | { | ||
622 | /* alignment is to be done by multi-buffer crypto algorithm if needed */ | ||
623 | |||
624 | return crypto_ahash_update(desc); | ||
625 | } | ||
626 | |||
627 | int ahash_mcryptd_finup(struct ahash_request *desc) | ||
628 | { | ||
629 | /* alignment is to be done by multi-buffer crypto algorithm if needed */ | ||
630 | |||
631 | return crypto_ahash_finup(desc); | ||
632 | } | ||
633 | |||
634 | int ahash_mcryptd_final(struct ahash_request *desc) | ||
635 | { | ||
636 | /* alignment is to be done by multi-buffer crypto algorithm if needed */ | ||
637 | |||
638 | return crypto_ahash_final(desc); | ||
639 | } | ||
640 | |||
641 | struct crypto_ahash *mcryptd_ahash_child(struct mcryptd_ahash *tfm) | 615 | struct crypto_ahash *mcryptd_ahash_child(struct mcryptd_ahash *tfm) |
642 | { | 616 | { |
643 | struct mcryptd_hash_ctx *ctx = crypto_ahash_ctx(&tfm->base); | 617 | struct mcryptd_hash_ctx *ctx = crypto_ahash_ctx(&tfm->base); |
diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h index 27040a46d50a..a0b0ad9d585e 100644 --- a/include/crypto/internal/hash.h +++ b/include/crypto/internal/hash.h | |||
@@ -126,11 +126,6 @@ int shash_ahash_update(struct ahash_request *req, struct shash_desc *desc); | |||
126 | int shash_ahash_finup(struct ahash_request *req, struct shash_desc *desc); | 126 | int shash_ahash_finup(struct ahash_request *req, struct shash_desc *desc); |
127 | int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc); | 127 | int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc); |
128 | 128 | ||
129 | int ahash_mcryptd_update(struct ahash_request *desc); | ||
130 | int ahash_mcryptd_final(struct ahash_request *desc); | ||
131 | int ahash_mcryptd_finup(struct ahash_request *desc); | ||
132 | int ahash_mcryptd_digest(struct ahash_request *desc); | ||
133 | |||
134 | int crypto_init_shash_ops_async(struct crypto_tfm *tfm); | 129 | int crypto_init_shash_ops_async(struct crypto_tfm *tfm); |
135 | 130 | ||
136 | static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm) | 131 | static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm) |