system_keyring.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* System keyring containing trusted public keys.
  2. *
  3. * Copyright (C) 2013 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public Licence
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the Licence, or (at your option) any later version.
  10. */
  11. #ifndef _KEYS_SYSTEM_KEYRING_H
  12. #define _KEYS_SYSTEM_KEYRING_H
  13. #include <linux/key.h>
  14. #ifdef CONFIG_SYSTEM_TRUSTED_KEYRING
  15. extern int restrict_link_by_builtin_trusted(struct key *keyring,
  16. const struct key_type *type,
  17. const union key_payload *payload,
  18. struct key *restriction_key);
  19. #else
  20. #define restrict_link_by_builtin_trusted restrict_link_reject
  21. #endif
  22. #ifdef CONFIG_SECONDARY_TRUSTED_KEYRING
  23. extern int restrict_link_by_builtin_and_secondary_trusted(
  24. struct key *keyring,
  25. const struct key_type *type,
  26. const union key_payload *payload,
  27. struct key *restriction_key);
  28. #else
  29. #define restrict_link_by_builtin_and_secondary_trusted restrict_link_by_builtin_trusted
  30. #endif
  31. #ifdef CONFIG_SYSTEM_BLACKLIST_KEYRING
  32. extern int mark_hash_blacklisted(const char *hash);
  33. extern int is_hash_blacklisted(const u8 *hash, size_t hash_len,
  34. const char *type);
  35. #else
  36. static inline int is_hash_blacklisted(const u8 *hash, size_t hash_len,
  37. const char *type)
  38. {
  39. return 0;
  40. }
  41. #endif
  42. #ifdef CONFIG_IMA_BLACKLIST_KEYRING
  43. extern struct key *ima_blacklist_keyring;
  44. static inline struct key *get_ima_blacklist_keyring(void)
  45. {
  46. return ima_blacklist_keyring;
  47. }
  48. #else
  49. static inline struct key *get_ima_blacklist_keyring(void)
  50. {
  51. return NULL;
  52. }
  53. #endif /* CONFIG_IMA_BLACKLIST_KEYRING */
  54. #endif /* _KEYS_SYSTEM_KEYRING_H */