函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\keys\encrypted-keys\encrypted.c Create Date:2022-07-27 20:07:16
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Before returning data to userspace, encrypt decrypted data.

函数原型:static int derived_key_encrypt(struct encrypted_key_payload *epayload, const u8 *derived_key, unsigned int derived_keylen)

返回类型:int

参数:

类型参数名称
struct encrypted_key_payload *epayload
const u8 *derived_key
unsigned intderived_keylen
470  encrypted_datalen等于undup - round up to the next specified multiple*@x: the value to up*@y: multiple to round up to* Rounds @x up to next multiple of @y. If @y will always be a power* of 2, consider using the faster round_up().( decrypted data length , blksize)
472  req等于init_skcipher_req(derived_key, derived_keylen)
473  ret等于错误
474  如果是错误则转到:out
476  dump_decrypted_data(epayload)
478  初始化散列表
479  设置sg数据入口
481  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
483  初始化散列表
484  设置sg数据入口
486  memcpy(iv, datablob: iv , iv的长度)
487  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
488  ret等于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
489  tfm等于rypto_skcipher_reqtfm() - obtain cipher handle from request*@req: skcipher_request out of which the cipher handle is to be obtained* Return the crypto_skcipher handle when furnishing an skcipher_request* data structure.* Return: crypto_skcipher handle
490  skcipher_request_free() - zeroize and free request data structure*@req: request data structure cipher handle to be freed
491  rypto_free_skcipher() - zeroize and free cipher handle*@tfm: cipher handle to be freed
492  如果ret小于0则打印错误信息("encrypted_key: failed to encrypt (%d)\n", ret)
494  否则dump_encrypted_data(epayload, encrypted_datalen)
496  out :
497  返回:ret
调用者
名称描述
encrypted_readrypted_read - format and copy the encrypted data to userspace* The resulting datablob format is:* * On success, return to userspace the encrypted key datablob size.