diff options
Diffstat (limited to 'security/integrity/evm/evm_crypto.c')
-rw-r--r-- | security/integrity/evm/evm_crypto.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c index c631b99bda95..c9902bddcb9a 100644 --- a/security/integrity/evm/evm_crypto.c +++ b/security/integrity/evm/evm_crypto.c | |||
@@ -157,6 +157,26 @@ int evm_update_evmxattr(struct dentry *dentry, const char *xattr_name, | |||
157 | return rc; | 157 | return rc; |
158 | } | 158 | } |
159 | 159 | ||
160 | int evm_init_hmac(struct inode *inode, const struct xattr *lsm_xattr, | ||
161 | char *hmac_val) | ||
162 | { | ||
163 | struct hash_desc desc; | ||
164 | struct scatterlist sg[1]; | ||
165 | int error; | ||
166 | |||
167 | error = init_desc(&desc); | ||
168 | if (error != 0) { | ||
169 | printk(KERN_INFO "init_desc failed\n"); | ||
170 | return error; | ||
171 | } | ||
172 | |||
173 | sg_init_one(sg, lsm_xattr->value, lsm_xattr->value_len); | ||
174 | crypto_hash_update(&desc, sg, lsm_xattr->value_len); | ||
175 | hmac_add_misc(&desc, inode, hmac_val); | ||
176 | crypto_free_hash(desc.tfm); | ||
177 | return 0; | ||
178 | } | ||
179 | |||
160 | /* | 180 | /* |
161 | * Get the key from the TPM for the SHA1-HMAC | 181 | * Get the key from the TPM for the SHA1-HMAC |
162 | */ | 182 | */ |