crypto: shash - fix missed optimization in shash_ahash_digest()
PATCH 1/1 crypto: shash - fix missed optimization in shash_ahash_digest()
From: Eric Biggers <[email protected]>
shash_ahash_digest(), which is the ->digest() method for ahash tfms that use an shash algorithm, has an optimization where crypto_shash_digest() is called if the data is in a single page. But an off-by-one error prevented this path from being taken unless the user happened to provide extra data in the scatterlist. Fix it.
--- crypto/shash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/shash.c +1 -1
@@ -307,7 +307,7 @@ int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc)if (nbytes && (sg = req->src, offset = sg->offset, - nbytes <min (sg->length, ((unsigned int )(PAGE_SIZE )) - offset))) { + nbytes <=min (sg->length, ((unsigned int )(PAGE_SIZE )) - offset))) {void *data; data =kmap_atomic (sg_page (sg));
Signature · 1 line
2.21.0
Herbert Xu
maintainerQuoted 8 lines · Eric Biggers
From: Eric Biggers <[email protected]>
shash_ahash_digest(), which is the ->digest() method for ahash tfms that use an shash algorithm, has an optimization wherecrypto_shash_digest()is called if the data is in a single page. But an off-by-one error prevented this path from being taken unless the user happened to provide extra data in the scatterlist. Fix it.
Quoted 4 lines
Signed-off-by Eric Biggers <[email protected]>--- crypto/shash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt