blob: 7c10761916a25d6c151d6f31a64adbee52fdf38e [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
14#ifdef CONFIG_EVM
15extern enum integrity_status evm_verifyxattr(struct dentry *dentry,
16 const char *xattr_name,
17 void *xattr_value,
18 size_t xattr_value_len);
Mimi Zohar975d2942011-03-09 14:39:57 -050019extern void evm_inode_post_setattr(struct dentry *dentry, int ia_valid);
Mimi Zohar3e1be522011-03-09 14:38:26 -050020extern int evm_inode_setxattr(struct dentry *dentry, const char *name,
21 const void *value, size_t size);
22extern void evm_inode_post_setxattr(struct dentry *dentry,
23 const char *xattr_name,
24 const void *xattr_value,
25 size_t xattr_value_len);
26extern int evm_inode_removexattr(struct dentry *dentry, const char *xattr_name);
Mimi Zoharc7b87de2011-03-09 14:39:18 -050027extern void evm_inode_post_removexattr(struct dentry *dentry,
28 const char *xattr_name);
Mimi Zoharcb7231802011-03-09 14:40:44 -050029extern int evm_inode_init_security(struct inode *inode,
30 const struct xattr *xattr_array,
31 struct xattr *evm);
Mimi Zohar3e1be522011-03-09 14:38:26 -050032#else
33#ifdef CONFIG_INTEGRITY
34static 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 Zohar975d2942011-03-09 14:39:57 -050043static inline void evm_inode_post_setattr(struct dentry *dentry, int ia_valid)
44{
45 return;
46}
47
Mimi Zohar3e1be522011-03-09 14:38:26 -050048static inline int evm_inode_setxattr(struct dentry *dentry, const char *name,
49 const void *value, size_t size)
50{
51 return 0;
52}
53
54static 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
62static inline int evm_inode_removexattr(struct dentry *dentry,
63 const char *xattr_name)
64{
65 return 0;
66}
Mimi Zoharc7b87de2011-03-09 14:39:18 -050067
68static inline void evm_inode_post_removexattr(struct dentry *dentry,
69 const char *xattr_name)
70{
71 return;
72}
73
Mimi Zoharcb7231802011-03-09 14:40:44 -050074static 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 Zohar3e1be522011-03-09 14:38:26 -050081#endif /* CONFIG_EVM_H */
82#endif /* LINUX_EVM_H */