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:Create a symmetric cipher object for the given encryption mode and key

Proto:struct crypto_skcipher *fscrypt_allocate_skcipher(struct fscrypt_mode *mode, const u8 *raw_key, const struct inode *inode)

Type:struct crypto_skcipher

Parameter:

TypeParameterName
struct fscrypt_mode *mode
const u8 *raw_key
const struct inode *inode
72  tfm = rypto_alloc_skcipher() - allocate symmetric key cipher handle*@alg_name: is the cra_name / name or cra_driver_name / driver name of the* skcipher cipher*@type: specifies the type of the cipher*@mask: specifies the mask for the cipher
73  If IS_ERR(tfm) Then
74  If PTR_ERR(tfm) == -ENOENT Then
75  fscrypt_warn(inode, "Missing crypto API support for %s (API name: \"%s\")", friendly_name, cipher_str)
78  Return ERR_PTR( - ENOPKG)
80  fscrypt_err(inode, "Error allocating '%s' transform: %ld", cipher_str, PTR_ERR(tfm))
82  Return tfm
84  If Not xchg( & logged_impl_name, 1) Then
91  pr_info("fscrypt: %s using implementation \"%s\"\n", friendly_name, cra_driver_name)
95  crypto_skcipher_set_flags(tfm, CRYPTO_TFM_REQ_FORBID_WEAK_KEYS)
96  err = rypto_skcipher_setkey() - set key for cipher*@tfm: cipher handle*@key: buffer holding the key*@keylen: length of the key in bytes* The caller provided key is set for the skcipher referenced by the cipher* handle.
97  If err Then Go to err_free_tfm
100  Return tfm
102  err_free_tfm :
103  rypto_free_skcipher() - zeroize and free cipher handle*@tfm: cipher handle to be freed
104  Return ERR_PTR(err)
Caller
NameDescribe
fscrypt_set_derived_keyGiven the per-file key, set up the file's crypto transform object
setup_per_mode_key
fscrypt_get_direct_keyPrepare to encrypt directly using the master key in the given mode