1
2
3
4
5
6
7#include <linux/ima.h>
8#include <asm/secure_boot.h>
9
10bool arch_ima_get_secureboot(void)
11{
12 return is_ppc_secureboot_enabled();
13}
14
15
16
17
18
19
20
21
22
23
24
25static const char *const secure_rules[] = {
26 "appraise func=KEXEC_KERNEL_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig",
27#ifndef CONFIG_MODULE_SIG
28 "appraise func=MODULE_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig",
29#endif
30 NULL
31};
32
33
34
35
36
37
38static const char *const trusted_rules[] = {
39 "measure func=KEXEC_KERNEL_CHECK",
40 "measure func=MODULE_CHECK",
41 NULL
42};
43
44
45
46
47
48
49static const char *const secure_and_trusted_rules[] = {
50 "measure func=KEXEC_KERNEL_CHECK template=ima-modsig",
51 "measure func=MODULE_CHECK template=ima-modsig",
52 "appraise func=KEXEC_KERNEL_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig",
53#ifndef CONFIG_MODULE_SIG
54 "appraise func=MODULE_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig",
55#endif
56 NULL
57};
58
59
60
61
62
63const char *const *arch_get_ima_policy(void)
64{
65 if (is_ppc_secureboot_enabled()) {
66 if (IS_ENABLED(CONFIG_MODULE_SIG))
67 set_module_sig_enforced();
68
69 if (is_ppc_trustedboot_enabled())
70 return secure_and_trusted_rules;
71 else
72 return secure_rules;
73 } else if (is_ppc_trustedboot_enabled()) {
74 return trusted_rules;
75 }
76
77 return NULL;
78}
79