#include <linux/kernel.h>
#include <linux/moduleparam.h>
#include <linux/ratelimit.h>
#include <linux/file.h>
#include <linux/crypto.h>
#include <linux/scatterlist.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <crypto/hash.h>
#include "ima.h"
static unsigned long ima_ahash_minsize;
module_param_named(ahash_minsize, ima_ahash_minsize, ulong, 0644);
MODULE_PARM_DESC(…) …;
static int ima_maxorder;
static unsigned int ima_bufsize = …;
static int param_set_bufsize(const char *val, const struct kernel_param *kp)
{ … }
static const struct kernel_param_ops param_ops_bufsize = …;
#define param_check_bufsize(name, p) …
module_param_named(ahash_bufsize, ima_bufsize, bufsize, 0644);
MODULE_PARM_DESC(…) …;
static struct crypto_shash *ima_shash_tfm;
static struct crypto_ahash *ima_ahash_tfm;
int ima_sha1_idx __ro_after_init;
int ima_hash_algo_idx __ro_after_init;
int ima_extra_slots __ro_after_init;
struct ima_algo_desc *ima_algo_array __ro_after_init;
static int __init ima_init_ima_crypto(void)
{ … }
static struct crypto_shash *ima_alloc_tfm(enum hash_algo algo)
{ … }
int __init ima_init_crypto(void)
{ … }
static void ima_free_tfm(struct crypto_shash *tfm)
{ … }
static void *ima_alloc_pages(loff_t max_size, size_t *allocated_size,
int last_warn)
{ … }
static void ima_free_pages(void *ptr, size_t size)
{ … }
static struct crypto_ahash *ima_alloc_atfm(enum hash_algo algo)
{ … }
static void ima_free_atfm(struct crypto_ahash *tfm)
{ … }
static inline int ahash_wait(int err, struct crypto_wait *wait)
{ … }
static int ima_calc_file_hash_atfm(struct file *file,
struct ima_digest_data *hash,
struct crypto_ahash *tfm)
{ … }
static int ima_calc_file_ahash(struct file *file, struct ima_digest_data *hash)
{ … }
static int ima_calc_file_hash_tfm(struct file *file,
struct ima_digest_data *hash,
struct crypto_shash *tfm)
{ … }
static int ima_calc_file_shash(struct file *file, struct ima_digest_data *hash)
{ … }
int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash)
{ … }
static int ima_calc_field_array_hash_tfm(struct ima_field_data *field_data,
struct ima_template_entry *entry,
int tfm_idx)
{ … }
int ima_calc_field_array_hash(struct ima_field_data *field_data,
struct ima_template_entry *entry)
{ … }
static int calc_buffer_ahash_atfm(const void *buf, loff_t len,
struct ima_digest_data *hash,
struct crypto_ahash *tfm)
{ … }
static int calc_buffer_ahash(const void *buf, loff_t len,
struct ima_digest_data *hash)
{ … }
static int calc_buffer_shash_tfm(const void *buf, loff_t size,
struct ima_digest_data *hash,
struct crypto_shash *tfm)
{ … }
static int calc_buffer_shash(const void *buf, loff_t len,
struct ima_digest_data *hash)
{ … }
int ima_calc_buffer_hash(const void *buf, loff_t len,
struct ima_digest_data *hash)
{ … }
static void ima_pcrread(u32 idx, struct tpm_digest *d)
{ … }
static int ima_calc_boot_aggregate_tfm(char *digest, u16 alg_id,
struct crypto_shash *tfm)
{ … }
int ima_calc_boot_aggregate(struct ima_digest_data *hash)
{ … }