函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\integrity\ima\ima_crypto.c Create Date:2022-07-27 22:01:00
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:ma_calc_file_hash - calculate file hash* Asynchronous hash (ahash) allows using HW acceleration for calculating* a hash. ahash performance varies for different data sizes on different* crypto accelerators

函数原型:int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash)

返回类型:int

参数:

类型参数名称
struct file *file
struct ima_digest_data *hash
413  f等于file
414  bool new_file_instance = TSC's on different sockets may be reset asynchronously.* This may cause the TSC ADJUST value on socket 0 to be NOT 0., modified_flags = false
420  如果f_flags按位与O_DIRECT
421  length等于hash_digest_size[ima_hash_algo]
422  algo等于ima_hash_algo
423  返回:负EINVAL
427  如果非f_mode按位与le is open for reading 的值则
428  flags等于f_flags按位与O_WRONLY按位或O_APPEND按位或O_TRUNC按位或O_CREAT按位或O_NOCTTY按位或O_EXCL的值的反
430  flags或等于O_RDONLY
431  f等于dentry_open( & f_path, flags, f_cred)
432  如果是错误
437  pr_info_ratelimited("Unable to reopen file for reading.\n")
438  f等于file
440  modified_flags = true
441  否则
442  new_file_instance = true
446  i_size等于NOTE: in a 32bit arch with a preemptable kernel and* an UP compile the i_size_read/write must be atomic* with respect to the local cpu (unlike with preempt disabled),* but they don't need to be atomic with respect to other cpus like in* true SMP (so they
448  如果minimum file size for ahash use i_size大于等于minimum file size for ahash use
449  rc等于ima_calc_file_ahash(f, hash)
450  如果非rc则转到:out
454  rc等于ima_calc_file_shash(f, hash)
455  out :
456  如果new_file_instancefput(f)
458  否则如果modified_flagsf_flags与等于le is open for reading 的反
460  返回:rc
调用者
名称描述
ima_collect_measurementma_collect_measurement - collect file measurement* Calculate the file hash, if it doesn't already exist,* storing the measurement and i_version in the iint.* Must be called with iint->mutex held.* Return 0 on success, error code otherwise
ima_eventdigest_initThis function writes the digest of an event (with size limit).