Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Validate the given fsverity_descriptor and create a new fsverity_info from* it. The signature (if present) is also checked.

Proto:struct fsverity_info *fsverity_create_info(const struct inode *inode, void *_desc, size_t desc_size)

Type:struct fsverity_info

Parameter:

TypeParameterName
const struct inode *inode
void *_desc
size_tdesc_size
150  desc = _desc
154  If desc_size < size of desc Then
155  fsverity_err(inode, "Unrecognized descriptor size: %zu bytes", desc_size)
157  Return ERR_PTR( - EINVAL)
160  If must be 1 != 1 Then
161  fsverity_err(inode, "Unrecognized descriptor version: %u", must be 1 )
163  Return ERR_PTR( - EINVAL)
166  If memchr_inv - Find an unmatching character in an area of memory.*@start: The memory area*@c: Find a character other than c*@bytes: The size of the area.* returns the address of the first character other than @c, or %NULL Then
167  fsverity_err(inode, "Reserved bits set in descriptor")
168  Return ERR_PTR( - EINVAL)
171  If size of salt in bytes; 0 if none > size of salt prepended to each hashed block Then
172  fsverity_err(inode, "Invalid salt_size: %u", size of salt in bytes; 0 if none )
173  Return ERR_PTR( - EINVAL)
176  If le64_to_cpu(size of file the Merkle tree is built over ) != i_size Then
177  fsverity_err(inode, "Wrong data_size: %llu (desc) != %lld (inode)", le64_to_cpu(size of file the Merkle tree is built over ), i_size)
180  Return ERR_PTR( - EINVAL)
183  vi = Shortcuts
184  If Not vi Then Return ERR_PTR( - ENOMEM)
186  inode = inode
188  err = sverity_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
192  If err Then
193  fsverity_err(inode, "Error %d initializing Merkle tree parameters", err)
196  Go to out
199  memcpy(root_hash, Merkle tree root hash , same as hash_alg->digest_size )
201  err = Compute the file measurement by hashing the fsverity_descriptor excluding the* signature and with the sig_size field set to 0.
203  If err Then
204  fsverity_err(inode, "Error %d computing file measurement", err)
205  Go to out
207  pr_debug("Computed file measurement: %s:%*phN\n", crypto API name, e.g. sha256 , same as hash_alg->digest_size , measurement)
211  err = signature.c
212  out :
213  If err Then
214  fsverity_free_info(vi)
215  vi = ERR_PTR(err)
217  Return vi
Caller
NameDescribe
ensure_verity_infoEnsure the inode has an ->i_verity_info
enable_verity