blob: 93715913a0b1dcddd63d6188d0ae1930031431cb [file] [log] [blame]
David Howellsb56e5a12013-08-30 16:07:30 +01001/* 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 Howellsa511e1a2016-04-06 16:14:26 +010015#include <linux/key.h>
16
David Howellsb56e5a12013-08-30 16:07:30 +010017#ifdef CONFIG_SYSTEM_TRUSTED_KEYRING
18
David Howellsa511e1a2016-04-06 16:14:26 +010019extern 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 Howellsb56e5a12013-08-30 16:07:30 +010023
Mimi Zohar3be4bea2013-08-20 14:36:27 -040024#else
David Howellsa511e1a2016-04-06 16:14:26 +010025#define restrict_link_by_builtin_trusted restrict_link_reject
David Howellsb56e5a12013-08-30 16:07:30 +010026#endif
27
Petko Manolov41c89b62015-12-02 17:47:55 +020028#ifdef CONFIG_IMA_MOK_KEYRING
29extern struct key *ima_mok_keyring;
30extern struct key *ima_blacklist_keyring;
31
32static inline struct key *get_ima_mok_keyring(void)
33{
34 return ima_mok_keyring;
35}
36static inline struct key *get_ima_blacklist_keyring(void)
37{
38 return ima_blacklist_keyring;
39}
40#else
41static inline struct key *get_ima_mok_keyring(void)
42{
43 return NULL;
44}
45static inline struct key *get_ima_blacklist_keyring(void)
46{
47 return NULL;
48}
49#endif /* CONFIG_IMA_MOK_KEYRING */
50
51
David Howellsb56e5a12013-08-30 16:07:30 +010052#endif /* _KEYS_SYSTEM_KEYRING_H */