提交 6ed42ccc 编写于 作者: G Gilad Ben-Yossef 提交者: Greg Kroah-Hartman

crypto: ccree - don't copy zero size ciphertext

commit 2b5ac17463dcb2411fed506edcf259a89bb538ba upstream.

For decryption in CBC mode we need to save the last ciphertext block
for use as the next IV. However, we were trying to do this also with
zero sized ciphertext resulting in a panic.

Fix this by only doing the copy if the ciphertext length is at least
of IV size.
Signed-off-by: NGilad Ben-Yossef <gilad@benyossef.com>
Cc: stable@vger.kernel.org
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 0bdd345a
...@@ -783,7 +783,8 @@ static int cc_cipher_decrypt(struct skcipher_request *req) ...@@ -783,7 +783,8 @@ static int cc_cipher_decrypt(struct skcipher_request *req)
memset(req_ctx, 0, sizeof(*req_ctx)); memset(req_ctx, 0, sizeof(*req_ctx));
if (ctx_p->cipher_mode == DRV_CIPHER_CBC) { if ((ctx_p->cipher_mode == DRV_CIPHER_CBC) &&
(req->cryptlen >= ivsize)) {
/* Allocate and save the last IV sized bytes of the source, /* Allocate and save the last IV sized bytes of the source,
* which will be lost in case of in-place decryption. * which will be lost in case of in-place decryption.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册