Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

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

Proto: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)

Type:struct fscrypt_direct_key

Parameter:

TypeParameterName
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( size of hash_key > FSCRYPT_KEY_DESCRIPTOR_SIZE)
192  memcpy( & hash_key, master_key_descriptor, size of hash_key )
195  spin_lock( & fscrypt_direct_keys_lock)
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  If memcmp(master_key_descriptor, dk_descriptor, FSCRYPT_KEY_DESCRIPTOR_SIZE) != 0 Then Continue
200  If Encryption mode used for this inode. It corresponds to either the* contents or filenames encryption mode, depending on the inode type. != dk_mode Then Continue
202  If 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. Then Continue
205  _inc - increment a refcount*@r: the refcount to increment* Similar to atomic_inc(), but will saturate at REFCOUNT_SATURATED and WARN
206  spin_unlock( & fscrypt_direct_keys_lock)
207  free_direct_key(to_insert)
208  Return dk
210  If to_insert Then hash_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  spin_unlock( & fscrypt_direct_keys_lock)
213  Return to_insert
Caller
NameDescribe
fscrypt_get_direct_keyPrepare to encrypt directly using the master key in the given mode