summaryrefslogtreecommitdiffstats
path: root/include/linux/ima.h
diff options
context:
space:
mode:
authorRoberto Sassu <roberto.sassu@huawei.com>2021-07-23 10:53:04 +0200
committerMimi Zohar <zohar@linux.ibm.com>2021-07-23 09:27:02 -0400
commitca3c9bdb101d9b9eb3ed8a85cc0fe55915ba49de (patch)
tree46966a8fd69ed70c7223b0c044f5244fddaef4ce /include/linux/ima.h
parentce5bb5a86e5ebcd3c2e40e6dd1382027b5d43caf (diff)
downloadlinux-ca3c9bdb101d9b9eb3ed8a85cc0fe55915ba49de.tar.bz2
ima: Add digest and digest_len params to the functions to measure a buffer
This patch performs the final modification necessary to pass the buffer measurement to callers, so that they provide a functionality similar to ima_file_hash(). It adds the 'digest' and 'digest_len' parameters to ima_measure_critical_data() and process_buffer_measurement(). These functions calculate the digest even if there is no suitable rule in the IMA policy and, in this case, they simply return 1 before generating a new measurement entry. Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com> Reviewed-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Diffstat (limited to 'include/linux/ima.h')
-rw-r--r--include/linux/ima.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/linux/ima.h b/include/linux/ima.h
index 60492263aa64..b6ab66a546ae 100644
--- a/include/linux/ima.h
+++ b/include/linux/ima.h
@@ -38,7 +38,7 @@ extern void ima_kexec_cmdline(int kernel_fd, const void *buf, int size);
extern int ima_measure_critical_data(const char *event_label,
const char *event_name,
const void *buf, size_t buf_len,
- bool hash);
+ bool hash, u8 *digest, size_t digest_len);
#ifdef CONFIG_IMA_APPRAISE_BOOTPARAM
extern void ima_appraise_parse_cmdline(void);
@@ -147,7 +147,8 @@ static inline void ima_kexec_cmdline(int kernel_fd, const void *buf, int size) {
static inline int ima_measure_critical_data(const char *event_label,
const char *event_name,
const void *buf, size_t buf_len,
- bool hash)
+ bool hash, u8 *digest,
+ size_t digest_len)
{
return -ENOENT;
}