Skip to content
Snippets Groups Projects
Commit 67cb60e4 authored by Eric Biggers's avatar Eric Biggers Committed by Herbert Xu
Browse files

crypto: shash - fix missed optimization in shash_ahash_digest()


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.

Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 626ddb2f
No related branches found
No related tags found
No related merge requests found
...@@ -307,7 +307,7 @@ int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc) ...@@ -307,7 +307,7 @@ int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc)
if (nbytes && if (nbytes &&
(sg = req->src, offset = sg->offset, (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; void *data;
data = kmap_atomic(sg_page(sg)); data = kmap_atomic(sg_page(sg));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment