函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:init_desc

函数原型:static struct shash_desc *init_desc(char type, uint8_t hash_algo)

返回类型:struct shash_desc

参数:

类型参数名称
chartype
uint8_thash_algo
81  如果type恒等于EVM_XATTR_HMAC
82  如果非evm_initialized按位与EVM_INIT_HMAC的值则
83  pr_err_once("HMAC key is not set\n")
84  返回:错误号
86  tfm等于hmac_tfm
87  algo等于evm_hmac
88  否则
89  如果hash_algo大于等于HASH_ALGO__LAST则返回:错误号
92  tfm等于evm_tfm[hash_algo]
93  algo等于hash_algo_name[hash_algo]
96  如果( * tfm == NULL)则
97  mutex_lock( & mutex)
98  如果tfm则转到:out
100  tfm等于crypto_alloc_shash(algo, 0, Don't trigger module loading)
101  如果是错误
102  rc等于错误
103  打印错误信息("Can not allocate %s (reason: %ld)\n", algo, rc)
104  * tfm = NULL
106  返回:错误号
108  如果type恒等于EVM_XATTR_HMAC
110  如果rc
117  out :
118  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
121  desc等于开辟内存
123  如果非desc则返回:错误号
126  tfm等于tfm
128  rc等于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
129  如果rc
130  释放内存
131  返回:错误号
133  返回:desc
调用者
名称描述
evm_calc_hmac_or_hashCalculate the HMAC value across the set of protected security xattrs.* Instead of retrieving the requested xattr, for performance, calculate* the hmac using the requested xattr value. Don't alloc/free memory for
evm_init_hmac