16 #include <linux/kernel.h>
21 #include <linux/slab.h>
29 if (IS_ERR(desc->
tfm)) {
30 pr_info(
"IMA: failed to load %s transform: %ld\n",
32 rc = PTR_ERR(desc->
tfm);
36 rc = crypto_hash_init(desc);
38 crypto_free_hash(desc->
tfm);
53 rc = init_desc(&desc);
66 i_size = i_size_read(file->f_dentry->d_inode);
67 while (offset < i_size) {
80 rc = crypto_hash_update(&desc, sg, rbuf_len);
86 rc = crypto_hash_final(&desc, digest);
90 crypto_free_hash(desc.
tfm);
103 rc = init_desc(&desc);
108 rc = crypto_hash_update(&desc, sg, template_len);
110 rc = crypto_hash_final(&desc, digest);
111 crypto_free_hash(desc.
tfm);
121 pr_err(
"IMA: Error Communicating to TPM chip\n");
134 rc = init_desc(&desc);
140 ima_pcrread(i, pcr_i);
146 crypto_hash_final(&desc, digest);
147 crypto_free_hash(desc.
tfm);