Mimi Zohar | 3e1be52 | 2011-03-09 14:38:26 -0500 | [diff] [blame] | 1 | /* |
| 2 | * evm.h |
| 3 | * |
| 4 | * Copyright (c) 2009 IBM Corporation |
| 5 | * Author: Mimi Zohar <zohar@us.ibm.com> |
| 6 | */ |
| 7 | |
| 8 | #ifndef _LINUX_EVM_H |
| 9 | #define _LINUX_EVM_H |
| 10 | |
| 11 | #include <linux/integrity.h> |
Mimi Zohar | cb723180 | 2011-03-09 14:40:44 -0500 | [diff] [blame] | 12 | #include <linux/xattr.h> |
Mimi Zohar | 3e1be52 | 2011-03-09 14:38:26 -0500 | [diff] [blame] | 13 | |
Dmitry Kasatkin | 2960e6c | 2011-05-06 11:34:13 +0300 | [diff] [blame^] | 14 | struct integrity_iint_cache; |
| 15 | |
Mimi Zohar | 3e1be52 | 2011-03-09 14:38:26 -0500 | [diff] [blame] | 16 | #ifdef CONFIG_EVM |
| 17 | extern enum integrity_status evm_verifyxattr(struct dentry *dentry, |
| 18 | const char *xattr_name, |
| 19 | void *xattr_value, |
Dmitry Kasatkin | 2960e6c | 2011-05-06 11:34:13 +0300 | [diff] [blame^] | 20 | size_t xattr_value_len, |
| 21 | struct integrity_iint_cache *iint); |
Mimi Zohar | 975d294 | 2011-03-09 14:39:57 -0500 | [diff] [blame] | 22 | extern void evm_inode_post_setattr(struct dentry *dentry, int ia_valid); |
Mimi Zohar | 3e1be52 | 2011-03-09 14:38:26 -0500 | [diff] [blame] | 23 | extern int evm_inode_setxattr(struct dentry *dentry, const char *name, |
| 24 | const void *value, size_t size); |
| 25 | extern void evm_inode_post_setxattr(struct dentry *dentry, |
| 26 | const char *xattr_name, |
| 27 | const void *xattr_value, |
| 28 | size_t xattr_value_len); |
| 29 | extern int evm_inode_removexattr(struct dentry *dentry, const char *xattr_name); |
Mimi Zohar | c7b87de | 2011-03-09 14:39:18 -0500 | [diff] [blame] | 30 | extern void evm_inode_post_removexattr(struct dentry *dentry, |
| 31 | const char *xattr_name); |
Mimi Zohar | cb723180 | 2011-03-09 14:40:44 -0500 | [diff] [blame] | 32 | extern int evm_inode_init_security(struct inode *inode, |
| 33 | const struct xattr *xattr_array, |
| 34 | struct xattr *evm); |
Mimi Zohar | 3e1be52 | 2011-03-09 14:38:26 -0500 | [diff] [blame] | 35 | #else |
| 36 | #ifdef CONFIG_INTEGRITY |
| 37 | static inline enum integrity_status evm_verifyxattr(struct dentry *dentry, |
| 38 | const char *xattr_name, |
| 39 | void *xattr_value, |
Dmitry Kasatkin | 2960e6c | 2011-05-06 11:34:13 +0300 | [diff] [blame^] | 40 | size_t xattr_value_len, |
| 41 | struct integrity_iint_cache *iint) |
Mimi Zohar | 3e1be52 | 2011-03-09 14:38:26 -0500 | [diff] [blame] | 42 | { |
| 43 | return INTEGRITY_UNKNOWN; |
| 44 | } |
| 45 | #endif |
| 46 | |
Mimi Zohar | 975d294 | 2011-03-09 14:39:57 -0500 | [diff] [blame] | 47 | static inline void evm_inode_post_setattr(struct dentry *dentry, int ia_valid) |
| 48 | { |
| 49 | return; |
| 50 | } |
| 51 | |
Mimi Zohar | 3e1be52 | 2011-03-09 14:38:26 -0500 | [diff] [blame] | 52 | static inline int evm_inode_setxattr(struct dentry *dentry, const char *name, |
| 53 | const void *value, size_t size) |
| 54 | { |
| 55 | return 0; |
| 56 | } |
| 57 | |
| 58 | static inline void evm_inode_post_setxattr(struct dentry *dentry, |
| 59 | const char *xattr_name, |
| 60 | const void *xattr_value, |
| 61 | size_t xattr_value_len) |
| 62 | { |
| 63 | return; |
| 64 | } |
| 65 | |
| 66 | static inline int evm_inode_removexattr(struct dentry *dentry, |
| 67 | const char *xattr_name) |
| 68 | { |
| 69 | return 0; |
| 70 | } |
Mimi Zohar | c7b87de | 2011-03-09 14:39:18 -0500 | [diff] [blame] | 71 | |
| 72 | static inline void evm_inode_post_removexattr(struct dentry *dentry, |
| 73 | const char *xattr_name) |
| 74 | { |
| 75 | return; |
| 76 | } |
| 77 | |
Mimi Zohar | cb723180 | 2011-03-09 14:40:44 -0500 | [diff] [blame] | 78 | static inline int evm_inode_init_security(struct inode *inode, |
| 79 | const struct xattr *xattr_array, |
| 80 | struct xattr *evm) |
| 81 | { |
| 82 | return -EOPNOTSUPP; |
| 83 | } |
| 84 | |
Mimi Zohar | 3e1be52 | 2011-03-09 14:38:26 -0500 | [diff] [blame] | 85 | #endif /* CONFIG_EVM_H */ |
| 86 | #endif /* LINUX_EVM_H */ |