aboutsummaryrefslogtreecommitdiffstats
path: root/security/integrity/integrity.h
diff options
context:
space:
mode:
authorDmitry Kasatkin <d.kasatkin@samsung.com>2013-04-25 03:43:56 -0400
committerMimi Zohar <zohar@linux.vnet.ibm.com>2013-10-25 17:16:58 -0400
commitc7c8bb237fdbff932b5e431aebee5ce862ea07d1 (patch)
tree4cdbc7c250dd4418b47ab45dd1108848b50f8cff /security/integrity/integrity.h
parent3fe78ca2fb1d61ea598e63fcbf38aec76b36b3a8 (diff)
ima: provide support for arbitrary hash algorithms
In preparation of supporting more hash algorithms with larger hash sizes needed for signature verification, this patch replaces the 20 byte sized digest, with a more flexible structure. The new structure includes the hash algorithm, digest size, and digest. Changelog: - recalculate filedata hash for the measurement list, if the signature hash digest size is greater than 20 bytes. - use generic HASH_ALGO_ - make ima_calc_file_hash static - scripts lindent and checkpatch fixes Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com> Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Diffstat (limited to 'security/integrity/integrity.h')
-rw-r--r--security/integrity/integrity.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/security/integrity/integrity.h b/security/integrity/integrity.h
index f86731649f54..0b02ea868e30 100644
--- a/security/integrity/integrity.h
+++ b/security/integrity/integrity.h
@@ -59,20 +59,29 @@ enum evm_ima_xattr_type {
59struct evm_ima_xattr_data { 59struct evm_ima_xattr_data {
60 u8 type; 60 u8 type;
61 u8 digest[SHA1_DIGEST_SIZE]; 61 u8 digest[SHA1_DIGEST_SIZE];
62} __attribute__((packed)); 62} __packed;
63
64#define IMA_MAX_DIGEST_SIZE 64
65
66struct ima_digest_data {
67 u8 algo;
68 u8 length;
69 u8 type;
70 u8 digest[IMA_MAX_DIGEST_SIZE];
71} __packed;
63 72
64/* integrity data associated with an inode */ 73/* integrity data associated with an inode */
65struct integrity_iint_cache { 74struct integrity_iint_cache {
66 struct rb_node rb_node; /* rooted in integrity_iint_tree */ 75 struct rb_node rb_node; /* rooted in integrity_iint_tree */
67 struct inode *inode; /* back pointer to inode in question */ 76 struct inode *inode; /* back pointer to inode in question */
68 u64 version; /* track inode changes */ 77 u64 version; /* track inode changes */
69 unsigned long flags; 78 unsigned long flags;
70 struct evm_ima_xattr_data ima_xattr;
71 enum integrity_status ima_file_status:4; 79 enum integrity_status ima_file_status:4;
72 enum integrity_status ima_mmap_status:4; 80 enum integrity_status ima_mmap_status:4;
73 enum integrity_status ima_bprm_status:4; 81 enum integrity_status ima_bprm_status:4;
74 enum integrity_status ima_module_status:4; 82 enum integrity_status ima_module_status:4;
75 enum integrity_status evm_status:4; 83 enum integrity_status evm_status:4;
84 struct ima_digest_data ima_hash;
76}; 85};
77 86
78/* rbtree tree calls to lookup, insert, delete 87/* rbtree tree calls to lookup, insert, delete