diff options
| author | Antoine Tenart <antoine.tenart@bootlin.com> | 2018-02-13 11:26:53 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-05-25 17:46:13 +0300 |
| commit | 0b67bf7627028df8f8cd3fa7100a4777f386792b (patch) | |
| tree | 686ae933f027c0448467f71cc458c41514ce18b7 | |
| parent | d6c794cb4cf8a2fb386ea7ba2f9ed7855ad48def (diff) | |
| download | linux-0b67bf7627028df8f8cd3fa7100a4777f386792b.tar.xz | |
crypto: inside-secure - fix the cache_len computation
[ Upstream commit 666a9c70b04fccabde5cea5e680ae1ae92460a62 ]
This patch fixes the cache length computation as cache_len could end up
being a negative value. The check between the queued size and the
block size is updated to reflect the caching mechanism which can cache
up to a full block size (included!).
Fixes: 809778e02cd4 ("crypto: inside-secure - fix hash when length is a multiple of a block")
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/crypto/inside-secure/safexcel_hash.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-secure/safexcel_hash.c index 4ee370194903..fadad68fc9fa 100644 --- a/drivers/crypto/inside-secure/safexcel_hash.c +++ b/drivers/crypto/inside-secure/safexcel_hash.c @@ -187,7 +187,7 @@ static int safexcel_ahash_send_req(struct crypto_async_request *async, int ring, int i, queued, len, cache_len, extra, n_cdesc = 0, ret = 0; queued = len = req->len - req->processed; - if (queued < crypto_ahash_blocksize(ahash)) + if (queued <= crypto_ahash_blocksize(ahash)) cache_len = queued; else cache_len = queued - areq->nbytes; |
