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 | cb72318 | 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 | 817b54a | 2011-05-13 12:53:38 -0400 | [diff] [blame] | 22 | extern int evm_inode_setattr(struct dentry *dentry, struct iattr *attr); |
Mimi Zohar | 975d294 | 2011-03-09 14:39:57 -0500 | [diff] [blame] | 23 | extern void evm_inode_post_setattr(struct dentry *dentry, int ia_valid); |
Mimi Zohar | 3e1be52 | 2011-03-09 14:38:26 -0500 | [diff] [blame] | 24 | extern int evm_inode_setxattr(struct dentry *dentry, const char *name, |
| 25 | const void *value, size_t size); |
| 26 | extern void evm_inode_post_setxattr(struct dentry *dentry, |
| 27 | const char *xattr_name, |
| 28 | const void *xattr_value, |
| 29 | size_t xattr_value_len); |
| 30 | extern int evm_inode_removexattr(struct dentry *dentry, const char *xattr_name); |
Mimi Zohar | c7b87de | 2011-03-09 14:39:18 -0500 | [diff] [blame] | 31 | extern void evm_inode_post_removexattr(struct dentry *dentry, |
| 32 | const char *xattr_name); |
Mimi Zohar | cb72318 | 2011-03-09 14:40:44 -0500 | [diff] [blame] | 33 | extern int evm_inode_init_security(struct inode *inode, |
| 34 | const struct xattr *xattr_array, |
| 35 | struct xattr *evm); |
Mimi Zohar | 3e1be52 | 2011-03-09 14:38:26 -0500 | [diff] [blame] | 36 | #else |
| 37 | #ifdef CONFIG_INTEGRITY |
| 38 | static inline enum integrity_status evm_verifyxattr(struct dentry *dentry, |
| 39 | const char *xattr_name, |
| 40 | void *xattr_value, |
Dmitry Kasatkin | 2960e6c | 2011-05-06 11:34:13 +0300 | [diff] [blame] | 41 | size_t xattr_value_len, |
| 42 | struct integrity_iint_cache *iint) |
Mimi Zohar | 3e1be52 | 2011-03-09 14:38:26 -0500 | [diff] [blame] | 43 | { |
| 44 | return INTEGRITY_UNKNOWN; |
| 45 | } |
| 46 | #endif |
| 47 | |
Mimi Zohar | e1c9b23 | 2011-08-11 00:22:51 -0400 | [diff] [blame^] | 48 | static inline int evm_inode_setattr(struct dentry *dentry, struct iattr *attr) |
Mimi Zohar | 817b54a | 2011-05-13 12:53:38 -0400 | [diff] [blame] | 49 | { |
| 50 | return 0; |
| 51 | } |
| 52 | |
Mimi Zohar | 975d294 | 2011-03-09 14:39:57 -0500 | [diff] [blame] | 53 | static inline void evm_inode_post_setattr(struct dentry *dentry, int ia_valid) |
| 54 | { |
| 55 | return; |
| 56 | } |
| 57 | |
Mimi Zohar | 3e1be52 | 2011-03-09 14:38:26 -0500 | [diff] [blame] | 58 | static inline int evm_inode_setxattr(struct dentry *dentry, const char *name, |
| 59 | const void *value, size_t size) |
| 60 | { |
| 61 | return 0; |
| 62 | } |
| 63 | |
| 64 | static inline void evm_inode_post_setxattr(struct dentry *dentry, |
| 65 | const char *xattr_name, |
| 66 | const void *xattr_value, |
| 67 | size_t xattr_value_len) |
| 68 | { |
| 69 | return; |
| 70 | } |
| 71 | |
| 72 | static inline int evm_inode_removexattr(struct dentry *dentry, |
| 73 | const char *xattr_name) |
| 74 | { |
| 75 | return 0; |
| 76 | } |
Mimi Zohar | c7b87de | 2011-03-09 14:39:18 -0500 | [diff] [blame] | 77 | |
| 78 | static inline void evm_inode_post_removexattr(struct dentry *dentry, |
| 79 | const char *xattr_name) |
| 80 | { |
| 81 | return; |
| 82 | } |
| 83 | |
Mimi Zohar | cb72318 | 2011-03-09 14:40:44 -0500 | [diff] [blame] | 84 | static inline int evm_inode_init_security(struct inode *inode, |
| 85 | const struct xattr *xattr_array, |
| 86 | struct xattr *evm) |
| 87 | { |
| 88 | return -EOPNOTSUPP; |
| 89 | } |
| 90 | |
Mimi Zohar | 3e1be52 | 2011-03-09 14:38:26 -0500 | [diff] [blame] | 91 | #endif /* CONFIG_EVM_H */ |
| 92 | #endif /* LINUX_EVM_H */ |