ubifs: fix wrong use of crypto_shash_descsize()
authorEric Biggers <ebiggers@google.com>
Sat, 2 May 2020 05:59:45 +0000 (22:59 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 May 2020 15:46:09 +0000 (17:46 +0200)
commit3be8ece11440af5695544abe192ae0d1e251692f
tree72f9e37bebf1d9308a8161d0605203f06961b81d
parent48bbd44f5fa97bae6926f78d2a8a8287819625a2
ubifs: fix wrong use of crypto_shash_descsize()

[ Upstream commit 3c3c32f85b6cc05e5db78693457deff03ac0f434 ]

crypto_shash_descsize() returns the size of the shash_desc context
needed to compute the hash, not the size of the hash itself.

crypto_shash_digestsize() would be correct, or alternatively using
c->hash_len and c->hmac_desc_len which already store the correct values.
But actually it's simpler to just use stack arrays, so do that instead.

Fixes: 49525e5eecca ("ubifs: Add helper functions for authentication support")
Fixes: da8ef65f9573 ("ubifs: Authenticate replayed journal")
Cc: <stable@vger.kernel.org> # v4.20+
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ubifs/auth.c
fs/ubifs/replay.c