函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Preparse a big key

函数原型:int big_key_preparse(struct key_preparsed_payload *prep)

返回类型:int

参数:

类型参数名称
struct key_preparsed_payload *prep
203  struct path * path = (struct path * ) & Raw data [big_key_path]
207  datalen等于Raw datalen , enclen等于datalen加Authentication tag length
210  如果datalen小于等于0或datalen大于1024乘1024或非Raw data 则返回:负EINVAL
214  Quota length for proposed payload 等于16
216  Raw data [big_key_len]等于datalen
218  如果datalen大于If the data is under this limit, there's no point creating a shm file to* hold it as the permanently resident metadata for the shmem fs will be at* least as large as the data.
224  pos等于0
226  buf等于Allocate a buffer consisting of a set of pages with a virtual mapping* applied over them.
227  如果非buf则返回:负ENOMEM
229  memcpy(virt, Raw data , datalen)
232  enckey等于开辟内存
233  如果非enckey
234  ret等于负ENOMEM
235  转到:error
237  ret等于Calls wait_for_random_bytes() and then calls get_random_bytes(buf, nbytes).* Returns the result of the call to wait_for_random_bytes.
238  如果此条件成立可能性小(为编译器优化)(ret)则转到:err_enckey
242  ret等于Encrypt/decrypt big_key data
243  如果ret则转到:err_enckey
247  file等于shmem_kernel_file_setup - get an unlinked file living in tmpfs which must be* kernel internal. There will be NO LSM permission checks against the* underlying inode. So users of this interface must do LSM checks at a* higher layer
248  如果是错误
249  ret等于错误
250  转到:err_enckey
253  written等于kernel_write(file, virt, enclen, & pos)
254  如果written不等于enclen
255  ret等于written
256  如果written大于等于0则ret等于负ENOMEM
258  转到:err_fput
264  Raw data [big_key_data]等于enckey
265  path等于f_path
266  path_get(path)
267  fput(file)
268  Free up the buffer.
269  否则
271  data等于开辟内存
273  如果非data则返回:负ENOMEM
276  Raw data [big_key_data]等于data
277  memcpy(data, Raw data , Raw datalen )
279  返回:0
281  err_fput :
282  fput(file)
283  err_enckey :
284  kzfree - like kfree but zero memory*@p: object to free memory of* The memory of the object @p points to is zeroed before freed.* If @p is %NULL, kzfree() does nothing.* Note: this function zeroes the whole allocated buffer which can be a good
285  error :
286  Free up the buffer.
287  返回:ret