]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: algif_hash - Fix NULL hash crash with shash
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 17 Nov 2016 14:07:58 +0000 (22:07 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 18 Nov 2016 14:34:10 +0000 (22:34 +0800)
commit8d652dd2bbc66456074f50585ab5eb522b8caa7d
treea3afca8b46f4b4fa4c28755681821a178bfa7e18
parent944a815c29f8044988ed84c4ba3c864ff913d20f
crypto: algif_hash - Fix NULL hash crash with shash

Recently algif_hash has been changed to allow null hashes.  This
triggers a bug when used with an shash algorithm whereby it will
cause a crash during the digest operation.

This patch fixes it by avoiding the digest operation and instead
doing an init followed by a final which avoids the buggy code in
shash.

This patch also ensures that the result buffer is freed after an
error so that it is not returned as a genuine hash result on the
next recv call.

The shash/ahash wrapper code will be fixed later to handle this
case correctly.

Fixes: daeaf08a584c ("crypto: algif_hash - Handle NULL hashes correctly")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Tested-by: Laura Abbott <labbott@redhat.com>
crypto/algif_hash.c