integrity.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2009 IBM Corporation
  4. * Author: Mimi Zohar <zohar@us.ibm.com>
  5. */
  6. #ifndef _LINUX_INTEGRITY_H
  7. #define _LINUX_INTEGRITY_H
  8. #include <linux/fs.h>
  9. enum integrity_status {
  10. INTEGRITY_PASS = 0,
  11. INTEGRITY_PASS_IMMUTABLE,
  12. INTEGRITY_FAIL,
  13. INTEGRITY_NOLABEL,
  14. INTEGRITY_NOXATTRS,
  15. INTEGRITY_UNKNOWN,
  16. };
  17. /* List of EVM protected security xattrs */
  18. #ifdef CONFIG_INTEGRITY
  19. extern struct integrity_iint_cache *integrity_inode_get(struct inode *inode);
  20. extern void integrity_inode_free(struct inode *inode);
  21. extern void __init integrity_load_keys(void);
  22. #else
  23. static inline struct integrity_iint_cache *
  24. integrity_inode_get(struct inode *inode)
  25. {
  26. return NULL;
  27. }
  28. static inline void integrity_inode_free(struct inode *inode)
  29. {
  30. return;
  31. }
  32. static inline void integrity_load_keys(void)
  33. {
  34. }
  35. #endif /* CONFIG_INTEGRITY */
  36. #ifdef CONFIG_INTEGRITY_ASYMMETRIC_KEYS
  37. extern int integrity_kernel_module_request(char *kmod_name);
  38. #else
  39. static inline int integrity_kernel_module_request(char *kmod_name)
  40. {
  41. return 0;
  42. }
  43. #endif /* CONFIG_INTEGRITY_ASYMMETRIC_KEYS */
  44. #endif /* _LINUX_INTEGRITY_H */