函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Add 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

函数原型:int fscrypt_ioctl_add_key(struct file *filp, void __user *_uarg)

返回类型:int

参数:

类型参数名称
struct file *filp
void __user *_uarg
494  sb等于i_sb
495  __useruarg等于_uarg
500  如果copy_from_user( & arg, uarg, arg的长度)则返回:负EFAULT
503  如果非valid_key_spec( & key_spec)则返回:负EINVAL
506  如果raw_size小于FSCRYPT_MIN_KEY_SIZEraw_size大于FSCRYPT_MAX_KEY_SIZE则返回:负EINVAL
510  如果memchr_inv - Find an unmatching character in an area of memory.*@start: The memory area*@c: Find a character other than c*@bytes: The size of the area.* returns the address of the first character other than @c, or %NULL则返回:负EINVAL
513  memset( & secret, 0, secret的长度)
514  Size of the raw key in bytes. Set even if ->raw isn't set. 等于raw_size
515  err等于负EFAULT
516  如果copy_from_user(For v1 policy keys: the raw key. Wiped for v2 policy keys. , raw, Size of the raw key in bytes. Set even if ->raw isn't set. )则转到:out_wipe_secret
520  : of FSCRYPT_KEY_SPEC_TYPE_* 恒等于v1 policy keys are specified by an arbitrary 8-byte key "descriptor",* matching fscrypt_policy_v1::master_key_descriptor.
526  err等于负EACCES
527  如果非操作权限检查则转到:out_wipe_secret
529  退出
530  : of FSCRYPT_KEY_SPEC_TYPE_* 恒等于v2 policy keys are specified by a 16-byte key "identifier" which the kernel* calculates as a cryptographic hash of the key itself,* matching fscrypt_policy_v2::master_key_identifier.
531  err等于Compute HKDF-Extract using the given master key as the input keying material,* and prepare an HMAC transform object keyed by the resulting pseudorandom key.* Afterwards, the keyed HMAC transform object can be used for HKDF-Expand many
532  如果err则转到:out_wipe_secret
539  memzero_explicit - Fill a region of memory (e
542  err等于HKDF-Expand (RFC 5869 section 2
546  如果err则转到:out_wipe_secret
548  err等于负EFAULT
549  如果copy_to_user(identifier, identifier, FSCRYPT_KEY_IDENTIFIER_SIZE)则转到:out_wipe_secret
553  退出
554  默认
555  WARN_ON(1)
556  err等于负EINVAL
557  转到:out_wipe_secret
560  err等于add_master_key(sb, & secret, & key_spec)
561  out_wipe_secret :
562  wipe_master_key_secret( & secret)
563  返回:err