函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Find/insert the given key into the fscrypt_direct_keys table. If found, it* is returned with elevated refcount, and 'to_insert' is freed if non-NULL. If* not found, 'to_insert' is inserted and returned if it's non-NULL; otherwise* NULL is returned.

函数原型:static struct fscrypt_direct_key *find_or_insert_direct_key(struct fscrypt_direct_key *to_insert, const u8 *raw_key, const struct fscrypt_info *ci)

返回类型:struct fscrypt_direct_key

参数:

类型参数名称
struct fscrypt_direct_key *to_insert
const u8 *raw_key
const struct fscrypt_info *ci
191  BUILD_BUG_ON - break compile if a condition is true(hash_key的长度 > FSCRYPT_KEY_DESCRIPTOR_SIZE)
192  memcpy( & hash_key, master_key_descriptor, hash_key的长度)
195  加自旋锁
196  hash_for_each_possible - iterate over all possible objects hashing to the* same bucket*@name: hashtable to iterate*@obj: the type * to use as a loop cursor for each entry*@member: the name of the hlist_node within the struct*@key: the key of the objects (Table of keys referenced by DIRECT_KEY policies , dk, dk_node, hash_key)
197  如果内存比较不等于0则继续下一循环
200  如果Encryption mode used for this inode. It corresponds to either the* contents or filenames encryption mode, depending on the inode type.不等于dk_mode则继续下一循环
202  如果rypto_memneq - Compare two areas of memory without leaking* timing information.*@a: One area of memory*@b: Another area of memory*@size: The size of the area.* Returns 0 when data is equal, 1 otherwise.则继续下一循环
205  _inc - increment a refcount*@r: the refcount to increment* Similar to atomic_inc(), but will saturate at REFCOUNT_SATURATED and WARN
206  自旋锁解锁
207  free_direct_key(to_insert)
208  返回:dk
210  如果to_inserthash_add - add an object to a hashtable*@hashtable: hashtable to add to*@node: the &struct hlist_node of the object to be added*@key: the key of the object to be added(Table of keys referenced by DIRECT_KEY policies , & dk_node, hash_key)
212  自旋锁解锁
213  返回:to_insert
调用者
名称描述
fscrypt_get_direct_keyPrepare to encrypt directly using the master key in the given mode