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 | |
| 15 | #ifdef CONFIG_SYSTEM_TRUSTED_KEYRING |
| 16 | |
| 17 | #include <linux/key.h> |
David Howells | e68503b | 2016-04-06 16:14:24 +0100 | [diff] [blame^] | 18 | #include <linux/verification.h> |
David Howells | 99db443 | 2015-08-05 15:22:27 +0100 | [diff] [blame] | 19 | #include <crypto/public_key.h> |
David Howells | b56e5a1 | 2013-08-30 16:07:30 +0100 | [diff] [blame] | 20 | |
| 21 | extern struct key *system_trusted_keyring; |
Mimi Zohar | 3be4bea | 2013-08-20 14:36:27 -0400 | [diff] [blame] | 22 | static inline struct key *get_system_trusted_keyring(void) |
| 23 | { |
| 24 | return system_trusted_keyring; |
| 25 | } |
| 26 | #else |
| 27 | static inline struct key *get_system_trusted_keyring(void) |
| 28 | { |
| 29 | return NULL; |
| 30 | } |
David Howells | b56e5a1 | 2013-08-30 16:07:30 +0100 | [diff] [blame] | 31 | #endif |
| 32 | |
Petko Manolov | 41c89b6 | 2015-12-02 17:47:55 +0200 | [diff] [blame] | 33 | #ifdef CONFIG_IMA_MOK_KEYRING |
| 34 | extern struct key *ima_mok_keyring; |
| 35 | extern struct key *ima_blacklist_keyring; |
| 36 | |
| 37 | static inline struct key *get_ima_mok_keyring(void) |
| 38 | { |
| 39 | return ima_mok_keyring; |
| 40 | } |
| 41 | static inline struct key *get_ima_blacklist_keyring(void) |
| 42 | { |
| 43 | return ima_blacklist_keyring; |
| 44 | } |
| 45 | #else |
| 46 | static inline struct key *get_ima_mok_keyring(void) |
| 47 | { |
| 48 | return NULL; |
| 49 | } |
| 50 | static inline struct key *get_ima_blacklist_keyring(void) |
| 51 | { |
| 52 | return NULL; |
| 53 | } |
| 54 | #endif /* CONFIG_IMA_MOK_KEYRING */ |
| 55 | |
| 56 | |
David Howells | b56e5a1 | 2013-08-30 16:07:30 +0100 | [diff] [blame] | 57 | #endif /* _KEYS_SYSTEM_KEYRING_H */ |