diff options
author | Gilad Ben-Yossef <gilad@benyossef.com> | 2019-04-18 16:39:02 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-05-22 07:37:39 +0200 |
commit | ca687cdb615918e30b9cb3f21197f8df9bfbef08 (patch) | |
tree | 4dcc8fea86d7ad355aacf193165c5e17a6dc3b78 /drivers/crypto | |
parent | 766121a0a798d62a57b265ae3253508ba8d79a10 (diff) | |
download | linux-stable-ca687cdb615918e30b9cb3f21197f8df9bfbef08.tar.gz linux-stable-ca687cdb615918e30b9cb3f21197f8df9bfbef08.tar.bz2 linux-stable-ca687cdb615918e30b9cb3f21197f8df9bfbef08.zip |
crypto: ccree - use correct internal state sizes for export
commit f3df82b468f00cca241d96ee3697c9a5e7fb6bd0 upstream.
We were computing the size of the import buffer based on the digest size
but the 318 and 224 byte variants use 512 and 256 bytes internal state
sizes respectfully, thus causing the import buffer to overrun.
Fix it by using the right sizes.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
Cc: stable@vger.kernel.org # v4.19+
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/ccree/cc_hash.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/crypto/ccree/cc_hash.c b/drivers/crypto/ccree/cc_hash.c index 7a1c3eeb10e7..2cadd7a21844 100644 --- a/drivers/crypto/ccree/cc_hash.c +++ b/drivers/crypto/ccree/cc_hash.c @@ -1616,7 +1616,7 @@ static struct cc_hash_template driver_hash[] = { .setkey = cc_hash_setkey, .halg = { .digestsize = SHA224_DIGEST_SIZE, - .statesize = CC_STATE_SIZE(SHA224_DIGEST_SIZE), + .statesize = CC_STATE_SIZE(SHA256_DIGEST_SIZE), }, }, .hash_mode = DRV_HASH_SHA224, @@ -1641,7 +1641,7 @@ static struct cc_hash_template driver_hash[] = { .setkey = cc_hash_setkey, .halg = { .digestsize = SHA384_DIGEST_SIZE, - .statesize = CC_STATE_SIZE(SHA384_DIGEST_SIZE), + .statesize = CC_STATE_SIZE(SHA512_DIGEST_SIZE), }, }, .hash_mode = DRV_HASH_SHA384, |