crypto: algif_hash - Require setkey before accept(2)
authorHerbert Xu <herbert@gondor.apana.org.au>
Fri, 8 Jan 2016 13:31:04 +0000 (21:31 +0800)
committerSasha Levin <sasha.levin@oracle.com>
Wed, 3 Feb 2016 21:23:19 +0000 (16:23 -0500)
commite1ed9a4b4380fc33c558a0c1bd7cbf527e891151
treea23c848bc42e289a5c996dea4dc5e0878cde0e2b
parentc409087e6db988257adffb614616764116c7337e
crypto: algif_hash - Require setkey before accept(2)

[ Upstream commit 6de62f15b581f920ade22d758f4c338311c2f0d4 ]

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: Sasha Levin <sasha.levin@oracle.com>
crypto/algif_hash.c