Re: [PATCH v4 1/3] ima: Introduce ima_get_current_hash_algo()

From
Mimi Zohar <zohar@linux.ibm.com>
Date
2021-07-23 12:49:26
Also in
linux-integrity, lkml, selinux
Reply to
Roberto Sassu, 2021-07-23
On Fri, 2021-07-23 at 10:53 +0200, Roberto Sassu wrote:
Buffer measurements, unlike file measurements, are not accessible after the
measurement is done, as buffers are not suitable for use with the
integrity_iint_cache structure (there is no index, for files it is the
inode number). In the subsequent patches, the measurement (digest) will be
returned directly by the functions that perform the buffer measurement,
ima_measure_critical_data() and process_buffer_measurement().

A caller of those functions also needs to know the algorithm used to
calculate the digest. Instead of adding the algorithm as a new parameter to
the functions, this patch provides it separately with the new function
ima_get_current_hash_algo().

Since the hash algorithm does not change after the IMA setup phase, there
is no risk of races (obtaining a digest calculated with a different
algorithm than the one returned).
Perfect explaination for annotating ima_hash_algo like:

int __ro_after_init ima_hash_algo = HASH_ALGO_SHA1;

Assuming you don't object, I'll include this change in this patch.

thanks,

Mimi
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Reviewed-by: Lakshmi Ramasubramanian <redacted>
  
Thread (6 messages) 6 messages, 2 authors, last reply 2021-07-23
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help