blob: 39fd38cfa8c96512e59360f151eebb07eb74be1f [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
15#ifdef CONFIG_SYSTEM_TRUSTED_KEYRING
16
17#include <linux/key.h>
David Howells99db4432015-08-05 15:22:27 +010018#include <crypto/public_key.h>
David Howellsb56e5a12013-08-30 16:07:30 +010019
20extern struct key *system_trusted_keyring;
Mimi Zohar3be4bea2013-08-20 14:36:27 -040021static inline struct key *get_system_trusted_keyring(void)
22{
23 return system_trusted_keyring;
24}
25#else
26static inline struct key *get_system_trusted_keyring(void)
27{
28 return NULL;
29}
David Howellsb56e5a12013-08-30 16:07:30 +010030#endif
31
David Howells091f6e22015-07-20 21:16:28 +010032#ifdef CONFIG_SYSTEM_DATA_VERIFICATION
33extern int system_verify_data(const void *data, unsigned long len,
David Howells99db4432015-08-05 15:22:27 +010034 const void *raw_pkcs7, size_t pkcs7_len,
35 enum key_being_used_for usage);
David Howells091f6e22015-07-20 21:16:28 +010036#endif
37
Petko Manolov41c89b62015-12-02 17:47:55 +020038#ifdef CONFIG_IMA_MOK_KEYRING
39extern struct key *ima_mok_keyring;
40extern struct key *ima_blacklist_keyring;
41
42static inline struct key *get_ima_mok_keyring(void)
43{
44 return ima_mok_keyring;
45}
46static inline struct key *get_ima_blacklist_keyring(void)
47{
48 return ima_blacklist_keyring;
49}
50#else
51static inline struct key *get_ima_mok_keyring(void)
52{
53 return NULL;
54}
55static inline struct key *get_ima_blacklist_keyring(void)
56{
57 return NULL;
58}
59#endif /* CONFIG_IMA_MOK_KEYRING */
60
61
David Howellsb56e5a12013-08-30 16:07:30 +010062#endif /* _KEYS_SYSTEM_KEYRING_H */