Merge tag 'spi-fix-v4.19-rc4' of https://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6/btrfs-unstable.git] / include / linux / evm.h
blob8302bc29bb358abca818d7b16ba0e1170b8924d6
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * evm.h
5 * Copyright (c) 2009 IBM Corporation
6 * Author: Mimi Zohar <zohar@us.ibm.com>
7 */
9 #ifndef _LINUX_EVM_H
10 #define _LINUX_EVM_H
12 #include <linux/integrity.h>
13 #include <linux/xattr.h>
15 struct integrity_iint_cache;
17 #ifdef CONFIG_EVM
18 extern int evm_set_key(void *key, size_t keylen);
19 extern enum integrity_status evm_verifyxattr(struct dentry *dentry,
20 const char *xattr_name,
21 void *xattr_value,
22 size_t xattr_value_len,
23 struct integrity_iint_cache *iint);
24 extern int evm_inode_setattr(struct dentry *dentry, struct iattr *attr);
25 extern void evm_inode_post_setattr(struct dentry *dentry, int ia_valid);
26 extern int evm_inode_setxattr(struct dentry *dentry, const char *name,
27 const void *value, size_t size);
28 extern void evm_inode_post_setxattr(struct dentry *dentry,
29 const char *xattr_name,
30 const void *xattr_value,
31 size_t xattr_value_len);
32 extern int evm_inode_removexattr(struct dentry *dentry, const char *xattr_name);
33 extern void evm_inode_post_removexattr(struct dentry *dentry,
34 const char *xattr_name);
35 extern int evm_inode_init_security(struct inode *inode,
36 const struct xattr *xattr_array,
37 struct xattr *evm);
38 #ifdef CONFIG_FS_POSIX_ACL
39 extern int posix_xattr_acl(const char *xattrname);
40 #else
41 static inline int posix_xattr_acl(const char *xattrname)
43 return 0;
45 #endif
46 #else
48 static inline int evm_set_key(void *key, size_t keylen)
50 return -EOPNOTSUPP;
53 #ifdef CONFIG_INTEGRITY
54 static inline enum integrity_status evm_verifyxattr(struct dentry *dentry,
55 const char *xattr_name,
56 void *xattr_value,
57 size_t xattr_value_len,
58 struct integrity_iint_cache *iint)
60 return INTEGRITY_UNKNOWN;
62 #endif
64 static inline int evm_inode_setattr(struct dentry *dentry, struct iattr *attr)
66 return 0;
69 static inline void evm_inode_post_setattr(struct dentry *dentry, int ia_valid)
71 return;
74 static inline int evm_inode_setxattr(struct dentry *dentry, const char *name,
75 const void *value, size_t size)
77 return 0;
80 static inline void evm_inode_post_setxattr(struct dentry *dentry,
81 const char *xattr_name,
82 const void *xattr_value,
83 size_t xattr_value_len)
85 return;
88 static inline int evm_inode_removexattr(struct dentry *dentry,
89 const char *xattr_name)
91 return 0;
94 static inline void evm_inode_post_removexattr(struct dentry *dentry,
95 const char *xattr_name)
97 return;
100 static inline int evm_inode_init_security(struct inode *inode,
101 const struct xattr *xattr_array,
102 struct xattr *evm)
104 return 0;
107 #endif /* CONFIG_EVM */
108 #endif /* LINUX_EVM_H */