函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:HKDF-Expand (RFC 5869 section 2

函数原型:int fscrypt_hkdf_expand(struct fscrypt_hkdf *hkdf, u8 context, const u8 *info, unsigned int infolen, u8 *okm, unsigned int okmlen)

返回类型:int

参数:

类型参数名称
struct fscrypt_hkdf *hkdf
u8context
const u8 *info
unsigned intinfolen
u8 *okm
unsigned intokmlen
119  SHASH_DESC_ON_STACK(desc, hmac_tfm)
123  const u8 * prev = NULL
124  counter等于1
127  如果WARN_ON(okmlen > 255 * HKDF_HASHLEN)则返回:负EINVAL
130  tfm等于hmac_tfm
132  memcpy(prefix, "fscrypt\0", 8)
133  prefix[8]等于context
135 i小于okmlen循环
137  err等于rypto_shash_init() - (re)initialize message digest*@desc: operational state handle that is already filled* The call (re-)initializes the message digest referenced by the* operational state handle. Any potentially existing state created by
138  如果err则转到:out
141  如果prev
143  如果err则转到:out
147  err等于rypto_shash_update() - add data to message digest for processing*@desc: operational state handle that is already initialized*@data: input data to be added to the message digest*@len: length of the input data
148  如果err则转到:out
151  err等于rypto_shash_update() - add data to message digest for processing*@desc: operational state handle that is already initialized*@data: input data to be added to the message digest*@len: length of the input data
152  如果err则转到:out
155  BUILD_BUG_ON - break compile if a condition is true(counter的长度 != 1)
156  如果okmleni小于HKDF_HASHLEN
158  如果err则转到:out
160  memcpy( & okm[i], tmp, okmlen - i)
162  否则
164  如果err则转到:out
167  counter自加
168  prev等于okm[i]
170  err等于0
171  out :
172  如果此条件成立可能性小(为编译器优化)(err)则memzero_explicit - Fill a region of memory (e
174  shash_desc_zero(desc)
175  返回:err
调用者
名称描述
fscrypt_ioctl_add_keyAdd a master encryption key to the filesystem, causing all files which were* encrypted with it to appear "unlocked" (decrypted) when accessed.* When adding a key for use by v1 encryption policies, this ioctl is
setup_per_mode_key
fscrypt_setup_v2_file_key