All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: cavium - remove bogus code handling cryptd
@ 2019-04-13  4:25 Eric Biggers
  2019-04-18 14:27 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Biggers @ 2019-04-13  4:25 UTC (permalink / raw)
  To: linux-crypto, Herbert Xu
  Cc: George Cherian, Nagadheeraj Rottela, Srikanth Jampala

From: Eric Biggers <ebiggers@google.com>

The cavium crypto driver adds 'sizeof(struct ablkcipher_request)' to its
request size because "the cryptd daemon uses this memory for request_ctx
information".  This is incorrect and unnecessary; cryptd doesn't require
wrapped algorithms to reserve extra request space.  So remove this.

Also remove the unneeded memset() of the tfm context to 0.
It's already zeroed on allocation.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 drivers/crypto/cavium/cpt/cptvf_algs.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/crypto/cavium/cpt/cptvf_algs.c b/drivers/crypto/cavium/cpt/cptvf_algs.c
index 600336d169a9e..8d53611e9d5db 100644
--- a/drivers/crypto/cavium/cpt/cptvf_algs.c
+++ b/drivers/crypto/cavium/cpt/cptvf_algs.c
@@ -10,7 +10,6 @@
 #include <crypto/aes.h>
 #include <crypto/algapi.h>
 #include <crypto/authenc.h>
-#include <crypto/cryptd.h>
 #include <crypto/crypto_wq.h>
 #include <crypto/des.h>
 #include <crypto/xts.h>
@@ -338,16 +337,7 @@ static int cvm_ecb_des3_setkey(struct crypto_ablkcipher *cipher, const u8 *key,
 
 static int cvm_enc_dec_init(struct crypto_tfm *tfm)
 {
-	struct cvm_enc_ctx *ctx = crypto_tfm_ctx(tfm);
-
-	memset(ctx, 0, sizeof(*ctx));
-	tfm->crt_ablkcipher.reqsize = sizeof(struct cvm_req_ctx) +
-					sizeof(struct ablkcipher_request);
-	/* Additional memory for ablkcipher_request is
-	 * allocated since the cryptd daemon uses
-	 * this memory for request_ctx information
-	 */
-
+	tfm->crt_ablkcipher.reqsize = sizeof(struct cvm_req_ctx);
 	return 0;
 }
 
-- 
2.21.0


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

* Re: [PATCH] crypto: cavium - remove bogus code handling cryptd
  2019-04-13  4:25 [PATCH] crypto: cavium - remove bogus code handling cryptd Eric Biggers
@ 2019-04-18 14:27 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2019-04-18 14:27 UTC (permalink / raw)
  To: Eric Biggers
  Cc: linux-crypto, George Cherian, Nagadheeraj Rottela, Srikanth Jampala

On Fri, Apr 12, 2019 at 09:25:31PM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> The cavium crypto driver adds 'sizeof(struct ablkcipher_request)' to its
> request size because "the cryptd daemon uses this memory for request_ctx
> information".  This is incorrect and unnecessary; cryptd doesn't require
> wrapped algorithms to reserve extra request space.  So remove this.
> 
> Also remove the unneeded memset() of the tfm context to 0.
> It's already zeroed on allocation.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
>  drivers/crypto/cavium/cpt/cptvf_algs.c | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)

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] 2+ messages in thread

end of thread, other threads:[~2019-04-18 14:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-13  4:25 [PATCH] crypto: cavium - remove bogus code handling cryptd Eric Biggers
2019-04-18 14:27 ` Herbert Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.