]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.19.45/crypto-ccree-use-correct-internal-state-sizes-for-export.patch
Linux 4.19.45
[thirdparty/kernel/stable-queue.git] / releases / 4.19.45 / crypto-ccree-use-correct-internal-state-sizes-for-export.patch
CommitLineData
d074880a
GKH
1From f3df82b468f00cca241d96ee3697c9a5e7fb6bd0 Mon Sep 17 00:00:00 2001
2From: Gilad Ben-Yossef <gilad@benyossef.com>
3Date: Thu, 18 Apr 2019 16:39:02 +0300
4Subject: crypto: ccree - use correct internal state sizes for export
5
6From: Gilad Ben-Yossef <gilad@benyossef.com>
7
8commit f3df82b468f00cca241d96ee3697c9a5e7fb6bd0 upstream.
9
10We were computing the size of the import buffer based on the digest size
11but the 318 and 224 byte variants use 512 and 256 bytes internal state
12sizes respectfully, thus causing the import buffer to overrun.
13
14Fix it by using the right sizes.
15
16Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
17Cc: stable@vger.kernel.org # v4.19+
18Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
19Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20
21---
22 drivers/crypto/ccree/cc_hash.c | 4 ++--
23 1 file changed, 2 insertions(+), 2 deletions(-)
24
25--- a/drivers/crypto/ccree/cc_hash.c
26+++ b/drivers/crypto/ccree/cc_hash.c
27@@ -1616,7 +1616,7 @@ static struct cc_hash_template driver_ha
28 .setkey = cc_hash_setkey,
29 .halg = {
30 .digestsize = SHA224_DIGEST_SIZE,
31- .statesize = CC_STATE_SIZE(SHA224_DIGEST_SIZE),
32+ .statesize = CC_STATE_SIZE(SHA256_DIGEST_SIZE),
33 },
34 },
35 .hash_mode = DRV_HASH_SHA224,
36@@ -1641,7 +1641,7 @@ static struct cc_hash_template driver_ha
37 .setkey = cc_hash_setkey,
38 .halg = {
39 .digestsize = SHA384_DIGEST_SIZE,
40- .statesize = CC_STATE_SIZE(SHA384_DIGEST_SIZE),
41+ .statesize = CC_STATE_SIZE(SHA512_DIGEST_SIZE),
42 },
43 },
44 .hash_mode = DRV_HASH_SHA384,