Skip to content

Commit 9fab303

Browse files
committed
ima: fix violation measurement list record
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 <stefanb@linux.ibm.com> Fixes: 09091c4 ("ima: use IMA default hash algorithm for integrity violations") Tested-by: Stefan Berger <stefanb@linux.ibm.com> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
1 parent 51dd64b commit 9fab303

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

security/integrity/ima/ima_template_lib.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,10 @@ static int ima_eventdigest_init_common(const u8 *digest, u32 digestsize,
323323
else
324324
/*
325325
* If digest is NULL, the event being recorded is a violation.
326-
* Make room for the digest by increasing the offset of
327-
* IMA_DIGEST_SIZE.
326+
* Make room for the digest by increasing the offset by the
327+
* hash algorithm digest size.
328328
*/
329-
offset += IMA_DIGEST_SIZE;
329+
offset += hash_digest_size[hash_algo];
330330

331331
return ima_write_template_field_data(buffer, offset + digestsize,
332332
fmt, field_data);

0 commit comments

Comments
 (0)