Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Encrypt or decrypt a single filesystem block of file contents

Proto:int fscrypt_crypt_block(const struct inode *inode, fscrypt_direction_t rw, u64 lblk_num, struct page *src_page, struct page *dest_page, unsigned int len, unsigned int offs, gfp_t gfp_flags)

Type:int

Parameter:

TypeParameterName
const struct inode *inode
fscrypt_direction_trw
u64lblk_num
struct page *src_page
struct page *dest_page
unsigned intlen
unsigned intoffs
gfp_tgfp_flags
96  struct skcipher_request * req = NULL
99  ci = i_crypt_info
100  tfm = The actual crypto transform used for encryption and decryption
101  res = 0
103  If WARN_ON_ONCE(len <= 0) Then Return -EINVAL
105  If WARN_ON_ONCE(len % ld names; don't add anything new here! != 0) Then Return -EINVAL
108  fscrypt_generate_iv( & iv, lblk_num, ci)
110  req = skcipher_request_alloc() - allocate request data structure*@tfm: cipher handle to be registered with the request*@gfp: memory allocation flag that is handed to kmalloc by the API call
111  If Not req Then Return -ENOMEM
114  skcipher_request_set_callback() - set asynchronous callback function*@req: request handle*@flags: specify zero or an ORing of the flags* CRYPTO_TFM_REQ_MAY_BACKLOG the request queue may back log and* increase the wait queue beyond the initial maximum
118  sg_init_table - Initialize SG table*@sgl: The SG table*@nents: Number of entries in table* Notes:* If this is part of a chained sg table, sg_mark_end() should be* used only on the last table part.
119  sg_set_page - Set sg entry to point at given page*@sg: SG entry*@page: The page*@len: Length of data*@offset: Offset into page* Description:* Use this function to set an sg entry pointing at a page, never assign* the page directly
120  sg_init_table - Initialize SG table*@sgl: The SG table*@nents: Number of entries in table* Notes:* If this is part of a chained sg table, sg_mark_end() should be* used only on the last table part.
121  sg_set_page - Set sg entry to point at given page*@sg: SG entry*@page: The page*@len: Length of data*@offset: Offset into page* Description:* Use this function to set an sg entry pointing at a page, never assign* the page directly
122  skcipher_request_set_crypt() - set data buffers*@req: request handle*@src: source scatter / gather list*@dst: destination scatter / gather list*@cryptlen: number of bytes to process from @src*@iv: IV for the cipher operation which must comply with the IV
123  If rw == FS_DECRYPT Then res = crypto_wait_req(rypto_skcipher_decrypt() - decrypt ciphertext*@req: reference to the skcipher_request handle that holds all information* needed to perform the cipher operation* Decrypt ciphertext data using the skcipher_request handle, & wait)
125  Else res = crypto_wait_req(rypto_skcipher_encrypt() - encrypt plaintext*@req: reference to the skcipher_request handle that holds all information* needed to perform the cipher operation* Encrypt plaintext data using the skcipher_request handle, & wait)
127  skcipher_request_free() - zeroize and free request data structure*@req: request data structure cipher handle to be freed
128  If res Then
129  fscrypt_err(inode, "%scryption failed for block %llu: %d", (rw == FS_DECRYPT ? "De" : "En"), lblk_num, res)
131  Return res
133  Return 0
Caller
NameDescribe
fscrypt_encrypt_pagecache_blocksscrypt_encrypt_pagecache_blocks() - Encrypt filesystem blocks from a pagecache page*@page: The locked pagecache page containing the block(s) to encrypt*@len: Total size of the block(s) to encrypt. Must be a nonzero* multiple of the filesystem's block size.
fscrypt_encrypt_block_inplacescrypt_encrypt_block_inplace() - Encrypt a filesystem block in-place*@inode: The inode to which this block belongs*@page: The page containing the block to encrypt*@len: Size of block to encrypt. Doesn't need to be a multiple of the
fscrypt_decrypt_pagecache_blocksscrypt_decrypt_pagecache_blocks() - Decrypt filesystem blocks in a pagecache page*@page: The locked pagecache page containing the block(s) to decrypt*@len: Total size of the block(s) to decrypt. Must be a nonzero* multiple of the filesystem's block size.
fscrypt_decrypt_block_inplacescrypt_decrypt_block_inplace() - Decrypt a filesystem block in-place*@inode: The inode to which this block belongs*@page: The page containing the block to decrypt*@len: Size of block to decrypt. Doesn't need to be a multiple of the
fscrypt_zeroout_range