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)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 13 Feb 2016 10:34:12 +0000 (10:34 +0000)
commit5d4c935b8a1ea8bb0efed11b204de06f96fdb6b1
tree70a026531c171be79d3a2969600ca481e8d28061
parent91be8bcfc83376406f0737d91b06d2a1587aa31b
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.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
[bwh: Backported to 3.2:
 - Add struct kiocb * parameter to {recv,send}msg ops
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
crypto/algif_hash.c