crypto: algif_skcipher - Add key check exception for cipher_null
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 27 Oct 2016 14:29:41 +0000 (17:29 +0300)
committerWilly Tarreau <w@1wt.eu>
Mon, 6 Feb 2017 08:04:07 +0000 (09:04 +0100)
commit 6e8d8ecf438792ecf7a3207488fb4eebc4edb040 upstream.

This patch adds an exception to the key check so that cipher_null
users may continue to use algif_skcipher without setting a key.

Cc: stable@vger.kernel.org
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: Willy Tarreau <w@1wt.eu>
crypto/algif_skcipher.c

index db5f0f0090e085bd2732fa40151f4d2ffa39aae8..4677a45ec8cc33bce355da0e393765ac4c64cfba 100644 (file)
@@ -759,7 +759,7 @@ static int skcipher_accept_parent(void *private, struct sock *sk)
 {
        struct skcipher_tfm *tfm = private;
 
-       if (!tfm->has_key)
+       if (!tfm->has_key && crypto_ablkcipher_has_setkey(tfm->skcipher))
                return -ENOKEY;
 
        return skcipher_accept_parent_common(private, sk);