Skip to content

Commit a3af113

Browse files
gcabidduherbertx
authored andcommitted
crypto: qat - do not offload zero length requests
If a zero length request is submitted through the skcipher api, do not offload it and return success. Reviewed-by: Conor Mcloughlin <conor.mcloughlin@intel.com> Tested-by: Sergey Portnoy <sergey.portnoy@intel.com> Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 96ee111 commit a3af113

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎drivers/crypto/qat/qat_common/qat_algs.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,9 @@ static int qat_alg_ablkcipher_encrypt(struct ablkcipher_request *req)
10581058
struct device *dev = &GET_DEV(ctx->inst->accel_dev);
10591059
int ret, ctr = 0;
10601060

1061+
if (req->nbytes == 0)
1062+
return 0;
1063+
10611064
qat_req->iv = dma_alloc_coherent(dev, AES_BLOCK_SIZE,
10621065
&qat_req->iv_paddr, GFP_ATOMIC);
10631066
if (!qat_req->iv)
@@ -1115,6 +1118,9 @@ static int qat_alg_ablkcipher_decrypt(struct ablkcipher_request *req)
11151118
struct device *dev = &GET_DEV(ctx->inst->accel_dev);
11161119
int ret, ctr = 0;
11171120

1121+
if (req->nbytes == 0)
1122+
return 0;
1123+
11181124
qat_req->iv = dma_alloc_coherent(dev, AES_BLOCK_SIZE,
11191125
&qat_req->iv_paddr, GFP_ATOMIC);
11201126
if (!qat_req->iv)

0 commit comments

Comments
 (0)