David Howells | b56e5a1 | 2013-08-30 16:07:30 +0100 | [diff] [blame] | 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 | |
| 12 | #ifndef _KEYS_SYSTEM_KEYRING_H |
| 13 | #define _KEYS_SYSTEM_KEYRING_H |
| 14 | |
David Howells | a511e1a | 2016-04-06 16:14:26 +0100 | [diff] [blame^] | 15 | #include <linux/key.h> |
| 16 | |
David Howells | b56e5a1 | 2013-08-30 16:07:30 +0100 | [diff] [blame] | 17 | #ifdef CONFIG_SYSTEM_TRUSTED_KEYRING |
| 18 | |
David Howells | a511e1a | 2016-04-06 16:14:26 +0100 | [diff] [blame^] | 19 | extern int restrict_link_by_builtin_trusted(struct key *keyring, |
| 20 | const struct key_type *type, |
| 21 | unsigned long flags, |
| 22 | const union key_payload *payload); |
David Howells | b56e5a1 | 2013-08-30 16:07:30 +0100 | [diff] [blame] | 23 | |
Mimi Zohar | 3be4bea | 2013-08-20 14:36:27 -0400 | [diff] [blame] | 24 | #else |
David Howells | a511e1a | 2016-04-06 16:14:26 +0100 | [diff] [blame^] | 25 | #define restrict_link_by_builtin_trusted restrict_link_reject |
David Howells | b56e5a1 | 2013-08-30 16:07:30 +0100 | [diff] [blame] | 26 | #endif |
| 27 | |
Petko Manolov | 41c89b6 | 2015-12-02 17:47:55 +0200 | [diff] [blame] | 28 | #ifdef CONFIG_IMA_MOK_KEYRING |
| 29 | extern struct key *ima_mok_keyring; |
| 30 | extern struct key *ima_blacklist_keyring; |
| 31 | |
| 32 | static inline struct key *get_ima_mok_keyring(void) |
| 33 | { |
| 34 | return ima_mok_keyring; |
| 35 | } |
| 36 | static inline struct key *get_ima_blacklist_keyring(void) |
| 37 | { |
| 38 | return ima_blacklist_keyring; |
| 39 | } |
| 40 | #else |
| 41 | static inline struct key *get_ima_mok_keyring(void) |
| 42 | { |
| 43 | return NULL; |
| 44 | } |
| 45 | static inline struct key *get_ima_blacklist_keyring(void) |
| 46 | { |
| 47 | return NULL; |
| 48 | } |
| 49 | #endif /* CONFIG_IMA_MOK_KEYRING */ |
| 50 | |
| 51 | |
David Howells | b56e5a1 | 2013-08-30 16:07:30 +0100 | [diff] [blame] | 52 | #endif /* _KEYS_SYSTEM_KEYRING_H */ |