Commit ebbdf646 authored by Herbert Xu's avatar Herbert Xu
Browse files

crypto: ahash - Zero positive err value in ahash_update_finish



The partial block length returned by a block-only driver should
not be passed up to the caller since ahash itself deals with the
partial block data.

Set err to zero in ahash_update_finish if it was positive.

Reported-by: default avatarT Pratham <t-pratham@ti.com>
Tested-by: default avatarT Pratham <t-pratham@ti.com>
Fixes: 9d7a0ab1 ("crypto: ahash - Handle partial blocks in API")
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent b0356b75
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -423,7 +423,11 @@ static int ahash_update_finish(struct ahash_request *req, int err)

	req->nbytes += nonzero - blen;

	blen = err < 0 ? 0 : err + nonzero;
	blen = 0;
	if (err >= 0) {
		blen = err + nonzero;
		err = 0;
	}
	if (ahash_request_isvirt(req))
		memcpy(buf, req->svirt + req->nbytes - blen, blen);
	else