ima_file_hash(9)
β¨ ima_file_hash(9) β a Kernel API Manual moment β¨
okay so bestie, welcome to the Kernel API Manual π this one is literally about ima_file_hash(9), and itβs giving βget the measurement of the fileβ energy. stay with me, itβs not scary fr fr π«Ά
πΈ NAME πΈ
ima_file_hash β return a measurement of the file β¨
π¦ SYNOPSIS π¦
int ima_file_hash (struct file *file , char *buf , size_t buf_size );
π ARGUMENTS π
fileβ pointer to the file πbufβ buffer in which to store the hash π§Ίbuf_sizeβ length of the buffer π
π DESCRIPTION π
On success, return the hash algorithm (as defined in the enum hash_algo) π₯ If buf is not NULL, this function also outputs the hash into buf. If the hash is larger than buf_size, then only buf_size bytes will be copied.
It generally just makes sense to pass a buffer capable of holding the largest possible hash: IMA_MAX_DIGEST_SIZE π The file hash returned is based on the entire file, including the appended signature. no cap, the whole thing π«Ά
If the measurement cannot be performed, return -EOPNOTSUPP π If the parameters are incorrect, return -EINVAL π
π SEE ALSO π
Kernel file ./security/integrity/ima/ima_main.c β and also, go say hi to these icons: ima_file_free(9), ima_file_mmap(9), ima_file_mprotect(9), ima_bprm_check(9), ima_creds_check(9), ima_bprm_creds_for_exec(9), ima_file_check(9), ima_inode_hash(9), ima_post_create_tmpfile(9), ima_post_path_mknod(9), ima_read_file(9), ima_post_read_file(9), ima_load_data(9), ima_post_load_data(9), process_buffer_measurement(9), ima_kexec_cmdline(9), ima_measure_critical_data(9), ima_measure_raw_policy(9), ima_kernel_module_request(9) β
xoxo π
source/version: ./security/integrity/ima Β· date: October 2026 Β· title: ima_file_hash(9) β periodt π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms