Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Iuliana Prodan and committed by
Herbert Xu
31bb2f0d fcd23ed5

+14
+6
drivers/crypto/caam/caamalg.c
··· 1884 1884 u32 *desc; 1885 1885 int ret = 0; 1886 1886 1887 + if (!req->cryptlen) 1888 + return 0; 1889 + 1887 1890 /* allocate extended descriptor */ 1888 1891 edesc = skcipher_edesc_alloc(req, DESC_JOB_IO_LEN * CAAM_CMD_SZ); 1889 1892 if (IS_ERR(edesc)) ··· 1920 1917 struct device *jrdev = ctx->jrdev; 1921 1918 u32 *desc; 1922 1919 int ret = 0; 1920 + 1921 + if (!req->cryptlen) 1922 + return 0; 1923 1923 1924 1924 /* allocate extended descriptor */ 1925 1925 edesc = skcipher_edesc_alloc(req, DESC_JOB_IO_LEN * CAAM_CMD_SZ);
+3
drivers/crypto/caam/caamalg_qi.c
··· 1445 1445 struct caam_ctx *ctx = crypto_skcipher_ctx(skcipher); 1446 1446 int ret; 1447 1447 1448 + if (!req->cryptlen) 1449 + return 0; 1450 + 1448 1451 if (unlikely(caam_congested)) 1449 1452 return -EAGAIN; 1450 1453
+5
drivers/crypto/caam/caamalg_qi2.c
··· 1499 1499 struct caam_request *caam_req = skcipher_request_ctx(req); 1500 1500 int ret; 1501 1501 1502 + if (!req->cryptlen) 1503 + return 0; 1504 + 1502 1505 /* allocate extended descriptor */ 1503 1506 edesc = skcipher_edesc_alloc(req); 1504 1507 if (IS_ERR(edesc)) ··· 1530 1527 struct caam_request *caam_req = skcipher_request_ctx(req); 1531 1528 int ret; 1532 1529 1530 + if (!req->cryptlen) 1531 + return 0; 1533 1532 /* allocate extended descriptor */ 1534 1533 edesc = skcipher_edesc_alloc(req); 1535 1534 if (IS_ERR(edesc))