1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* System keyring containing trusted public keys.
4 * Copyright (C) 2013 Red Hat, Inc. All Rights Reserved.
8 #ifndef _KEYS_SYSTEM_KEYRING_H
9 #define _KEYS_SYSTEM_KEYRING_H
11 #include <linux/key.h>
13 #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 extern __init int load_module_cert(struct key *keyring);
22 #define restrict_link_by_builtin_trusted restrict_link_reject
24 static inline __init int load_module_cert(struct key *keyring)
31 #ifdef CONFIG_SECONDARY_TRUSTED_KEYRING
32 extern int restrict_link_by_builtin_and_secondary_trusted(
34 const struct key_type *type,
35 const union key_payload *payload,
36 struct key *restriction_key);
38 #define restrict_link_by_builtin_and_secondary_trusted restrict_link_by_builtin_trusted
41 extern struct pkcs7_message *pkcs7;
42 #ifdef CONFIG_SYSTEM_BLACKLIST_KEYRING
43 extern int mark_hash_blacklisted(const char *hash);
44 extern int is_hash_blacklisted(const u8 *hash, size_t hash_len,
46 extern int is_binary_blacklisted(const u8 *hash, size_t hash_len);
48 static inline int is_hash_blacklisted(const u8 *hash, size_t hash_len,
54 static inline int is_binary_blacklisted(const u8 *hash, size_t hash_len)
60 #ifdef CONFIG_SYSTEM_REVOCATION_LIST
61 extern int add_key_to_revocation_list(const char *data, size_t size);
62 extern int is_key_on_revocation_list(struct pkcs7_message *pkcs7);
64 static inline int add_key_to_revocation_list(const char *data, size_t size)
68 static inline int is_key_on_revocation_list(struct pkcs7_message *pkcs7)
74 #ifdef CONFIG_IMA_BLACKLIST_KEYRING
75 extern struct key *ima_blacklist_keyring;
77 static inline struct key *get_ima_blacklist_keyring(void)
79 return ima_blacklist_keyring;
82 static inline struct key *get_ima_blacklist_keyring(void)
86 #endif /* CONFIG_IMA_BLACKLIST_KEYRING */
88 #if defined(CONFIG_INTEGRITY_PLATFORM_KEYRING) && \
89 defined(CONFIG_SYSTEM_TRUSTED_KEYRING)
90 extern void __init set_platform_trusted_keys(struct key *keyring);
92 static inline void set_platform_trusted_keys(struct key *keyring)
97 #endif /* _KEYS_SYSTEM_KEYRING_H */