21 #include <linux/module.h>
23 #include <linux/slab.h>
26 #define AUDIT_CAUSE_LEN_MAX 32
51 key = ima_hash_key(digest_value);
53 hlist_for_each_entry_rcu(qe, pos, &ima_htable.
queue[key], hnext) {
76 pr_err(
"IMA: OUT OF MEMORY ERROR creating queue entry.\n");
81 INIT_LIST_HEAD(&qe->
later);
82 list_add_tail_rcu(&qe->
later, &ima_measurements);
84 atomic_long_inc(&ima_htable.
len);
85 key = ima_hash_key(entry->
digest);
86 hlist_add_head_rcu(&qe->
hnext, &ima_htable.
queue[key]);
90 static int ima_pcr_extend(
const u8 *
hash)
99 pr_err(
"IMA: Error Communicating to TPM chip, result: %d\n",
111 const char *audit_cause =
"hash_added";
114 int result = 0, tpmresult = 0;
119 if (ima_lookup_digest_entry(digest)) {
120 audit_cause =
"hash_exists";
126 result = ima_add_digest_entry(entry);
128 audit_cause =
"ENOMEM";
134 memset(digest, 0xff,
sizeof digest);
136 tpmresult = ima_pcr_extend(digest);
137 if (tpmresult != 0) {
140 audit_cause = tpm_audit_cause;
147 op, audit_cause, result, audit_info);