函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\crypto\keysetup_v1.c Create Date:2022-07-29 10:57:42
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:v1 key derivation function

函数原型:static int derive_key_aes(const u8 *master_key, const u8 nonce[16], u8 *derived_key, unsigned int derived_keysize)

返回类型:int

参数:

类型参数名称
const u8 *master_key
const u8nonce
u8 *derived_key
unsigned intderived_keysize
51  res等于0
52  struct skcipher_request * req = NULL
55  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
57  如果是错误
58  res等于错误
59  tfm = NULL
60  转到:out
62  crypto_skcipher_set_flags(tfm, CRYPTO_TFM_REQ_FORBID_WEAK_KEYS)
63  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
64  如果非req
65  res等于负ENOMEM
66  转到:out
68  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
71  res等于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.
72  如果res小于0则转到:out
75  初始化散列表项目
76  初始化散列表项目
77  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
79  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)
80  out :
81  skcipher_request_free() - zeroize and free request data structure*@req: request data structure cipher handle to be freed
82  rypto_free_skcipher() - zeroize and free cipher handle*@tfm: cipher handle to be freed
83  返回:res
调用者
名称描述
setup_v1_file_key_derivedv1 policy, !DIRECT_KEY: derive the file's encryption key