Commit a3af1139 authored by Giovanni Cabiddu's avatar Giovanni Cabiddu Committed by Herbert Xu

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: default avatarConor Mcloughlin <conor.mcloughlin@intel.com>
Tested-by: default avatarSergey Portnoy <sergey.portnoy@intel.com>
Signed-off-by: default avatarGiovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 96ee111a
...@@ -1058,6 +1058,9 @@ static int qat_alg_ablkcipher_encrypt(struct ablkcipher_request *req) ...@@ -1058,6 +1058,9 @@ static int qat_alg_ablkcipher_encrypt(struct ablkcipher_request *req)
struct device *dev = &GET_DEV(ctx->inst->accel_dev); struct device *dev = &GET_DEV(ctx->inst->accel_dev);
int ret, ctr = 0; int ret, ctr = 0;
if (req->nbytes == 0)
return 0;
qat_req->iv = dma_alloc_coherent(dev, AES_BLOCK_SIZE, qat_req->iv = dma_alloc_coherent(dev, AES_BLOCK_SIZE,
&qat_req->iv_paddr, GFP_ATOMIC); &qat_req->iv_paddr, GFP_ATOMIC);
if (!qat_req->iv) if (!qat_req->iv)
...@@ -1115,6 +1118,9 @@ static int qat_alg_ablkcipher_decrypt(struct ablkcipher_request *req) ...@@ -1115,6 +1118,9 @@ static int qat_alg_ablkcipher_decrypt(struct ablkcipher_request *req)
struct device *dev = &GET_DEV(ctx->inst->accel_dev); struct device *dev = &GET_DEV(ctx->inst->accel_dev);
int ret, ctr = 0; int ret, ctr = 0;
if (req->nbytes == 0)
return 0;
qat_req->iv = dma_alloc_coherent(dev, AES_BLOCK_SIZE, qat_req->iv = dma_alloc_coherent(dev, AES_BLOCK_SIZE,
&qat_req->iv_paddr, GFP_ATOMIC); &qat_req->iv_paddr, GFP_ATOMIC);
if (!qat_req->iv) if (!qat_req->iv)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment