Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\verity\hash_algs.c Create Date:2022-07-28 20:24:38
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name: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

Proto:const u8 *fsverity_prepare_hash_state(const struct fsverity_hash_alg *alg, const u8 *salt, size_t salt_size)

Type:u8

Parameter:

TypeParameterName
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  If salt_size == 0 Then Return NULL
118  hashstate = Allocation memory
119  If Not hashstate Then Return ERR_PTR( - ENOMEM)
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  If Not req Then
124  err = -ENOMEM
125  Go to 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 = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
137  If Not padded_salt Then
138  err = -ENOMEM
139  Go to err_free
141  memcpy(padded_salt, salt, salt_size)
143  sg_init_one - Initialize a single entry sg list*@sg: SG entry*@buf: Virtual address for IO*@buflen: IO length
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  If err Then Go to 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  If err Then Go to 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  If err Then Go to err_free
160  out :
161  ahash_request_free() - zeroize and free the request data structure*@req: request data structure cipher handle to be freed
162  kfree(padded_salt)
163  Return hashstate
165  err_free :
166  kfree(hashstate)
167  hashstate = ERR_PTR(err)
168  Go to out
Caller
NameDescribe
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