Skip to content

Commit 148e4f7

Browse files
hodgesdsgregkh
authored andcommitted
ima: check return value of crypto_shash_final() in boot aggregate
[ Upstream commit 8708194 ] The return value of crypto_shash_final() is not checked in ima_calc_boot_aggregate_tfm(). If the hash finalization fails, the function returns success and a corrupted boot aggregate digest could be used for IMA measurements. Capture the return value and propagate any error to the caller. Fixes: 76bb28f ("ima: use new crypto_shash API instead of old crypto_hash") Signed-off-by: Daniel Hodges <hodgesd@meta.com> Reviewed-by: Roberto Sassu <roberto.sassu@huawei.com> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 5bfc585 commit 148e4f7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

security/integrity/ima/ima_crypto.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ static int ima_calc_boot_aggregate_tfm(char *digest, u16 alg_id,
832832
}
833833
}
834834
if (!rc)
835-
crypto_shash_final(shash, digest);
835+
rc = crypto_shash_final(shash, digest);
836836
return rc;
837837
}
838838

0 commit comments

Comments
 (0)