diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-25 03:45:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-25 03:45:31 -0400 |
commit | 36b8d186e6cc8e32cb5227f5645a58e1bc0af190 (patch) | |
tree | 1000ad26e189e6ff2c53fb7eeff605f59c7ad94e /security/integrity/ima/ima.h | |
parent | cd85b557414fe4cd44ea6608825e96612a5fe2b2 (diff) | |
parent | c45ed235abf1b0b6666417e3c394f18717976acd (diff) |
Merge branch 'next' of git://selinuxproject.org/~jmorris/linux-security
* 'next' of git://selinuxproject.org/~jmorris/linux-security: (95 commits)
TOMOYO: Fix incomplete read after seek.
Smack: allow to access /smack/access as normal user
TOMOYO: Fix unused kernel config option.
Smack: fix: invalid length set for the result of /smack/access
Smack: compilation fix
Smack: fix for /smack/access output, use string instead of byte
Smack: domain transition protections (v3)
Smack: Provide information for UDS getsockopt(SO_PEERCRED)
Smack: Clean up comments
Smack: Repair processing of fcntl
Smack: Rule list lookup performance
Smack: check permissions from user space (v2)
TOMOYO: Fix quota and garbage collector.
TOMOYO: Remove redundant tasklist_lock.
TOMOYO: Fix domain transition failure warning.
TOMOYO: Remove tomoyo_policy_memory_lock spinlock.
TOMOYO: Simplify garbage collector.
TOMOYO: Fix make namespacecheck warnings.
target: check hex2bin result
encrypted-keys: check hex2bin result
...
Diffstat (limited to 'security/integrity/ima/ima.h')
-rw-r--r-- | security/integrity/ima/ima.h | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/security/integrity/ima/ima.h b/security/integrity/ima/ima.h index 08408bd71462..3ccf7acac6df 100644 --- a/security/integrity/ima/ima.h +++ b/security/integrity/ima/ima.h | |||
@@ -24,18 +24,19 @@ | |||
24 | #include <linux/tpm.h> | 24 | #include <linux/tpm.h> |
25 | #include <linux/audit.h> | 25 | #include <linux/audit.h> |
26 | 26 | ||
27 | #include "../integrity.h" | ||
28 | |||
27 | enum ima_show_type { IMA_SHOW_BINARY, IMA_SHOW_ASCII }; | 29 | enum ima_show_type { IMA_SHOW_BINARY, IMA_SHOW_ASCII }; |
28 | enum tpm_pcrs { TPM_PCR0 = 0, TPM_PCR8 = 8 }; | 30 | enum tpm_pcrs { TPM_PCR0 = 0, TPM_PCR8 = 8 }; |
29 | 31 | ||
30 | /* digest size for IMA, fits SHA1 or MD5 */ | 32 | /* digest size for IMA, fits SHA1 or MD5 */ |
31 | #define IMA_DIGEST_SIZE 20 | 33 | #define IMA_DIGEST_SIZE SHA1_DIGEST_SIZE |
32 | #define IMA_EVENT_NAME_LEN_MAX 255 | 34 | #define IMA_EVENT_NAME_LEN_MAX 255 |
33 | 35 | ||
34 | #define IMA_HASH_BITS 9 | 36 | #define IMA_HASH_BITS 9 |
35 | #define IMA_MEASURE_HTABLE_SIZE (1 << IMA_HASH_BITS) | 37 | #define IMA_MEASURE_HTABLE_SIZE (1 << IMA_HASH_BITS) |
36 | 38 | ||
37 | /* set during initialization */ | 39 | /* set during initialization */ |
38 | extern int iint_initialized; | ||
39 | extern int ima_initialized; | 40 | extern int ima_initialized; |
40 | extern int ima_used_chip; | 41 | extern int ima_used_chip; |
41 | extern char *ima_hash; | 42 | extern char *ima_hash; |
@@ -96,34 +97,21 @@ static inline unsigned long ima_hash_key(u8 *digest) | |||
96 | return hash_long(*digest, IMA_HASH_BITS); | 97 | return hash_long(*digest, IMA_HASH_BITS); |
97 | } | 98 | } |
98 | 99 | ||
99 | /* iint cache flags */ | ||
100 | #define IMA_MEASURED 0x01 | ||
101 | |||
102 | /* integrity data associated with an inode */ | ||
103 | struct ima_iint_cache { | ||
104 | struct rb_node rb_node; /* rooted in ima_iint_tree */ | ||
105 | struct inode *inode; /* back pointer to inode in question */ | ||
106 | u64 version; /* track inode changes */ | ||
107 | unsigned char flags; | ||
108 | u8 digest[IMA_DIGEST_SIZE]; | ||
109 | struct mutex mutex; /* protects: version, flags, digest */ | ||
110 | }; | ||
111 | |||
112 | /* LIM API function definitions */ | 100 | /* LIM API function definitions */ |
113 | int ima_must_measure(struct inode *inode, int mask, int function); | 101 | int ima_must_measure(struct inode *inode, int mask, int function); |
114 | int ima_collect_measurement(struct ima_iint_cache *iint, struct file *file); | 102 | int ima_collect_measurement(struct integrity_iint_cache *iint, |
115 | void ima_store_measurement(struct ima_iint_cache *iint, struct file *file, | 103 | struct file *file); |
104 | void ima_store_measurement(struct integrity_iint_cache *iint, struct file *file, | ||
116 | const unsigned char *filename); | 105 | const unsigned char *filename); |
117 | int ima_store_template(struct ima_template_entry *entry, int violation, | 106 | int ima_store_template(struct ima_template_entry *entry, int violation, |
118 | struct inode *inode); | 107 | struct inode *inode); |
119 | void ima_template_show(struct seq_file *m, void *e, | 108 | void ima_template_show(struct seq_file *m, void *e, enum ima_show_type show); |
120 | enum ima_show_type show); | ||
121 | 109 | ||
122 | /* rbtree tree calls to lookup, insert, delete | 110 | /* rbtree tree calls to lookup, insert, delete |
123 | * integrity data associated with an inode. | 111 | * integrity data associated with an inode. |
124 | */ | 112 | */ |
125 | struct ima_iint_cache *ima_iint_insert(struct inode *inode); | 113 | struct integrity_iint_cache *integrity_iint_insert(struct inode *inode); |
126 | struct ima_iint_cache *ima_iint_find(struct inode *inode); | 114 | struct integrity_iint_cache *integrity_iint_find(struct inode *inode); |
127 | 115 | ||
128 | /* IMA policy related functions */ | 116 | /* IMA policy related functions */ |
129 | enum ima_hooks { FILE_CHECK = 1, FILE_MMAP, BPRM_CHECK }; | 117 | enum ima_hooks { FILE_CHECK = 1, FILE_MMAP, BPRM_CHECK }; |