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

Commit 31bb2f0d authored by Iuliana Prodan's avatar Iuliana Prodan Committed by Herbert Xu
Browse files

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: default avatarIuliana Prodan <iuliana.prodan@nxp.com>
Reviewed-by: default avatarHoria Geanta <horia.geanta@nxp.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent fcd23ed5
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1884,6 +1884,9 @@ static int skcipher_encrypt(struct skcipher_request *req)
	u32 *desc;
	int ret = 0;

	if (!req->cryptlen)
		return 0;

	/* allocate extended descriptor */
	edesc = skcipher_edesc_alloc(req, DESC_JOB_IO_LEN * CAAM_CMD_SZ);
	if (IS_ERR(edesc))
@@ -1918,6 +1921,9 @@ static int skcipher_decrypt(struct skcipher_request *req)
	u32 *desc;
	int ret = 0;

	if (!req->cryptlen)
		return 0;

	/* allocate extended descriptor */
	edesc = skcipher_edesc_alloc(req, DESC_JOB_IO_LEN * CAAM_CMD_SZ);
	if (IS_ERR(edesc))
+3 −0
Original line number Diff line number Diff line
@@ -1445,6 +1445,9 @@ static inline int skcipher_crypt(struct skcipher_request *req, bool encrypt)
	struct caam_ctx *ctx = crypto_skcipher_ctx(skcipher);
	int ret;

	if (!req->cryptlen)
		return 0;

	if (unlikely(caam_congested))
		return -EAGAIN;

+5 −0
Original line number Diff line number Diff line
@@ -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))