[PATCH] evm: check return values of crypto_shash functions

sashiko-bot at kernel.org sashiko-bot at kernel.org
Fri Oct 9 11:39:46 UTC 2026


> From: Daniel Hodges <git at danielhodges.dev>
> 
> The crypto_shash_update() and crypto_shash_final() functions can fail
> and return error codes, but their return values were not being checked
> in several places in security/integrity/evm/evm_crypto.c:
> 
> - hmac_add_misc() ignored returns from crypto_shash_update() and
>   crypto_shash_final()
> - evm_calc_hmac_or_hash() ignored returns from crypto_shash_update()
> - evm_init_hmac() ignored returns from crypto_shash_update()
> 
> If these hash operations fail silently, the resulting HMAC could be
> invalid or incomplete, which could weaken the integrity verification
> security that EVM provides.
> 
> [ ... ]
> [roberto.sassu at huawei.com: call hmac_add_misc() in evm_calc_hmac_or_hash()
>  only if no previous error, to avoid overwriting -ENODATA, and jump to out
>  only if hmac_add_misc() fails]
> Signed-off-by: Mimi Zohar <zohar at linux.ibm.com>
> Signed-off-by: Roberto Sassu <roberto.sassu at huawei.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261009111212.1516243-1-roberto.sassu@huaweicloud.com?part=1




More information about the Linux-security-module-archive mailing list