0001
0002
0003
0004
0005
0006
0007 #include <linux/ima.h>
0008 #include <asm/secure_boot.h>
0009
0010 bool arch_ima_get_secureboot(void)
0011 {
0012 return is_ppc_secureboot_enabled();
0013 }
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 static const char *const secure_rules[] = {
0026 "appraise func=KEXEC_KERNEL_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig",
0027 #ifndef CONFIG_MODULE_SIG
0028 "appraise func=MODULE_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig",
0029 #endif
0030 NULL
0031 };
0032
0033
0034
0035
0036
0037
0038 static const char *const trusted_rules[] = {
0039 "measure func=KEXEC_KERNEL_CHECK",
0040 "measure func=MODULE_CHECK",
0041 NULL
0042 };
0043
0044
0045
0046
0047
0048
0049 static const char *const secure_and_trusted_rules[] = {
0050 "measure func=KEXEC_KERNEL_CHECK template=ima-modsig",
0051 "measure func=MODULE_CHECK template=ima-modsig",
0052 "appraise func=KEXEC_KERNEL_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig",
0053 #ifndef CONFIG_MODULE_SIG
0054 "appraise func=MODULE_CHECK appraise_flag=check_blacklist appraise_type=imasig|modsig",
0055 #endif
0056 NULL
0057 };
0058
0059
0060
0061
0062
0063 const char *const *arch_get_ima_policy(void)
0064 {
0065 if (is_ppc_secureboot_enabled()) {
0066 if (IS_ENABLED(CONFIG_MODULE_SIG))
0067 set_module_sig_enforced();
0068
0069 if (is_ppc_trustedboot_enabled())
0070 return secure_and_trusted_rules;
0071 else
0072 return secure_rules;
0073 } else if (is_ppc_trustedboot_enabled()) {
0074 return trusted_rules;
0075 }
0076
0077 return NULL;
0078 }