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 | |
| 14 | #ifdef CONFIG_EVM |
| 15 | extern enum integrity_status evm_verifyxattr(struct dentry *dentry, |
| 16 | const char *xattr_name, |
| 17 | void *xattr_value, |
| 18 | size_t xattr_value_len); |
Mimi Zohar | 975d294 | 2011-03-09 14:39:57 -0500 | [diff] [blame] | 19 | extern void evm_inode_post_setattr(struct dentry *dentry, int ia_valid); |
Mimi Zohar | 3e1be52 | 2011-03-09 14:38:26 -0500 | [diff] [blame] | 20 | extern int evm_inode_setxattr(struct dentry *dentry, const char *name, |
| 21 | const void *value, size_t size); |
| 22 | extern void evm_inode_post_setxattr(struct dentry *dentry, |
| 23 | const char *xattr_name, |
| 24 | const void *xattr_value, |
| 25 | size_t xattr_value_len); |
| 26 | extern int evm_inode_removexattr(struct dentry *dentry, const char *xattr_name); |
Mimi Zohar | c7b87de | 2011-03-09 14:39:18 -0500 | [diff] [blame] | 27 | extern void evm_inode_post_removexattr(struct dentry *dentry, |
| 28 | const char *xattr_name); |
Mimi Zohar | cb723180 | 2011-03-09 14:40:44 -0500 | [diff] [blame^] | 29 | extern int evm_inode_init_security(struct inode *inode, |
| 30 | const struct xattr *xattr_array, |
| 31 | struct xattr *evm); |
Mimi Zohar | 3e1be52 | 2011-03-09 14:38:26 -0500 | [diff] [blame] | 32 | #else |
| 33 | #ifdef CONFIG_INTEGRITY |
| 34 | static inline enum integrity_status evm_verifyxattr(struct dentry *dentry, |
| 35 | const char *xattr_name, |
| 36 | void *xattr_value, |
| 37 | size_t xattr_value_len) |
| 38 | { |
| 39 | return INTEGRITY_UNKNOWN; |
| 40 | } |
| 41 | #endif |
| 42 | |
Mimi Zohar | 975d294 | 2011-03-09 14:39:57 -0500 | [diff] [blame] | 43 | static inline void evm_inode_post_setattr(struct dentry *dentry, int ia_valid) |
| 44 | { |
| 45 | return; |
| 46 | } |
| 47 | |
Mimi Zohar | 3e1be52 | 2011-03-09 14:38:26 -0500 | [diff] [blame] | 48 | static inline int evm_inode_setxattr(struct dentry *dentry, const char *name, |
| 49 | const void *value, size_t size) |
| 50 | { |
| 51 | return 0; |
| 52 | } |
| 53 | |
| 54 | static inline void evm_inode_post_setxattr(struct dentry *dentry, |
| 55 | const char *xattr_name, |
| 56 | const void *xattr_value, |
| 57 | size_t xattr_value_len) |
| 58 | { |
| 59 | return; |
| 60 | } |
| 61 | |
| 62 | static inline int evm_inode_removexattr(struct dentry *dentry, |
| 63 | const char *xattr_name) |
| 64 | { |
| 65 | return 0; |
| 66 | } |
Mimi Zohar | c7b87de | 2011-03-09 14:39:18 -0500 | [diff] [blame] | 67 | |
| 68 | static inline void evm_inode_post_removexattr(struct dentry *dentry, |
| 69 | const char *xattr_name) |
| 70 | { |
| 71 | return; |
| 72 | } |
| 73 | |
Mimi Zohar | cb723180 | 2011-03-09 14:40:44 -0500 | [diff] [blame^] | 74 | static inline int evm_inode_init_security(struct inode *inode, |
| 75 | const struct xattr *xattr_array, |
| 76 | struct xattr *evm) |
| 77 | { |
| 78 | return -EOPNOTSUPP; |
| 79 | } |
| 80 | |
Mimi Zohar | 3e1be52 | 2011-03-09 14:38:26 -0500 | [diff] [blame] | 81 | #endif /* CONFIG_EVM_H */ |
| 82 | #endif /* LINUX_EVM_H */ |