ima.h (f26e8817b235d8764363bffcc9cbfc61867371f2) ima.h (94c3aac567a9ddb9e868a7fae3c927c08b51b7c6)
1/*
2 * Copyright (C) 2005,2006,2007,2008 IBM Corporation
3 *
4 * Authors:
5 * Reiner Sailer <sailer@watson.ibm.com>
6 * Mimi Zohar <zohar@us.ibm.com>
7 *
8 * This program is free software; you can redistribute it and/or

--- 14 unchanged lines hidden (view full) ---

23#include <linux/security.h>
24#include <linux/hash.h>
25#include <linux/tpm.h>
26#include <linux/audit.h>
27#include <crypto/hash_info.h>
28
29#include "../integrity.h"
30
1/*
2 * Copyright (C) 2005,2006,2007,2008 IBM Corporation
3 *
4 * Authors:
5 * Reiner Sailer <sailer@watson.ibm.com>
6 * Mimi Zohar <zohar@us.ibm.com>
7 *
8 * This program is free software; you can redistribute it and/or

--- 14 unchanged lines hidden (view full) ---

23#include <linux/security.h>
24#include <linux/hash.h>
25#include <linux/tpm.h>
26#include <linux/audit.h>
27#include <crypto/hash_info.h>
28
29#include "../integrity.h"
30
31#ifdef CONFIG_HAVE_IMA_KEXEC
32#include <asm/ima.h>
33#endif
34
31enum ima_show_type { IMA_SHOW_BINARY, IMA_SHOW_BINARY_NO_FIELD_LEN,
32 IMA_SHOW_BINARY_OLD_STRING_FMT, IMA_SHOW_ASCII };
33enum tpm_pcrs { TPM_PCR0 = 0, TPM_PCR8 = 8 };
34
35/* digest size for IMA, fits SHA1 or MD5 */
36#define IMA_DIGEST_SIZE SHA1_DIGEST_SIZE
37#define IMA_EVENT_NAME_LEN_MAX 255
38

--- 58 unchanged lines hidden (view full) ---

97
98struct ima_queue_entry {
99 struct hlist_node hnext; /* place in hash collision list */
100 struct list_head later; /* place in ima_measurements list */
101 struct ima_template_entry *entry;
102};
103extern struct list_head ima_measurements; /* list of all measurements */
104
35enum ima_show_type { IMA_SHOW_BINARY, IMA_SHOW_BINARY_NO_FIELD_LEN,
36 IMA_SHOW_BINARY_OLD_STRING_FMT, IMA_SHOW_ASCII };
37enum tpm_pcrs { TPM_PCR0 = 0, TPM_PCR8 = 8 };
38
39/* digest size for IMA, fits SHA1 or MD5 */
40#define IMA_DIGEST_SIZE SHA1_DIGEST_SIZE
41#define IMA_EVENT_NAME_LEN_MAX 255
42

--- 58 unchanged lines hidden (view full) ---

101
102struct ima_queue_entry {
103 struct hlist_node hnext; /* place in hash collision list */
104 struct list_head later; /* place in ima_measurements list */
105 struct ima_template_entry *entry;
106};
107extern struct list_head ima_measurements; /* list of all measurements */
108
109/* Some details preceding the binary serialized measurement list */
110struct ima_kexec_hdr {
111 u16 version;
112 u16 _reserved0;
113 u32 _reserved1;
114 u64 buffer_size;
115 u64 count;
116};
117
118#ifdef CONFIG_HAVE_IMA_KEXEC
119void ima_load_kexec_buffer(void);
120#else
121static inline void ima_load_kexec_buffer(void) {}
122#endif /* CONFIG_HAVE_IMA_KEXEC */
123
105/* Internal IMA function definitions */
106int ima_init(void);
107int ima_fs_init(void);
108int ima_add_template_entry(struct ima_template_entry *entry, int violation,
109 const char *op, struct inode *inode,
110 const unsigned char *filename);
111int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash);
112int ima_calc_buffer_hash(const void *buf, loff_t len,

--- 4 unchanged lines hidden (view full) ---

117int __init ima_calc_boot_aggregate(struct ima_digest_data *hash);
118void ima_add_violation(struct file *file, const unsigned char *filename,
119 struct integrity_iint_cache *iint,
120 const char *op, const char *cause);
121int ima_init_crypto(void);
122void ima_putc(struct seq_file *m, void *data, int datalen);
123void ima_print_digest(struct seq_file *m, u8 *digest, u32 size);
124struct ima_template_desc *ima_template_desc_current(void);
124/* Internal IMA function definitions */
125int ima_init(void);
126int ima_fs_init(void);
127int ima_add_template_entry(struct ima_template_entry *entry, int violation,
128 const char *op, struct inode *inode,
129 const unsigned char *filename);
130int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash);
131int ima_calc_buffer_hash(const void *buf, loff_t len,

--- 4 unchanged lines hidden (view full) ---

136int __init ima_calc_boot_aggregate(struct ima_digest_data *hash);
137void ima_add_violation(struct file *file, const unsigned char *filename,
138 struct integrity_iint_cache *iint,
139 const char *op, const char *cause);
140int ima_init_crypto(void);
141void ima_putc(struct seq_file *m, void *data, int datalen);
142void ima_print_digest(struct seq_file *m, u8 *digest, u32 size);
143struct ima_template_desc *ima_template_desc_current(void);
144int ima_restore_measurement_entry(struct ima_template_entry *entry);
145int ima_restore_measurement_list(loff_t bufsize, void *buf);
125int ima_init_template(void);
126
127/*
128 * used to protect h_table and sha_table
129 */
130extern spinlock_t ima_queue_lock;
131
132struct ima_h_table {

--- 154 unchanged lines hidden ---
146int ima_init_template(void);
147
148/*
149 * used to protect h_table and sha_table
150 */
151extern spinlock_t ima_queue_lock;
152
153struct ima_h_table {

--- 154 unchanged lines hidden ---