evm.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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 int evm_set_key(void *key, size_t keylen);
  14. extern enum integrity_status evm_verifyxattr(struct dentry *dentry,
  15. const char *xattr_name,
  16. void *xattr_value,
  17. size_t xattr_value_len,
  18. struct integrity_iint_cache *iint);
  19. extern int evm_inode_setattr(struct dentry *dentry, struct iattr *attr);
  20. extern void evm_inode_post_setattr(struct dentry *dentry, int ia_valid);
  21. extern int evm_inode_setxattr(struct dentry *dentry, const char *name,
  22. const void *value, size_t size);
  23. extern void evm_inode_post_setxattr(struct dentry *dentry,
  24. const char *xattr_name,
  25. const void *xattr_value,
  26. size_t xattr_value_len);
  27. extern int evm_inode_removexattr(struct dentry *dentry, const char *xattr_name);
  28. extern void evm_inode_post_removexattr(struct dentry *dentry,
  29. const char *xattr_name);
  30. extern int evm_inode_init_security(struct inode *inode,
  31. const struct xattr *xattr_array,
  32. struct xattr *evm);
  33. #ifdef CONFIG_FS_POSIX_ACL
  34. extern int posix_xattr_acl(const char *xattrname);
  35. #else
  36. static inline int posix_xattr_acl(const char *xattrname)
  37. {
  38. return 0;
  39. }
  40. #endif
  41. #else
  42. static inline int evm_set_key(void *key, size_t keylen)
  43. {
  44. return -EOPNOTSUPP;
  45. }
  46. #ifdef CONFIG_INTEGRITY
  47. static inline enum integrity_status evm_verifyxattr(struct dentry *dentry,
  48. const char *xattr_name,
  49. void *xattr_value,
  50. size_t xattr_value_len,
  51. struct integrity_iint_cache *iint)
  52. {
  53. return INTEGRITY_UNKNOWN;
  54. }
  55. #endif
  56. static inline int evm_inode_setattr(struct dentry *dentry, struct iattr *attr)
  57. {
  58. return 0;
  59. }
  60. static inline void evm_inode_post_setattr(struct dentry *dentry, int ia_valid)
  61. {
  62. return;
  63. }
  64. static inline int evm_inode_setxattr(struct dentry *dentry, const char *name,
  65. const void *value, size_t size)
  66. {
  67. return 0;
  68. }
  69. static inline void evm_inode_post_setxattr(struct dentry *dentry,
  70. const char *xattr_name,
  71. const void *xattr_value,
  72. size_t xattr_value_len)
  73. {
  74. return;
  75. }
  76. static inline int evm_inode_removexattr(struct dentry *dentry,
  77. const char *xattr_name)
  78. {
  79. return 0;
  80. }
  81. static inline void evm_inode_post_removexattr(struct dentry *dentry,
  82. const char *xattr_name)
  83. {
  84. return;
  85. }
  86. static inline int evm_inode_init_security(struct inode *inode,
  87. const struct xattr *xattr_array,
  88. struct xattr *evm)
  89. {
  90. return 0;
  91. }
  92. #endif /* CONFIG_EVM */
  93. #endif /* LINUX_EVM_H */