Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\integrity\evm\evm_crypto.c Create Date:2022-07-28 20:00:08
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:init_desc

Proto:static struct shash_desc *init_desc(char type, uint8_t hash_algo)

Type:struct shash_desc

Parameter:

TypeParameterName
chartype
uint8_thash_algo
81  If type == EVM_XATTR_HMAC Then
82  If Not (evm_initialized & EVM_INIT_HMAC) Then
83  pr_err_once("HMAC key is not set\n")
84  Return ERR_PTR( - ENOKEY)
86  tfm = hmac_tfm
87  algo = evm_hmac
88  Else
89  If hash_algo >= HASH_ALGO__LAST Then Return ERR_PTR( - EINVAL)
92  tfm = evm_tfm[hash_algo]
93  algo = hash_algo_name[hash_algo]
96  If ( * tfm == NULL) Then
97  mutex_lock( & mutex)
98  If tfm Then Go to out
100  tfm = crypto_alloc_shash(algo, 0, Don't trigger module loading)
101  If IS_ERR( * tfm) Then
102  rc = PTR_ERR( * tfm)
103  pr_err("Can not allocate %s (reason: %ld)\n", algo, rc)
104  * tfm = NULL
106  Return ERR_PTR(rc)
108  If type == EVM_XATTR_HMAC Then
110  If rc Then
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 = Allocation memory
123  If Not desc Then Return ERR_PTR( - ENOMEM)
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  If rc Then
130  kfree(desc)
131  Return ERR_PTR(rc)
133  Return desc
Caller
NameDescribe
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