summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/caam/caamalg_qi2.c
diff options
context:
space:
mode:
authorIuliana Prodan <iuliana.prodan@nxp.com>2019-07-31 15:08:08 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2019-08-09 07:11:48 +0200
commit31bb2f0da1b5099732337d9ecef792ab67970ddf (patch)
tree3de625f0318837b3562d2254adcb26a16b96a155 /drivers/crypto/caam/caamalg_qi2.c
parentcrypto: caam - check assoclen (diff)
downloadlinux-31bb2f0da1b5099732337d9ecef792ab67970ddf.tar.xz
linux-31bb2f0da1b5099732337d9ecef792ab67970ddf.zip
crypto: caam - check zero-length input
Check zero-length input, for skcipher algorithm, to solve the extra tests. This is a valid operation, therefore the API will return no error. Signed-off-by: Iuliana Prodan <iuliana.prodan@nxp.com> Reviewed-by: Horia Geanta <horia.geanta@nxp.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/caam/caamalg_qi2.c')
-rw-r--r--drivers/crypto/caam/caamalg_qi2.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamalg_qi2.c
index 7350142050cc..63a86b6b8b96 100644
--- a/drivers/crypto/caam/caamalg_qi2.c
+++ b/drivers/crypto/caam/caamalg_qi2.c
@@ -1499,6 +1499,9 @@ static int skcipher_encrypt(struct skcipher_request *req)
struct caam_request *caam_req = skcipher_request_ctx(req);
int ret;
+ if (!req->cryptlen)
+ return 0;
+
/* allocate extended descriptor */
edesc = skcipher_edesc_alloc(req);
if (IS_ERR(edesc))
@@ -1527,6 +1530,8 @@ static int skcipher_decrypt(struct skcipher_request *req)
struct caam_request *caam_req = skcipher_request_ctx(req);
int ret;
+ if (!req->cryptlen)
+ return 0;
/* allocate extended descriptor */
edesc = skcipher_edesc_alloc(req);
if (IS_ERR(edesc))