Skip to content

Commit

Permalink
ima: fix violation measurement list record
Browse files Browse the repository at this point in the history
Although the violation digest in the IMA measurement list is always
zeroes, the size of the digest should be based on the hash algorithm.
Until recently the hash algorithm was hard coded to sha1.  Fix the
violation digest size included in the IMA measurement list.

This is just a cosmetic change which should not affect attestation.

Reported-by: Stefan Berger <[email protected]>
Fixes: 09091c4 ("ima: use IMA default hash algorithm for integrity violations")
Tested-by: Stefan Berger <[email protected]>
Signed-off-by: Mimi Zohar <[email protected]>
  • Loading branch information
mimizohar committed Jul 7, 2022
1 parent 51dd64b commit 9fab303
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions security/integrity/ima/ima_template_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,10 @@ static int ima_eventdigest_init_common(const u8 *digest, u32 digestsize,
else
/*
* If digest is NULL, the event being recorded is a violation.
* Make room for the digest by increasing the offset of
* IMA_DIGEST_SIZE.
* Make room for the digest by increasing the offset by the
* hash algorithm digest size.
*/
offset += IMA_DIGEST_SIZE;
offset += hash_digest_size[hash_algo];

return ima_write_template_field_data(buffer, offset + digestsize,
fmt, field_data);
Expand Down

0 comments on commit 9fab303

Please sign in to comment.