]>
Commit | Line | Data |
---|---|---|
d074880a GKH |
1 | From f3df82b468f00cca241d96ee3697c9a5e7fb6bd0 Mon Sep 17 00:00:00 2001 |
2 | From: Gilad Ben-Yossef <gilad@benyossef.com> | |
3 | Date: Thu, 18 Apr 2019 16:39:02 +0300 | |
4 | Subject: crypto: ccree - use correct internal state sizes for export | |
5 | ||
6 | From: Gilad Ben-Yossef <gilad@benyossef.com> | |
7 | ||
8 | commit f3df82b468f00cca241d96ee3697c9a5e7fb6bd0 upstream. | |
9 | ||
10 | We were computing the size of the import buffer based on the digest size | |
11 | but the 318 and 224 byte variants use 512 and 256 bytes internal state | |
12 | sizes respectfully, thus causing the import buffer to overrun. | |
13 | ||
14 | Fix it by using the right sizes. | |
15 | ||
16 | Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> | |
17 | Cc: stable@vger.kernel.org # v4.19+ | |
18 | Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> | |
19 | Signed-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, |