]> www.infradead.org Git - users/jedix/linux-maple.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)
committerChuck Anderson <chuck.anderson@oracle.com>
Tue, 22 Aug 2017 15:43:02 +0000 (08:43 -0700)
commit51f608d5ae324c57588aab0d8fd8a9e97b50b583
tree8d714ab841dbce7a5e76aaa5a96d884f66838db4
parent8050a9109bf15496c4708906c27d16a175a1eaf9
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: 493b2ed3f760 ("crypto: algif_hash - Handle NULL hashes correctly")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Tested-by: Laura Abbott <labbott@redhat.com>
(cherry picked from commit a8348bca2944d397a528772f5c0ccb47a8b58af4)

Orabug: 25698521

Signed-off-by: Ethan Zhao <ethan.zhao@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
crypto/algif_hash.c