Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:setup_per_mode_key

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

Type:int

Parameter:

TypeParameterName
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 = mode - available_modes
133  hkdf_infolen = 0
136  If WARN_ON(mode_num > __FSCRYPT_MODE_MAX) Then Return -EINVAL
140  tfm = READ_ONCE(tfms[mode_num])
141  If Value is more likely to compile time(tfm != NULL) Then Go to done
144  BUILD_BUG_ON - break compile if a condition is true( size of mode_num != 1)
145  BUILD_BUG_ON - break compile if a condition is true( size of s_uuid != 16)
146  BUILD_BUG_ON - break compile if a condition is true( size of hkdf_info != 17)
147  hkdf_info[hkdf_infolen++] = mode_num
148  If include_fs_uuid Then
149  memcpy( & hkdf_info[hkdf_infolen], & s_uuid, size of s_uuid )
151  hkdf_infolen += size of s_uuid
153  err = HKDF-Expand (RFC 5869 section 2
156  If err Then Return 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  If IS_ERR(tfm) Then Return PTR_ERR(tfm)
164  prev_tfm = cmpxchg( & tfms[mode_num], NULL, tfm)
165  If (prev_tfm != NULL) Then
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  Return 0
Caller
NameDescribe
fscrypt_setup_v2_file_key