summaryrefslogtreecommitdiffstats
path: root/crypto/shash.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2019-04-14 19:23:33 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2019-04-18 10:15:04 -0400
commit67cb60e4efe7bd9d7a7afb8297f58afe25c28919 (patch)
tree793814ab8b57c0c592bc5fee608d3e51db39f4f5 /crypto/shash.c
parent626ddb2fbe7931a2996bd7fe88bd1ffd5daf7143 (diff)
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: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/shash.c')
-rw-r--r--crypto/shash.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/shash.c b/crypto/shash.c
index 15b369c4745f..b85930e9a7a2 100644
--- a/crypto/shash.c
+++ b/crypto/shash.c
@@ -307,7 +307,7 @@ int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc)
307 307
308 if (nbytes && 308 if (nbytes &&
309 (sg = req->src, offset = sg->offset, 309 (sg = req->src, offset = sg->offset,
310 nbytes < min(sg->length, ((unsigned int)(PAGE_SIZE)) - offset))) { 310 nbytes <= min(sg->length, ((unsigned int)(PAGE_SIZE)) - offset))) {
311 void *data; 311 void *data;
312 312
313 data = kmap_atomic(sg_page(sg)); 313 data = kmap_atomic(sg_page(sg));