Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\keys\big_key.c Create Date:2022-07-28 18:28:43
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:ad the key data* - the key's semaphore is read-locked

Proto:long big_key_read(const struct key *key, char __user *buffer, size_t buflen)

Type:long

Parameter:

TypeParameterName
const struct key *key
char __user *buffer
size_tbuflen
357  datalen = data[big_key_len]
360  If Not buffer || buflen < datalen Then Return datalen
363  If 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. Then
365  struct path * path = (struct path * ) & data[big_key_path]
367  enckey = data[big_key_data]
368  enclen = datalen + Authentication tag length
369  pos = 0
371  buf = Allocate a buffer consisting of a set of pages with a virtual mapping* applied over them.
372  If Not buf Then Return -ENOMEM
375  file = dentry_open(path, O_RDONLY, current_cred - Access the current task's subjective credentials* Access the subjective credentials of the current task. RCU-safe,* since nobody else can modify it.())
376  If IS_ERR(file) Then
377  ret = PTR_ERR(file)
378  Go to error
382  ret = kernel_read(file, virt, enclen, & pos)
383  If ret >= 0 && ret != enclen Then
384  ret = -EIO
385  Go to err_fput
388  ret = Encrypt/decrypt big_key data
389  If ret Then Go to err_fput
392  ret = datalen
395  If copy_to_user(buffer, virt, datalen) != 0 Then ret = -EFAULT
398  err_fput :
399  fput(file)
400  error :
401  Free up the buffer.
402  Else
403  ret = datalen
404  If copy_to_user(buffer, data[big_key_data], datalen) != 0 Then ret = -EFAULT
409  Return ret