]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
crypto: gcm - Fix error return code in crypto_gcm_create_common()
authorWei Yongjun <weiyongjun1@huawei.com>
Mon, 17 Oct 2016 15:10:06 +0000 (15:10 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Jun 2019 10:23:39 +0000 (12:23 +0200)
commit 9b40f79c08e81234d759f188b233980d7e81df6c upstream.

Fix to return error code -EINVAL from the invalid alg ivsize error
handling case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
crypto/gcm.c

index 0a12c09d7cb2bcd554604d42989bed3a5453d2e6..f1c16589af8bbf25d1a688c54fb4978ef4a1a265 100644 (file)
@@ -670,11 +670,11 @@ static int crypto_gcm_create_common(struct crypto_template *tmpl,
        ctr = crypto_skcipher_spawn_alg(&ctx->ctr);
 
        /* We only support 16-byte blocks. */
+       err = -EINVAL;
        if (ctr->cra_ablkcipher.ivsize != 16)
                goto out_put_ctr;
 
        /* Not a stream cipher? */
-       err = -EINVAL;
        if (ctr->cra_blocksize != 1)
                goto out_put_ctr;