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, 10 Feb 2016 03:57:32 +0000 (22:57 -0500)
commitcec8983e6d2cf52e60cd59583ae30f81f923f563
treeb2149b59623546ac73db33ae3b46d18ae78fd170
parent8c7817966b10cdb048036e456316ac3aba9f0279
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