]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ima: check return value of crypto_shash_final() in boot aggregate
authorDaniel Hodges <hodgesd@meta.com>
Sun, 1 Feb 2026 02:40:15 +0000 (18:40 -0800)
committerMimi Zohar <zohar@linux.ibm.com>
Mon, 9 Mar 2026 14:57:49 +0000 (10:57 -0400)
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: 76bb28f6126f ("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>
security/integrity/ima/ima_crypto.c

index 10022b0db4d582c5ba15d26d7ea2bae9e2532361..8f680ef18d8c3ccc91dcc6b83ac8665684398331 100644 (file)
@@ -838,7 +838,7 @@ static int ima_calc_boot_aggregate_tfm(char *digest, u16 alg_id,
                }
        }
        if (!rc)
-               crypto_shash_final(shash, digest);
+               rc = crypto_shash_final(shash, digest);
        return rc;
 }