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:Prepare to encrypt directly using the master key in the given mode

Proto:static struct fscrypt_direct_key *fscrypt_get_direct_key(const struct fscrypt_info *ci, const u8 *raw_key)

Type:struct fscrypt_direct_key

Parameter:

TypeParameterName
const struct fscrypt_info *ci
const u8 *raw_key
224  dk = 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.
225  If dk Then Return dk
229  dk = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
230  If Not dk Then Return ERR_PTR( - ENOMEM)
232  _set - set a refcount's value*@r: the refcount*@n: value to which the refcount will be set
233  dk_mode = Encryption mode used for this inode. It corresponds to either the* contents or filenames encryption mode, depending on the inode type.
234  dk_ctfm = Create a symmetric cipher object for the given encryption mode and key
236  If IS_ERR(dk_ctfm) Then
237  err = PTR_ERR(dk_ctfm)
238  dk_ctfm = NULL
239  Go to err_free_dk
241  memcpy(dk_descriptor, master_key_descriptor, FSCRYPT_KEY_DESCRIPTOR_SIZE)
243  memcpy(dk_raw, raw_key, keysize)
245  Return 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.
247  err_free_dk :
248  free_direct_key(dk)
249  Return ERR_PTR(err)
Caller
NameDescribe
setup_v1_file_key_directv1 policy, DIRECT_KEY: use the master key directly