diff options
author | Giovanni Cabiddu <giovanni.cabiddu@intel.com> | 2019-04-29 16:43:21 +0100 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2019-05-23 14:01:03 +0800 |
commit | a3af11399aa28de0779a187f1a30504129ad754a (patch) | |
tree | 8979bbd1e66122572a5d93d708b39f71d87aab9b /drivers/crypto | |
parent | 96ee111a659e0f0bdfc48402b9d4162e14016ff1 (diff) | |
download | linux-a3af11399aa28de0779a187f1a30504129ad754a.tar.gz linux-a3af11399aa28de0779a187f1a30504129ad754a.tar.bz2 linux-a3af11399aa28de0779a187f1a30504129ad754a.zip |
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>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/qat/qat_common/qat_algs.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/crypto/qat/qat_common/qat_algs.c b/drivers/crypto/qat/qat_common/qat_algs.c index 868fefa9bb65..2842b2cdaa90 100644 --- a/drivers/crypto/qat/qat_common/qat_algs.c +++ b/drivers/crypto/qat/qat_common/qat_algs.c @@ -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) |