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

Commit f8739155 authored by Corentin Labbe's avatar Corentin Labbe Committed by Herbert Xu
Browse files

crypto: sun4i-ss - Fix invalid calculation of hash end



When nbytes < 4, end is wronlgy set to a negative value which, due to
uint, is then interpreted to a large value leading to a deadlock in the
following code.

This patch fix this problem.

Fixes: 6298e948 ("crypto: sunxi-ss - Add Allwinner Security System crypto accelerator")
Signed-off-by: default avatarCorentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 179930a6
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -240,6 +240,9 @@ static int sun4i_hash(struct ahash_request *areq)
		}
	} else {
		/* Since we have the flag final, we can go up to modulo 4 */
		if (areq->nbytes < 4)
			end = 0;
		else
			end = ((areq->nbytes + op->len) / 4) * 4 - op->len;
	}