函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:setup_per_mode_key

函数原型:static int setup_per_mode_key(struct fscrypt_info *ci, struct fscrypt_master_key *mk, struct crypto_skcipher **tfms, u8 hkdf_context, bool include_fs_uuid)

返回类型:int

参数:

类型参数名称
struct fscrypt_info *ci
struct fscrypt_master_key *mk
struct crypto_skcipher **tfms
u8hkdf_context
boolinclude_fs_uuid
126  inode等于Back-pointer to the inode
127  sb等于i_sb
128  mode等于Encryption mode used for this inode. It corresponds to either the* contents or filenames encryption mode, depending on the inode type.
129  mode_num等于modeavailable_modes
133  hkdf_infolen等于0
136  如果WARN_ON(mode_num > __FSCRYPT_MODE_MAX)则返回:负EINVAL
140  tfm等于READ_ONCE(tfms[mode_num])
141  如果此条件成立可能性大(为编译器优化)(tfm != NULL)则转到:done
144  BUILD_BUG_ON - break compile if a condition is true(mode_num的长度 != 1)
145  BUILD_BUG_ON - break compile if a condition is true(s_uuid的长度 != 16)
146  BUILD_BUG_ON - break compile if a condition is true(hkdf_info的长度 != 17)
147  hkdf_info[hkdf_infolen++]等于mode_num
148  如果include_fs_uuid
149  memcpy( & hkdf_info[hkdf_infolen], & s_uuid, s_uuid的长度)
151  hkdf_infolen加等于s_uuid的长度
153  err等于HKDF-Expand (RFC 5869 section 2
156  如果err则返回:err
158  tfm等于Create a symmetric cipher object for the given encryption mode and key
159  memzero_explicit - Fill a region of memory (e
160  如果是错误则返回:错误
164  prev_tfm等于cmpxchg( & tfms[mode_num], NULL, tfm)
165  如果(prev_tfm != NULL)则
166  rypto_free_skcipher() - zeroize and free cipher handle*@tfm: cipher handle to be freed
167  tfm等于prev_tfm
169  done :
170  The actual crypto transform used for encryption and decryption 等于tfm
171  返回:0
调用者
名称描述
fscrypt_setup_v2_file_key