evm.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * evm.h
  3. *
  4. * Copyright (c) 2009 IBM Corporation
  5. * Author: Mimi Zohar <zohar@us.ibm.com>
  6. */
  7. #ifndef _LINUX_EVM_H
  8. #define _LINUX_EVM_H
  9. #include <linux/integrity.h>
  10. #include <linux/xattr.h>
  11. struct integrity_iint_cache;
  12. #ifdef CONFIG_EVM
  13. extern enum integrity_status evm_verifyxattr(struct dentry *dentry,
  14. const char *xattr_name,
  15. void *xattr_value,
  16. size_t xattr_value_len,
  17. struct integrity_iint_cache *iint);
  18. extern int evm_inode_setattr(struct dentry *dentry, struct iattr *attr);
  19. extern void evm_inode_post_setattr(struct dentry *dentry, int ia_valid);
  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);
  27. extern void evm_inode_post_removexattr(struct dentry *dentry,
  28. const char *xattr_name);
  29. extern int evm_inode_init_security(struct inode *inode,
  30. const struct xattr *xattr_array,
  31. struct xattr *evm);
  32. #ifdef CONFIG_FS_POSIX_ACL
  33. extern int posix_xattr_acl(const char *xattrname);
  34. #else
  35. static inline int posix_xattr_acl(const char *xattrname)
  36. {
  37. return 0;
  38. }
  39. #endif
  40. #else
  41. #ifdef CONFIG_INTEGRITY
  42. static inline enum integrity_status evm_verifyxattr(struct dentry *dentry,
  43. const char *xattr_name,
  44. void *xattr_value,
  45. size_t xattr_value_len,
  46. struct integrity_iint_cache *iint)
  47. {
  48. return INTEGRITY_UNKNOWN;
  49. }
  50. #endif
  51. static inline int evm_inode_setattr(struct dentry *dentry, struct iattr *attr)
  52. {
  53. return 0;
  54. }
  55. static inline void evm_inode_post_setattr(struct dentry *dentry, int ia_valid)
  56. {
  57. return;
  58. }
  59. static inline int evm_inode_setxattr(struct dentry *dentry, const char *name,
  60. const void *value, size_t size)
  61. {
  62. return 0;
  63. }
  64. static inline void evm_inode_post_setxattr(struct dentry *dentry,
  65. const char *xattr_name,
  66. const void *xattr_value,
  67. size_t xattr_value_len)
  68. {
  69. return;
  70. }
  71. static inline int evm_inode_removexattr(struct dentry *dentry,
  72. const char *xattr_name)
  73. {
  74. return 0;
  75. }
  76. static inline void evm_inode_post_removexattr(struct dentry *dentry,
  77. const char *xattr_name)
  78. {
  79. return;
  80. }
  81. static inline int evm_inode_init_security(struct inode *inode,
  82. const struct xattr *xattr_array,
  83. struct xattr *evm)
  84. {
  85. return 0;
  86. }
  87. #endif /* CONFIG_EVM_H */
  88. #endif /* LINUX_EVM_H */