blob: 2271939c5c3140d2ca80efb68b5e6e6c99e7098c [file] [log] [blame]
Thomas Gleixnerb886d832019-06-01 10:08:55 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Mimi Zoharf381c272011-03-09 14:13:22 -05002/*
3 * Copyright (C) 2009 IBM Corporation
4 * Author: Mimi Zohar <zohar@us.ibm.com>
Mimi Zoharf381c272011-03-09 14:13:22 -05005 */
6
7#ifndef _LINUX_INTEGRITY_H
8#define _LINUX_INTEGRITY_H
9
10#include <linux/fs.h>
11
Mimi Zohar66dbc3252011-03-15 16:12:09 -040012enum integrity_status {
13 INTEGRITY_PASS = 0,
Matthew Garrett50b97742017-11-07 07:17:42 -080014 INTEGRITY_PASS_IMMUTABLE,
Mimi Zohar66dbc3252011-03-15 16:12:09 -040015 INTEGRITY_FAIL,
16 INTEGRITY_NOLABEL,
Mimi Zohar566be592011-08-22 09:14:18 -040017 INTEGRITY_NOXATTRS,
Mimi Zohar66dbc3252011-03-15 16:12:09 -040018 INTEGRITY_UNKNOWN,
19};
20
Dmitry Kasatkin6be5cc52011-03-09 14:28:20 -050021/* List of EVM protected security xattrs */
Mimi Zoharf381c272011-03-09 14:13:22 -050022#ifdef CONFIG_INTEGRITY
Dmitry Kasatkinbf2276d2011-10-19 12:04:40 +030023extern struct integrity_iint_cache *integrity_inode_get(struct inode *inode);
Mimi Zoharf381c272011-03-09 14:13:22 -050024extern void integrity_inode_free(struct inode *inode);
Dmitry Kasatkinc9cd2ce2014-11-05 17:01:15 +020025extern void __init integrity_load_keys(void);
Mimi Zoharf381c272011-03-09 14:13:22 -050026
27#else
Dmitry Kasatkinbf2276d2011-10-19 12:04:40 +030028static inline struct integrity_iint_cache *
29 integrity_inode_get(struct inode *inode)
Mimi Zoharf381c272011-03-09 14:13:22 -050030{
Dmitry Kasatkinbf2276d2011-10-19 12:04:40 +030031 return NULL;
Mimi Zoharf381c272011-03-09 14:13:22 -050032}
33
34static inline void integrity_inode_free(struct inode *inode)
35{
36 return;
37}
Dmitry Kasatkinc9cd2ce2014-11-05 17:01:15 +020038
39static inline void integrity_load_keys(void)
40{
41}
Paul Bollee05a4f42013-03-25 21:12:27 +010042#endif /* CONFIG_INTEGRITY */
Dmitry Kasatkinc9cd2ce2014-11-05 17:01:15 +020043
Mikhail Kurinnoi6eb864c2018-06-27 16:33:42 +030044#ifdef CONFIG_INTEGRITY_ASYMMETRIC_KEYS
45
46extern int integrity_kernel_module_request(char *kmod_name);
47
48#else
49
50static inline int integrity_kernel_module_request(char *kmod_name)
51{
52 return 0;
53}
54
55#endif /* CONFIG_INTEGRITY_ASYMMETRIC_KEYS */
56
Mimi Zoharf381c272011-03-09 14:13:22 -050057#endif /* _LINUX_INTEGRITY_H */