diff options
author | Eric Biggers <ebiggers@google.com> | 2019-04-14 16:23:33 -0700 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2019-04-18 22:15:04 +0800 |
commit | 68c57be464e982925723f3c03e8130bfb74f1f97 (patch) | |
tree | ee63e755fab8d7257ba9432012ec8eb150e3d577 | |
parent | 6df821441d8d65886356f3899a4c864b55b8069d (diff) | |
download | linux-crypto-68c57be464e982925723f3c03e8130bfb74f1f97.tar.gz linux-crypto-68c57be464e982925723f3c03e8130bfb74f1f97.zip |
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 '')
-rw-r--r-- | crypto/shash.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/shash.c b/crypto/shash.c index 15b369c4..b85930e9 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) 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)); |