linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: mcryptd - remove pointless wrapper functions
@ 2018-01-25  3:09 Eric Biggers
  2018-01-25 21:17 ` Tim Chen
  2018-02-15 15:42 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Biggers @ 2018-01-25  3:09 UTC (permalink / raw)
  To: linux-crypto, Herbert Xu; +Cc: David S . Miller, Tim Chen, Eric Biggers

From: Eric Biggers <ebiggers@google.com>

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>
---
 crypto/mcryptd.c               | 34 ++++------------------------------
 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)
 		goto out;
 
 	rctx->out = req->result;
-	err = ahash_mcryptd_update(&rctx->areq);
+	err = crypto_ahash_update(&rctx->areq);
 	if (err) {
 		req->base.complete = rctx->complete;
 		goto out;
@@ -394,7 +394,7 @@ static void mcryptd_hash_final(struct crypto_async_request *req_async, int err)
 		goto out;
 
 	rctx->out = req->result;
-	err = ahash_mcryptd_final(&rctx->areq);
+	err = crypto_ahash_final(&rctx->areq);
 	if (err) {
 		req->base.complete = rctx->complete;
 		goto out;
@@ -420,7 +420,7 @@ static void mcryptd_hash_finup(struct crypto_async_request *req_async, int err)
 	if (unlikely(err == -EINPROGRESS))
 		goto out;
 	rctx->out = req->result;
-	err = ahash_mcryptd_finup(&rctx->areq);
+	err = crypto_ahash_finup(&rctx->areq);
 
 	if (err) {
 		req->base.complete = rctx->complete;
@@ -455,7 +455,7 @@ static void mcryptd_hash_digest(struct crypto_async_request *req_async, int err)
 						rctx->complete, req_async);
 
 	rctx->out = req->result;
-	err = ahash_mcryptd_digest(desc);
+	err = crypto_ahash_init(desc) ?: crypto_ahash_finup(desc);
 
 out:
 	local_bh_disable();
@@ -612,32 +612,6 @@ struct mcryptd_ahash *mcryptd_alloc_ahash(const char *alg_name,
 }
 EXPORT_SYMBOL_GPL(mcryptd_alloc_ahash);
 
-int ahash_mcryptd_digest(struct ahash_request *desc)
-{
-	return crypto_ahash_init(desc) ?: ahash_mcryptd_finup(desc);
-}
-
-int ahash_mcryptd_update(struct ahash_request *desc)
-{
-	/* alignment is to be done by multi-buffer crypto algorithm if needed */
-
-	return crypto_ahash_update(desc);
-}
-
-int ahash_mcryptd_finup(struct ahash_request *desc)
-{
-	/* alignment is to be done by multi-buffer crypto algorithm if needed */
-
-	return crypto_ahash_finup(desc);
-}
-
-int ahash_mcryptd_final(struct ahash_request *desc)
-{
-	/* alignment is to be done by multi-buffer crypto algorithm if needed */
-
-	return crypto_ahash_final(desc);
-}
-
 struct crypto_ahash *mcryptd_ahash_child(struct mcryptd_ahash *tfm)
 {
 	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);
 int shash_ahash_finup(struct ahash_request *req, struct shash_desc *desc);
 int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc);
 
-int ahash_mcryptd_update(struct ahash_request *desc);
-int ahash_mcryptd_final(struct ahash_request *desc);
-int ahash_mcryptd_finup(struct ahash_request *desc);
-int ahash_mcryptd_digest(struct ahash_request *desc);
-
 int crypto_init_shash_ops_async(struct crypto_tfm *tfm);
 
 static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm)
-- 
2.16.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] crypto: mcryptd - remove pointless wrapper functions
  2018-01-25  3:09 [PATCH] crypto: mcryptd - remove pointless wrapper functions Eric Biggers
@ 2018-01-25 21:17 ` Tim Chen
  2018-02-15 15:42 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Tim Chen @ 2018-01-25 21:17 UTC (permalink / raw)
  To: Eric Biggers, linux-crypto, Herbert Xu
  Cc: David S . Miller, Eric Biggers, Megha Dey

On 01/24/2018 07:09 PM, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> There is no need for ahash_mcryptd_{update,final,finup,digest}(); we
> should just call crypto_ahash_*() directly.
> 

