blob: 1fcb88ca88dec582a5ce0c83407bd435c71532a7 [file] [log] [blame]
Mimi Zohar3e1be522011-03-09 14:38:26 -05001/*
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 Zoharcb7231802011-03-09 14:40:44 -050012#include <linux/xattr.h>
Mimi Zohar3e1be522011-03-09 14:38:26 -050013
Dmitry Kasatkin2960e6c2011-05-06 11:34:13 +030014struct integrity_iint_cache;
15
Mimi Zohar3e1be522011-03-09 14:38:26 -050016#ifdef CONFIG_EVM
17extern enum integrity_status evm_verifyxattr(struct dentry *dentry,
18 const char *xattr_name,
19 void *xattr_value,
Dmitry Kasatkin2960e6c2011-05-06 11:34:13 +030020 size_t xattr_value_len,
21 struct integrity_iint_cache *iint);
Mimi Zohar817b54a2011-05-13 12:53:38 -040022extern int evm_inode_setattr(struct dentry *dentry, struct iattr *attr);
Mimi Zohar975d2942011-03-09 14:39:57 -050023extern void evm_inode_post_setattr(struct dentry *dentry, int ia_valid);
Mimi Zohar3e1be522011-03-09 14:38:26 -050024extern int evm_inode_setxattr(struct dentry *dentry, const char *name,
25 const void *value, size_t size);
26extern void evm_inode_post_setxattr(struct dentry *dentry,
27 const char *xattr_name,
28 const void *xattr_value,
29 size_t xattr_value_len);
30extern int evm_inode_removexattr(struct dentry *dentry, const char *xattr_name);
Mimi Zoharc7b87de2011-03-09 14:39:18 -050031extern void evm_inode_post_removexattr(struct dentry *dentry,
32 const char *xattr_name);
Mimi Zoharcb7231802011-03-09 14:40:44 -050033extern int evm_inode_init_security(struct inode *inode,
34 const struct xattr *xattr_array,
35 struct xattr *evm);
Mimi Zoharbf6d0f52011-08-18 18:07:44 -040036#ifdef CONFIG_FS_POSIX_ACL
37extern int posix_xattr_acl(const char *xattrname);
38#else
39static inline int posix_xattr_acl(const char *xattrname)
40{
41 return 0;
42}
43#endif
Mimi Zohar3e1be522011-03-09 14:38:26 -050044#else
45#ifdef CONFIG_INTEGRITY
46static inline enum integrity_status evm_verifyxattr(struct dentry *dentry,
47 const char *xattr_name,
48 void *xattr_value,
Dmitry Kasatkin2960e6c2011-05-06 11:34:13 +030049 size_t xattr_value_len,
50 struct integrity_iint_cache *iint)
Mimi Zohar3e1be522011-03-09 14:38:26 -050051{
52 return INTEGRITY_UNKNOWN;
53}
54#endif
55
Mimi Zohare1c9b232011-08-11 00:22:51 -040056static inline int evm_inode_setattr(struct dentry *dentry, struct iattr *attr)
Mimi Zohar817b54a2011-05-13 12:53:38 -040057{
58 return 0;
59}
60
Mimi Zohar975d2942011-03-09 14:39:57 -050061static inline void evm_inode_post_setattr(struct dentry *dentry, int ia_valid)
62{
63 return;
64}
65
Mimi Zohar3e1be522011-03-09 14:38:26 -050066static inline int evm_inode_setxattr(struct dentry *dentry, const char *name,
67 const void *value, size_t size)
68{
69 return 0;
70}
71
72static inline void evm_inode_post_setxattr(struct dentry *dentry,
73 const char *xattr_name,
74 const void *xattr_value,
75 size_t xattr_value_len)
76{
77 return;
78}
79
80static inline int evm_inode_removexattr(struct dentry *dentry,
81 const char *xattr_name)
82{
83 return 0;
84}
Mimi Zoharc7b87de2011-03-09 14:39:18 -050085
86static inline void evm_inode_post_removexattr(struct dentry *dentry,
87 const char *xattr_name)
88{
89 return;
90}
91
Mimi Zoharcb7231802011-03-09 14:40:44 -050092static inline int evm_inode_init_security(struct inode *inode,
93 const struct xattr *xattr_array,
94 struct xattr *evm)
95{
Mimi Zohar5a4730b2011-08-11 00:22:52 -040096 return 0;
Mimi Zoharcb7231802011-03-09 14:40:44 -050097}
98
Paul Bollee05a4f42013-03-25 21:12:27 +010099#endif /* CONFIG_EVM */
Mimi Zohar3e1be522011-03-09 14:38:26 -0500100#endif /* LINUX_EVM_H */