函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:ima_calc_file_hash_atfm

函数原型:static int ima_calc_file_hash_atfm(struct file *file, struct ima_digest_data *hash, struct crypto_ahash *tfm)

返回类型:int

参数:

类型参数名称
struct file *file
struct ima_digest_data *hash
struct crypto_ahash *tfm
209  char * rbuf[2] = {NULL, }
210  active等于0, ahash_rc等于0
216  length等于获得消息文摘大小
218  req等于ahash_request_alloc() - allocate request data structure*@tfm: cipher handle to be registered with the request*@gfp: memory allocation flag that is handed to kmalloc by the API call.* Allocate the request data structure that must be used with the ahash
219  如果非req则返回:负ENOMEM
222  crypto_init_wait( & wait)
223  ahash_request_set_callback() - set asynchronous callback function*@req: request handle*@flags: specify zero or an ORing of the flags* CRYPTO_TFM_REQ_MAY_BACKLOG the request queue may back log and* increase the wait queue beyond the initial maximum size;*
227  rc等于ahash_wait(rypto_ahash_init() - (re)initialize message digest handle*@req: ahash_request handle that already is initialized with all necessary* data using the ahash_request_* API functions* The call (re-)initializes the message digest referenced by the ahash_request, & wait)
228  如果rc则转到:out1
231  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
233  如果i_size恒等于0则转到:out2
240  rbuf[0]等于ma_alloc_pages() - Allocate contiguous pages
241  如果非rbuf[0]则
242  rc等于负ENOMEM
243  转到:out1
247  如果i_size大于rbuf_size[0]则
253  rbuf[1]等于ma_alloc_pages() - Allocate contiguous pages
257 offset小于i_size循环
258  如果非rbuf[1]且offset
263  rc等于ahash_wait(ahash_rc, & wait)
264  如果rc则转到:out3
268  rbuf_len等于min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(loff_t, i_size - offset, rbuf_size[active])
269  rc等于grity_kernel_read - read data from the file* This is a function for reading file content instead of kernel_read().* It does not perform locking checks to ensure it cannot be blocked.* It does not perform security checks because it is irrelevant for IMA.
271  如果rc不等于rbuf_len
272  如果rc大于等于0则rc等于负EINVAL
279  转到:out3
282  如果rbuf[1]且offset
287  rc等于ahash_wait(ahash_rc, & wait)
288  如果rc则转到:out3
292  初始化散列表项目
293  ahash_request_set_crypt() - set data buffers*@req: ahash_request handle to be updated*@src: source scatter/gather list*@result: buffer that is filled with the message digest -- the caller must* ensure that the buffer has sufficient space by, for example,
295  ahash_rc等于rypto_ahash_update() - add data to message digest for processing*@req: ahash_request handle that was previously initialized with the* crypto_ahash_init call
297  如果rbuf[1]则active等于非active
301  rc等于ahash_wait(ahash_rc, & wait)
302  out3 :
303  ma_free_pages() - Free pages allocated by ima_alloc_pages().*@ptr: Pointer to allocated pages.*@size: Size of allocated buffer.
304  ma_free_pages() - Free pages allocated by ima_alloc_pages().*@ptr: Pointer to allocated pages.*@size: Size of allocated buffer.
305  out2 :
306  如果非rc
307  ahash_request_set_crypt() - set data buffers*@req: ahash_request handle to be updated*@src: source scatter/gather list*@result: buffer that is filled with the message digest -- the caller must* ensure that the buffer has sufficient space by, for example,
308  rc等于ahash_wait(rypto_ahash_final() - calculate message digest*@req: reference to the ahash_request handle that holds all information* needed to perform the cipher operation* Finalize the message digest operation and create the message digest, & wait)
310  out1 :
311  归零并释放数据结构请求
312  返回:rc
调用者
名称描述
ima_calc_file_ahash