crypto: algif_hash - Require setkey before accept(2)
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 27 Oct 2016 14:29:39 +0000 (17:29 +0300)
committerWilly Tarreau <w@1wt.eu>
Mon, 6 Feb 2017 08:04:07 +0000 (09:04 +0100)
commit855297521e21710c6fc8c8d2909c7db7a86c37b3
tree6aa8e85a1cadf3157b428ee3d4ec2f3b6f0882b5
parent389378f759251c9d1927558b10a9ffca1072c951
crypto: algif_hash - Require setkey before accept(2)

commit 6de62f15b581f920ade22d758f4c338311c2f0d4 upstream.

Hash implementations that require a key may crash if you use
them without setting a key.  This patch adds the necessary checks
so that if you do attempt to use them without a key that we return
-ENOKEY instead of proceeding.

This patch also adds a compatibility path to support old applications
that do acept(2) before setkey.

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_hash.c