]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.181/crypto-gcm-fix-error-return-code-in-crypto_gcm_create_common.patch
Linux 4.9.181
[thirdparty/kernel/stable-queue.git] / releases / 4.4.181 / crypto-gcm-fix-error-return-code-in-crypto_gcm_create_common.patch
1 From 9b40f79c08e81234d759f188b233980d7e81df6c Mon Sep 17 00:00:00 2001
2 From: Wei Yongjun <weiyongjun1@huawei.com>
3 Date: Mon, 17 Oct 2016 15:10:06 +0000
4 Subject: crypto: gcm - Fix error return code in crypto_gcm_create_common()
5
6 From: Wei Yongjun <weiyongjun1@huawei.com>
7
8 commit 9b40f79c08e81234d759f188b233980d7e81df6c upstream.
9
10 Fix to return error code -EINVAL from the invalid alg ivsize error
11 handling case instead of 0, as done elsewhere in this function.
12
13 Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
14 Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
15 Signed-off-by: Eric Biggers <ebiggers@google.com>
16 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
17
18 ---
19 crypto/gcm.c | 2 +-
20 1 file changed, 1 insertion(+), 1 deletion(-)
21
22 --- a/crypto/gcm.c
23 +++ b/crypto/gcm.c
24 @@ -670,11 +670,11 @@ static int crypto_gcm_create_common(stru
25 ctr = crypto_skcipher_spawn_alg(&ctx->ctr);
26
27 /* We only support 16-byte blocks. */
28 + err = -EINVAL;
29 if (ctr->cra_ablkcipher.ivsize != 16)
30 goto out_put_ctr;
31
32 /* Not a stream cipher? */
33 - err = -EINVAL;
34 if (ctr->cra_blocksize != 1)
35 goto out_put_ctr;
36