ipe.c (31f8c8682f30720be25e9b1021caa43c64e8d9ce) ipe.c (ba199dc909a20fe62270ae4e93f263987bb9d119)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2020-2024 Microsoft Corporation. All rights reserved.
4 */
5#include <uapi/linux/lsm.h>
6
7#include "ipe.h"
8#include "eval.h"
9#include "hooks.h"
10#include "eval.h"
11
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2020-2024 Microsoft Corporation. All rights reserved.
4 */
5#include <uapi/linux/lsm.h>
6
7#include "ipe.h"
8#include "eval.h"
9#include "hooks.h"
10#include "eval.h"
11
12extern const char *const ipe_boot_policy;
12bool ipe_enabled;
13
14static struct lsm_blob_sizes ipe_blobs __ro_after_init = {
15 .lbs_superblock = sizeof(struct ipe_superblock),
16#ifdef CONFIG_IPE_PROP_DM_VERITY
17 .lbs_bdev = sizeof(struct ipe_bdev),
18#endif /* CONFIG_IPE_PROP_DM_VERITY */
19#ifdef CONFIG_IPE_PROP_FS_VERITY_BUILTIN_SIG

--- 49 unchanged lines hidden (view full) ---

69 * builtin boot policy.
70 *
71 * Return:
72 * * %0 - OK
73 * * %-ENOMEM - Out of memory (OOM)
74 */
75static int __init ipe_init(void)
76{
13bool ipe_enabled;
14
15static struct lsm_blob_sizes ipe_blobs __ro_after_init = {
16 .lbs_superblock = sizeof(struct ipe_superblock),
17#ifdef CONFIG_IPE_PROP_DM_VERITY
18 .lbs_bdev = sizeof(struct ipe_bdev),
19#endif /* CONFIG_IPE_PROP_DM_VERITY */
20#ifdef CONFIG_IPE_PROP_FS_VERITY_BUILTIN_SIG

--- 49 unchanged lines hidden (view full) ---

70 * builtin boot policy.
71 *
72 * Return:
73 * * %0 - OK
74 * * %-ENOMEM - Out of memory (OOM)
75 */
76static int __init ipe_init(void)
77{
78 struct ipe_policy *p = NULL;
79
77 security_add_hooks(ipe_hooks, ARRAY_SIZE(ipe_hooks), &ipe_lsmid);
78 ipe_enabled = true;
79
80 security_add_hooks(ipe_hooks, ARRAY_SIZE(ipe_hooks), &ipe_lsmid);
81 ipe_enabled = true;
82
83 if (ipe_boot_policy) {
84 p = ipe_new_policy(ipe_boot_policy, strlen(ipe_boot_policy),
85 NULL, 0);
86 if (IS_ERR(p))
87 return PTR_ERR(p);
88
89 rcu_assign_pointer(ipe_active_policy, p);
90 }
91
80 return 0;
81}
82
83DEFINE_LSM(ipe) = {
84 .name = "ipe",
85 .init = ipe_init,
86 .blobs = &ipe_blobs,
87};
92 return 0;
93}
94
95DEFINE_LSM(ipe) = {
96 .name = "ipe",
97 .init = ipe_init,
98 .blobs = &ipe_blobs,
99};