~ubuntu-branches/ubuntu/precise/linux-lowlatency/precise

« back to all changes in this revision

Viewing changes to security/integrity/ima/ima_queue.c

  • Committer: Package Import Robot
  • Author(s): Alessio Igor Bogani
  • Date: 2011-10-26 11:13:05 UTC
  • Revision ID: package-import@ubuntu.com-20111026111305-04kado7d1u2er2rl
Tags: 3.2.0-16.25
Add new lowlatency kernel flavour

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include <linux/slab.h>
24
24
#include "ima.h"
25
25
 
 
26
#define AUDIT_CAUSE_LEN_MAX 32
 
27
 
26
28
LIST_HEAD(ima_measurements);    /* list of all measurements */
27
29
 
28
30
/* key: inode (before secure-hashing a file) */
94
96
 
95
97
        result = tpm_pcr_extend(TPM_ANY_NUM, CONFIG_IMA_MEASURE_PCR_IDX, hash);
96
98
        if (result != 0)
97
 
                pr_err("IMA: Error Communicating to TPM chip\n");
 
99
                pr_err("IMA: Error Communicating to TPM chip, result: %d\n",
 
100
                       result);
98
101
        return result;
99
102
}
100
103
 
106
109
{
107
110
        u8 digest[IMA_DIGEST_SIZE];
108
111
        const char *audit_cause = "hash_added";
 
112
        char tpm_audit_cause[AUDIT_CAUSE_LEN_MAX];
109
113
        int audit_info = 1;
110
 
        int result = 0;
 
114
        int result = 0, tpmresult = 0;
111
115
 
112
116
        mutex_lock(&ima_extend_list_mutex);
113
117
        if (!violation) {
114
118
                memcpy(digest, entry->digest, sizeof digest);
115
119
                if (ima_lookup_digest_entry(digest)) {
116
120
                        audit_cause = "hash_exists";
 
121
                        result = -EEXIST;
117
122
                        goto out;
118
123
                }
119
124
        }
128
133
        if (violation)          /* invalidate pcr */
129
134
                memset(digest, 0xff, sizeof digest);
130
135
 
131
 
        result = ima_pcr_extend(digest);
132
 
        if (result != 0) {
133
 
                audit_cause = "TPM error";
 
136
        tpmresult = ima_pcr_extend(digest);
 
137
        if (tpmresult != 0) {
 
138
                snprintf(tpm_audit_cause, AUDIT_CAUSE_LEN_MAX, "TPM_error(%d)",
 
139
                         tpmresult);
 
140
                audit_cause = tpm_audit_cause;
134
141
                audit_info = 0;
135
142
        }
136
143
out: