Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1058,6 +1058,9 @@ static int qat_alg_ablkcipher_encrypt(struct ablkcipher_request *req)
	struct device *dev = &GET_DEV(ctx->inst->accel_dev);
	int ret, ctr = 0;

	if (req->nbytes == 0)
		return 0;

	qat_req->iv = dma_alloc_coherent(dev, AES_BLOCK_SIZE,
					 &qat_req->iv_paddr, GFP_ATOMIC);
	if (!qat_req->iv)
@@ -1115,6 +1118,9 @@ static int qat_alg_ablkcipher_decrypt(struct ablkcipher_request *req)
	struct device *dev = &GET_DEV(ctx->inst->accel_dev);
	int ret, ctr = 0;

	if (req->nbytes == 0)
		return 0;

	qat_req->iv = dma_alloc_coherent(dev, AES_BLOCK_SIZE,
					 &qat_req->iv_paddr, GFP_ATOMIC);
	if (!qat_req->iv)