Skip to contentSkip to conversation

crypto: cavium - remove bogus code handling cryptd

PATCH In review Eric Biggers 2 participants 2 messages Apr 13, 2019 – Apr 18, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: cavium - remove bogus code handling cryptd

From: Eric Biggers <[email protected]>

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.

---
 drivers/crypto/cavium/cpt/cptvf_algs.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/crypto/cavium/cpt/cptvf_algs.c +1 -11
index 600336d169a9e..8d53611e9d5db 100644
@@ -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;
 }
 
Signature · 1 line
2.21.0
maintainer
#1 lore raw
Quoted 7 lines · Eric Biggers

From: Eric Biggers <[email protected]>

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.

Quoted 7 lines

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

---
 drivers/crypto/cavium/cpt/cptvf_algs.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt