提交 f8cf3e11 编写于 作者: G Gilad Ben-Yossef 提交者: Xie XiuQi

crypto: ccree - use correct internal state sizes for export

commit f3df82b4 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: NGilad Ben-Yossef <gilad@benyossef.com>
Cc: stable@vger.kernel.org # v4.19+
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 386bfbf3
...@@ -1616,7 +1616,7 @@ static struct cc_hash_template driver_hash[] = { ...@@ -1616,7 +1616,7 @@ static struct cc_hash_template driver_hash[] = {
.setkey = cc_hash_setkey, .setkey = cc_hash_setkey,
.halg = { .halg = {
.digestsize = SHA224_DIGEST_SIZE, .digestsize = SHA224_DIGEST_SIZE,
.statesize = CC_STATE_SIZE(SHA224_DIGEST_SIZE), .statesize = CC_STATE_SIZE(SHA256_DIGEST_SIZE),
}, },
}, },
.hash_mode = DRV_HASH_SHA224, .hash_mode = DRV_HASH_SHA224,
...@@ -1641,7 +1641,7 @@ static struct cc_hash_template driver_hash[] = { ...@@ -1641,7 +1641,7 @@ static struct cc_hash_template driver_hash[] = {
.setkey = cc_hash_setkey, .setkey = cc_hash_setkey,
.halg = { .halg = {
.digestsize = SHA384_DIGEST_SIZE, .digestsize = SHA384_DIGEST_SIZE,
.statesize = CC_STATE_SIZE(SHA384_DIGEST_SIZE), .statesize = CC_STATE_SIZE(SHA512_DIGEST_SIZE),
}, },
}, },
.hash_mode = DRV_HASH_SHA384, .hash_mode = DRV_HASH_SHA384,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册