aboutsummaryrefslogtreecommitdiffstats
path: root/security/integrity/evm/evm_crypto.c
diff options
context:
space:
mode:
authorMimi Zohar <zohar@linux.vnet.ibm.com>2011-03-09 14:40:44 -0500
committerMimi Zohar <zohar@linux.vnet.ibm.com>2011-07-18 12:29:45 -0400
commitcb72318069d5e92eb74840118732c66eb38c812f (patch)
treeeb4e9a6c923567e01ddd1340f9430eb3c43f4aeb /security/integrity/evm/evm_crypto.c
parent975d294373d8c1c913ad2bf4eb93966d4c7ca38f (diff)
evm: add evm_inode_init_security to initialize new files
Initialize 'security.evm' for new files. Changelog v7: - renamed evm_inode_post_init_security to evm_inode_init_security - moved struct xattr definition to earlier patch - allocate xattr name Changelog v6: - Use 'struct evm_ima_xattr_data' Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
Diffstat (limited to 'security/integrity/evm/evm_crypto.c')
-rw-r--r--security/integrity/evm/evm_crypto.c20
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
160int 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 */