Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:fscrypt_get_encryption_info

Proto:int fscrypt_get_encryption_info(struct inode *inode)

Type:int

Parameter:

TypeParameterName
struct inode *inode
362  struct key * master_key = NULL
365  If fscrypt_has_encryption_key(inode) Then Return 0
368  res = scrypt_initialize() - allocate major buffers for fs encryption
369  If res Then Return res
372  res = get_context(inode, & ctx, size of ctx )
373  If res < 0 Then
376  fscrypt_warn(inode, "Error %d getting encryption context", res)
379  Return res
382  memset( & ctx, 0, size of ctx )
383  version = FSCRYPT_CONTEXT_V1
384  contents_encryption_mode = Encryption algorithms
385  filenames_encryption_mode = FSCRYPT_MODE_AES_256_CTS
386  memset(master_key_descriptor, 0x42, FSCRYPT_KEY_DESCRIPTOR_SIZE)
388  res = size of v1
391  crypt_info = Shortcuts
392  If Not crypt_info Then Return -ENOMEM
395  Back-pointer to the inode = inode
397  res = fscrypt_policy_from_context( & The encryption policy used by this inode , & ctx, res)
398  If res Then
399  fscrypt_warn(inode, "Unrecognized or corrupt encryption context")
401  Go to out
405  Case version == FSCRYPT_CONTEXT_V1
408  Break
409  Case version == FSCRYPT_CONTEXT_V2
412  Break
413  Default
414  WARN_ON(1)
415  res = -EINVAL
416  Go to out
420  res = -EINVAL
421  Go to out
424  mode = select_encryption_mode( & The encryption policy used by this inode , inode)
425  If IS_ERR(mode) Then
426  res = PTR_ERR(mode)
427  Go to out
429  WARN_ON(ivsize > FSCRYPT_MAX_IV_SIZE)
430  Encryption mode used for this inode. It corresponds to either the* contents or filenames encryption mode, depending on the inode type. = mode
432  res = 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
433  If res Then Go to out
436  If (cmpxchg_release( & i_crypt_info, NULL, crypt_info) == NULL) Then
437  If master_key Then
448  crypt_info = NULL
450  res = 0
451  out :
452  If master_key Then
453  mk = data[0]
458  If res == -ENOKEY Then res = 0
460  put_crypt_info(crypt_info)
461  Return res
Caller
NameDescribe
fscrypt_setup_filenamescrypt_setup_filename() - prepare to search a possibly encrypted directory*@dir: the directory that will be searched*@iname: the user-provided filename being searched for*@lookup: 1 if we're allowed to proceed without the key because it's* ->lookup() or
__fscrypt_prepare_symlink
fscrypt_get_symlinkscrypt_get_symlink - get the target of an encrypted symlink*@inode: the symlink inode*@caddr: the on-disk contents of the symlink*@max_size: size of @caddr buffer*@done: if successful, will be set up to free the returned target if needed
fscrypt_has_permitted_contextscrypt_has_permitted_context() - is a file's encryption policy permitted* within its directory?*@parent: inode for parent directory*@child: inode for file being looked up, opened, or linked into @parent* Filesystems must call this before permitting access
fscrypt_inherit_contextscrypt_inherit_context() - Sets a child context from its parent*@parent: Parent inode from which the context is inherited
fscrypt_require_keyscrypt_require_key - require an inode's encryption key*@inode: the inode we need the key for* If the inode is encrypted, set up its encryption key if not already done
fscrypt_d_revalidateValidate dentries in encrypted directories to make sure we aren't potentially* caching stale dentries after a key has been added.