mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 00:48:50 +00:00
ubifs: add check for crypto_shash_tfm_digest
Add check for the return value of crypto_shash_tfm_digest() and return
the error if it fails in order to catch the error.
Fixes: 817aa09484
("ubifs: support offline signed images")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
This commit is contained in:
parent
25e79a7f2c
commit
054fd15984
1 changed files with 4 additions and 1 deletions
|
@ -67,10 +67,13 @@ static int mst_node_check_hash(const struct ubifs_info *c,
|
|||
{
|
||||
u8 calc[UBIFS_MAX_HASH_LEN];
|
||||
const void *node = mst;
|
||||
int ret;
|
||||
|
||||
crypto_shash_tfm_digest(c->hash_tfm, node + sizeof(struct ubifs_ch),
|
||||
ret = crypto_shash_tfm_digest(c->hash_tfm, node + sizeof(struct ubifs_ch),
|
||||
UBIFS_MST_NODE_SZ - sizeof(struct ubifs_ch),
|
||||
calc);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (ubifs_check_hash(c, expected, calc))
|
||||
return -EPERM;
|
||||
|
|
Loading…
Reference in a new issue