Blame view

include/linux/evm.h 2.65 KB
b24413180   Greg Kroah-Hartman   License cleanup: ...
1
  /* SPDX-License-Identifier: GPL-2.0 */
3e1be52d6   Mimi Zohar   security: imbed e...
2
3
4
5
6
7
8
9
10
11
12
  /*
   * evm.h
   *
   * Copyright (c) 2009 IBM Corporation
   * Author: Mimi Zohar <zohar@us.ibm.com>
   */
  
  #ifndef _LINUX_EVM_H
  #define _LINUX_EVM_H
  
  #include <linux/integrity.h>
cb7231806   Mimi Zohar   evm: add evm_inod...
13
  #include <linux/xattr.h>
3e1be52d6   Mimi Zohar   security: imbed e...
14

2960e6cb5   Dmitry Kasatkin   evm: additional p...
15
  struct integrity_iint_cache;
3e1be52d6   Mimi Zohar   security: imbed e...
16
  #ifdef CONFIG_EVM
762667632   Dmitry Kasatkin   evm: provide a fu...
17
  extern int evm_set_key(void *key, size_t keylen);
3e1be52d6   Mimi Zohar   security: imbed e...
18
19
20
  extern enum integrity_status evm_verifyxattr(struct dentry *dentry,
  					     const char *xattr_name,
  					     void *xattr_value,
2960e6cb5   Dmitry Kasatkin   evm: additional p...
21
22
  					     size_t xattr_value_len,
  					     struct integrity_iint_cache *iint);
817b54aa4   Mimi Zohar   evm: add evm_inod...
23
  extern int evm_inode_setattr(struct dentry *dentry, struct iattr *attr);
975d29437   Mimi Zohar   evm: imbed evm_in...
24
  extern void evm_inode_post_setattr(struct dentry *dentry, int ia_valid);
3e1be52d6   Mimi Zohar   security: imbed e...
25
26
27
28
29
30
31
  extern int evm_inode_setxattr(struct dentry *dentry, const char *name,
  			      const void *value, size_t size);
  extern void evm_inode_post_setxattr(struct dentry *dentry,
  				    const char *xattr_name,
  				    const void *xattr_value,
  				    size_t xattr_value_len);
  extern int evm_inode_removexattr(struct dentry *dentry, const char *xattr_name);
c7b87de23   Mimi Zohar   evm: evm_inode_po...
32
33
  extern void evm_inode_post_removexattr(struct dentry *dentry,
  				       const char *xattr_name);
cb7231806   Mimi Zohar   evm: add evm_inod...
34
35
36
  extern int evm_inode_init_security(struct inode *inode,
  				   const struct xattr *xattr_array,
  				   struct xattr *evm);
bf6d0f5dc   Mimi Zohar   evm: posix acls m...
37
38
39
40
41
42
43
44
  #ifdef CONFIG_FS_POSIX_ACL
  extern int posix_xattr_acl(const char *xattrname);
  #else
  static inline int posix_xattr_acl(const char *xattrname)
  {
  	return 0;
  }
  #endif
3e1be52d6   Mimi Zohar   security: imbed e...
45
  #else
762667632   Dmitry Kasatkin   evm: provide a fu...
46
47
48
49
50
  
  static inline int evm_set_key(void *key, size_t keylen)
  {
  	return -EOPNOTSUPP;
  }
3e1be52d6   Mimi Zohar   security: imbed e...
51
52
53
54
  #ifdef CONFIG_INTEGRITY
  static inline enum integrity_status evm_verifyxattr(struct dentry *dentry,
  						    const char *xattr_name,
  						    void *xattr_value,
2960e6cb5   Dmitry Kasatkin   evm: additional p...
55
56
  						    size_t xattr_value_len,
  					struct integrity_iint_cache *iint)
3e1be52d6   Mimi Zohar   security: imbed e...
57
58
59
60
  {
  	return INTEGRITY_UNKNOWN;
  }
  #endif
e1c9b23ad   Mimi Zohar   evm: building wit...
61
  static inline int evm_inode_setattr(struct dentry *dentry, struct iattr *attr)
817b54aa4   Mimi Zohar   evm: add evm_inod...
62
63
64
  {
  	return 0;
  }
975d29437   Mimi Zohar   evm: imbed evm_in...
65
66
67
68
  static inline void evm_inode_post_setattr(struct dentry *dentry, int ia_valid)
  {
  	return;
  }
3e1be52d6   Mimi Zohar   security: imbed e...
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
  static inline int evm_inode_setxattr(struct dentry *dentry, const char *name,
  				     const void *value, size_t size)
  {
  	return 0;
  }
  
  static inline void evm_inode_post_setxattr(struct dentry *dentry,
  					   const char *xattr_name,
  					   const void *xattr_value,
  					   size_t xattr_value_len)
  {
  	return;
  }
  
  static inline int evm_inode_removexattr(struct dentry *dentry,
  					const char *xattr_name)
  {
  	return 0;
  }
c7b87de23   Mimi Zohar   evm: evm_inode_po...
88
89
90
91
92
93
  
  static inline void evm_inode_post_removexattr(struct dentry *dentry,
  					      const char *xattr_name)
  {
  	return;
  }
cb7231806   Mimi Zohar   evm: add evm_inod...
94
95
96
97
  static inline int evm_inode_init_security(struct inode *inode,
  					  const struct xattr *xattr_array,
  					  struct xattr *evm)
  {
5a4730ba9   Mimi Zohar   evm: fix evm_inod...
98
  	return 0;
cb7231806   Mimi Zohar   evm: add evm_inod...
99
  }
e05a4f4fc   Paul Bolle   Remove spurious _...
100
  #endif /* CONFIG_EVM */
3e1be52d6   Mimi Zohar   security: imbed e...
101
  #endif /* LINUX_EVM_H */