函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

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

函数原型:static int evm_calc_hmac_or_hash(struct dentry *dentry, const char *req_xattr_name, const char *req_xattr_value, size_t req_xattr_value_len, uint8_t type, struct evm_digest *data)

返回类型:int

参数:

类型参数名称
struct dentry *dentry
const char *req_xattr_name
const char *req_xattr_value
size_treq_xattr_value_len
uint8_ttype
struct evm_digest *data
192  inode等于d_backing_inode - Get upper or lower inode we should be using*@upper: The upper layer* This is the helper that should be used to get at the inode that will be used* if this dentry were to be opened as a file. The inode may be on the upper
195  xattr_size等于0
196  char * xattr_value = NULL
199  bool ima_present = false
201  如果非i_opflags按位与IOP_XATTR的值或s_user_ns不等于userns count is 1 for root user, 1 for init_uts_ns,* and 1 for... ?则返回:负EOPNOTSUPP
205  desc等于init_desc(type, algo)
206  如果是错误则返回:错误
209  length等于获得消息文摘大小
211  error等于负ENODATA
213  bool is_ima = false
215  如果字符串比较恒等于0则is_ima = true
218  如果req_xattr_namereq_xattr_value且非字符串比较
220  error等于0
221  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
223  如果is_imaima_present = true
225  继续下一循环
227  size等于vfs_getxattr_alloc(dentry, name, & xattr_value, xattr_size, GFP_NOFS)
229  如果size恒等于负ENOMEM
230  error等于负ENOMEM
231  转到:out
233  如果size小于0则继续下一循环
236  error等于0
237  xattr_size等于size
238  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
239  如果is_imaima_present = true
242  Protect against 'cutting & pasting' security.evm xattr, include inode* specific info.* (Additional directory/file metadata needs to be added for more complete* protection.)
245  如果type恒等于EVM_XATTR_PORTABLE_DIGSIG且非ima_present则返回:负EPERM
247  out :
248  释放内存
249  释放内存
250  返回:error
调用者
名称描述
evm_calc_hmac
evm_calc_hash