函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\verity\hash_algs.c Create Date:2022-07-29 10:58:20
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:sverity_prepare_hash_state() - precompute the initial hash state*@alg: hash algorithm*@salt: a salt which is to be prepended to all data to be hashed*@salt_size: salt size in bytes, possibly 0* Return: NULL if the salt is empty, otherwise the kmalloc()'ed

函数原型:const u8 *fsverity_prepare_hash_state(const struct fsverity_hash_alg *alg, const u8 *salt, size_t salt_size)

返回类型:u8

参数:

类型参数名称
const struct fsverity_hash_alg *alg
const u8 *salt
size_tsalt_size
107  u8 * hashstate = NULL
108  struct ahash_request * req = NULL
109  u8 * padded_salt = NULL
115  如果salt_size恒等于0则返回:NULL
118  hashstate等于开辟内存
119  如果非hashstate则返回:错误号
122  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
123  如果非req
124  err等于负ENOMEM
125  转到:err_free
135  padded_salt_size等于und_up - round up to next specified power of 2*@x: the value to round*@y: multiple to round up to (must be a power of 2)* Rounds @x up to next multiple of @y (which must be a power of 2).* To perform arbitrary rounding up, use roundup() below.(salt_size, lock size in bytes, e.g. 64 for SHA-256 )
136  padded_salt等于分配内存并置零
137  如果非padded_salt
138  err等于负ENOMEM
139  转到:err_free
141  memcpy(padded_salt, salt, salt_size)
143  初始化散列表项目
144  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;*
147  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,
149  err等于crypto_wait_req(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)
150  如果err则转到:err_free
153  err等于crypto_wait_req(rypto_ahash_update() - add data to message digest for processing*@req: ahash_request handle that was previously initialized with the* crypto_ahash_init call, & wait)
154  如果err则转到:err_free
157  err等于rypto_ahash_export() - extract current message digest state*@req: reference to the ahash_request handle whose state is exported*@out: output buffer of sufficient size that can hold the hash state* This function exports the hash state of the ahash_request
158  如果err则转到:err_free
160  out :
161  归零并释放数据结构请求
162  释放内存
163  返回:hashstate
165  err_free :
166  释放内存
167  hashstate等于错误号
168  转到:out
调用者
名称描述
fsverity_init_merkle_tree_paramssverity_init_merkle_tree_params() - initialize Merkle tree parameters*@params: the parameters struct to initialize*@inode: the inode for which the Merkle tree is being built*@hash_algorithm: number of hash algorithm to use*@log_blocksize: log base 2 of