函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Find the master key, then set up the inode's actual encryption key.* If the master key is found in the filesystem-level keyring, then the* corresponding 'struct key' is returned in *master_key_ret with* ->mk_secret_sem read-locked

函数原型:static int setup_file_encryption_key(struct fscrypt_info *ci, struct key **master_key_ret)

返回类型:int

参数:

类型参数名称
struct fscrypt_info *ci
struct key **master_key_ret
236  struct fscrypt_master_key * mk = NULL
241  :version恒等于Legacy policy version; ad-hoc KDF and no key verification.* For new encrypted directories, use fscrypt_policy_v2 instead.* Careful: the .version field for this is actually 0, not 1.
242  of FSCRYPT_KEY_SPEC_TYPE_* 等于v1 policy keys are specified by an arbitrary 8-byte key "descriptor",* matching fscrypt_policy_v1::master_key_descriptor.
243  memcpy(descriptor, master_key_descriptor, FSCRYPT_KEY_DESCRIPTOR_SIZE)
246  退出
247  :version恒等于New policy version with HKDF and key verification (recommended).
248  of FSCRYPT_KEY_SPEC_TYPE_* 等于v2 policy keys are specified by a 16-byte key "identifier" which the kernel* calculates as a cryptographic hash of the key itself,* matching fscrypt_policy_v2::master_key_identifier.
249  memcpy(identifier, master_key_identifier, FSCRYPT_KEY_IDENTIFIER_SIZE)
252  退出
253  默认
254  WARN_ON(1)
255  返回:负EINVAL
258  key等于Find the specified master key in ->s_master_keys.* Returns ERR_PTR(-ENOKEY) if not found.
259  如果是错误
260  如果key不等于错误号version不等于Legacy policy version; ad-hoc KDF and no key verification.* For new encrypted directories, use fscrypt_policy_v2 instead.* Careful: the .version field for this is actually 0, not 1.则返回:错误
270  返回:fscrypt_setup_v1_file_key_via_subscribed_keyrings(ci)
273  mk等于data[0]
274  lock for reading
277  如果非is_master_key_secret_present( & The secret key material. After FS_IOC_REMOVE_ENCRYPTION_KEY is* executed, this is wiped and no new inodes can be unlocked with this* key; however, there may still be inodes in ->mk_decrypted_inodes* which could not be evicted)则
278  err等于负ENOKEY
279  转到:out_release_key
288  如果Size of the raw key in bytes. Set even if ->raw isn't set. 小于keysize
289  fscrypt_warn(NULL, "key with %s %*phN is too short (got %u bytes, need %u+ bytes)", master_key_spec_type( & mk_spec), master_key_spec_len( & mk_spec), (u8 * ) & u, Size of the raw key in bytes. Set even if ->raw isn't set. , keysize)
294  err等于负ENOKEY
295  转到:out_release_key
301  退出
304  退出
305  默认
306  WARN_ON(1)
307  err等于负EINVAL
308  退出
310  如果err则转到:out_release_key
313  master_key_ret等于key
314  返回:0
316  out_release_key :
317  lease a read lock
318  key_put(key)
319  返回:err
调用者
名称描述
fscrypt_get_encryption_info