This clean up could have been done when we made sha1-mb async.  Looks
reasonable.

Acked-by: Tim Chen <tim.c.chen@linux.intel.com>

> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
>  crypto/mcryptd.c               | 34 ++++------------------------------
>  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)
>  		goto out;
>  
>  	rctx->out = req->result;
> -	err = ahash_mcryptd_update(&rctx->areq);
> +	err = crypto_ahash_update(&rctx->areq);
>  	if (err) {
>  		req->base.complete = rctx->complete;
>  		goto out;
> @@ -394,7 +394,7 @@ static void mcryptd_hash_final(struct crypto_async_request *req_async, int err)
>  		goto out;
>  
>  	rctx->out = req->result;
> -	err = ahash_mcryptd_final(&rctx->areq);
> +	err = crypto_ahash_final(&rctx->areq);
>  	if (err) {
>  		req->base.complete = rctx->complete;
>  		goto out;
> @@ -420,7 +420,7 @@ static void mcryptd_hash_finup(struct crypto_async_request *req_async, int err)
>  	if (unlikely(err == -EINPROGRESS))
>  		goto out;
>  	rctx->out = req->result;
> -	err = ahash_mcryptd_finup(&rctx->areq);
> +	err = crypto_ahash_finup(&rctx->areq);
>  
>  	if (err) {
>  		req->base.complete = rctx->complete;
> @@ -455,7 +455,7 @@ static void mcryptd_hash_digest(struct crypto_async_request *req_async, int err)
>  						rctx->complete, req_async);
>  
>  	rctx->out = req->result;
> -	err = ahash_mcryptd_digest(desc);
> +	err = crypto_ahash_init(desc) ?: crypto_ahash_finup(desc);
>  
>  out:
>  	local_bh_disable();
> @@ -612,32 +612,6 @@ struct mcryptd_ahash *mcryptd_alloc_ahash(const char *alg_name,
>  }
>  EXPORT_SYMBOL_GPL(mcryptd_alloc_ahash);
>  
> -int ahash_mcryptd_digest(struct ahash_request *desc)
> -{
> -	return crypto_ahash_init(desc) ?: ahash_mcryptd_finup(desc);
> -}
> -
> -int ahash_mcryptd_update(struct ahash_request *desc)
> -{
> -	/* alignment is to be done by multi-buffer crypto algorithm if needed */
> -
> -	return crypto_ahash_update(desc);
> -}
> -
> -int ahash_mcryptd_finup(struct ahash_request *desc)
> -{
> -	/* alignment is to be done by multi-buffer crypto algorithm if needed */
> -
> -	return crypto_ahash_finup(desc);
> -}
> -
> -int ahash_mcryptd_final(struct ahash_request *desc)
> -{
> -	/* alignment is to be done by multi-buffer crypto algorithm if needed */
> -
> -	return crypto_ahash_final(desc);
> -}
> -
>  struct crypto_ahash *mcryptd_ahash_child(struct mcryptd_ahash *tfm)
>  {
>  	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);
>  int shash_ahash_finup(struct ahash_request *req, struct shash_desc *desc);
>  int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc);
>  
> -int ahash_mcryptd_update(struct ahash_request *desc);
> -int ahash_mcryptd_final(struct ahash_request *desc);
> -int ahash_mcryptd_finup(struct ahash_request *desc);
> -int ahash_mcryptd_digest(struct ahash_request *desc);
> -
>  int crypto_init_shash_ops_async(struct crypto_tfm *tfm);
>  
>  static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm)
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] crypto: mcryptd - remove pointless wrapper functions
  2018-01-25  3:09 [PATCH] crypto: mcryptd - remove pointless wrapper functions Eric Biggers
  2018-01-25 21:17 ` Tim Chen
@ 2018-02-15 15:42 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2018-02-15 15:42 UTC (permalink / raw)
  To: Eric Biggers; +Cc: linux-crypto, David S . Miller, Tim Chen, Eric Biggers

On Wed, Jan 24, 2018 at 07:09:07PM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> 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>

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-15 15:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-25  3:09 [PATCH] crypto: mcryptd - remove pointless wrapper functions Eric Biggers
2018-01-25 21:17 ` Tim Chen
2018-02-15 15:42 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).