evm.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. #else
  33. #ifdef CONFIG_INTEGRITY
  34. static 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. struct integrity_iint_cache *iint)
  39. {
  40. return INTEGRITY_UNKNOWN;
  41. }
  42. #endif
  43. static inline int evm_inode_setattr(struct dentry *dentry, struct iattr *attr)
  44. {
  45. return 0;
  46. }
  47. static inline void evm_inode_post_setattr(struct dentry *dentry, int ia_valid)
  48. {
  49. return;
  50. }
  51. static inline int evm_inode_setxattr(struct dentry *dentry, const char *name,
  52. const void *value, size_t size)
  53. {
  54. return 0;
  55. }
  56. static inline void evm_inode_post_setxattr(struct dentry *dentry,
  57. const char *xattr_name,
  58. const void *xattr_value,
  59. size_t xattr_value_len)
  60. {
  61. return;
  62. }
  63. static inline int evm_inode_removexattr(struct dentry *dentry,
  64. const char *xattr_name)
  65. {
  66. return 0;
  67. }
  68. static inline void evm_inode_post_removexattr(struct dentry *dentry,
  69. const char *xattr_name)
  70. {
  71. return;
  72. }
  73. static inline int evm_inode_init_security(struct inode *inode,
  74. const struct xattr *xattr_array,
  75. struct xattr *evm)
  76. {
  77. return 0;
  78. }
  79. #endif /* CONFIG_EVM_H */
  80. #endif /* LINUX_EVM_H */