Thomas Gleixner | b886d83 | 2019-06-01 10:08:55 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Mimi Zohar | f381c27 | 2011-03-09 14:13:22 -0500 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2009 IBM Corporation |
| 4 | * Author: Mimi Zohar <zohar@us.ibm.com> |
Mimi Zohar | f381c27 | 2011-03-09 14:13:22 -0500 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef _LINUX_INTEGRITY_H |
| 8 | #define _LINUX_INTEGRITY_H |
| 9 | |
| 10 | #include <linux/fs.h> |
| 11 | |
Mimi Zohar | 66dbc325 | 2011-03-15 16:12:09 -0400 | [diff] [blame] | 12 | enum integrity_status { |
| 13 | INTEGRITY_PASS = 0, |
Matthew Garrett | 50b9774 | 2017-11-07 07:17:42 -0800 | [diff] [blame] | 14 | INTEGRITY_PASS_IMMUTABLE, |
Mimi Zohar | 66dbc325 | 2011-03-15 16:12:09 -0400 | [diff] [blame] | 15 | INTEGRITY_FAIL, |
| 16 | INTEGRITY_NOLABEL, |
Mimi Zohar | 566be59 | 2011-08-22 09:14:18 -0400 | [diff] [blame] | 17 | INTEGRITY_NOXATTRS, |
Mimi Zohar | 66dbc325 | 2011-03-15 16:12:09 -0400 | [diff] [blame] | 18 | INTEGRITY_UNKNOWN, |
| 19 | }; |
| 20 | |
Dmitry Kasatkin | 6be5cc5 | 2011-03-09 14:28:20 -0500 | [diff] [blame] | 21 | /* List of EVM protected security xattrs */ |
Mimi Zohar | f381c27 | 2011-03-09 14:13:22 -0500 | [diff] [blame] | 22 | #ifdef CONFIG_INTEGRITY |
Dmitry Kasatkin | bf2276d | 2011-10-19 12:04:40 +0300 | [diff] [blame] | 23 | extern struct integrity_iint_cache *integrity_inode_get(struct inode *inode); |
Mimi Zohar | f381c27 | 2011-03-09 14:13:22 -0500 | [diff] [blame] | 24 | extern void integrity_inode_free(struct inode *inode); |
Dmitry Kasatkin | c9cd2ce | 2014-11-05 17:01:15 +0200 | [diff] [blame] | 25 | extern void __init integrity_load_keys(void); |
Mimi Zohar | f381c27 | 2011-03-09 14:13:22 -0500 | [diff] [blame] | 26 | |
| 27 | #else |
Dmitry Kasatkin | bf2276d | 2011-10-19 12:04:40 +0300 | [diff] [blame] | 28 | static inline struct integrity_iint_cache * |
| 29 | integrity_inode_get(struct inode *inode) |
Mimi Zohar | f381c27 | 2011-03-09 14:13:22 -0500 | [diff] [blame] | 30 | { |
Dmitry Kasatkin | bf2276d | 2011-10-19 12:04:40 +0300 | [diff] [blame] | 31 | return NULL; |
Mimi Zohar | f381c27 | 2011-03-09 14:13:22 -0500 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | static inline void integrity_inode_free(struct inode *inode) |
| 35 | { |
| 36 | return; |
| 37 | } |
Dmitry Kasatkin | c9cd2ce | 2014-11-05 17:01:15 +0200 | [diff] [blame] | 38 | |
| 39 | static inline void integrity_load_keys(void) |
| 40 | { |
| 41 | } |
Paul Bolle | e05a4f4 | 2013-03-25 21:12:27 +0100 | [diff] [blame] | 42 | #endif /* CONFIG_INTEGRITY */ |
Dmitry Kasatkin | c9cd2ce | 2014-11-05 17:01:15 +0200 | [diff] [blame] | 43 | |
Mikhail Kurinnoi | 6eb864c | 2018-06-27 16:33:42 +0300 | [diff] [blame] | 44 | #ifdef CONFIG_INTEGRITY_ASYMMETRIC_KEYS |
| 45 | |
| 46 | extern int integrity_kernel_module_request(char *kmod_name); |
| 47 | |
| 48 | #else |
| 49 | |
| 50 | static inline int integrity_kernel_module_request(char *kmod_name) |
| 51 | { |
| 52 | return 0; |
| 53 | } |
| 54 | |
| 55 | #endif /* CONFIG_INTEGRITY_ASYMMETRIC_KEYS */ |
| 56 | |
Mimi Zohar | f381c27 | 2011-03-09 14:13:22 -0500 | [diff] [blame] | 57 | #endif /* _LINUX_INTEGRITY_H */ |