Merge tag 'block-6.13-20242901' of git://git.kernel.dk/linux
[drm/drm-misc.git] / security / ipe / eval.h
blobfef65a36468cb8253eded741675445f9b821d8a7
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Copyright (C) 2020-2024 Microsoft Corporation. All rights reserved.
4 */
6 #ifndef _IPE_EVAL_H
7 #define _IPE_EVAL_H
9 #include <linux/file.h>
10 #include <linux/types.h>
12 #include "policy.h"
13 #include "hooks.h"
15 #define IPE_EVAL_CTX_INIT ((struct ipe_eval_ctx){ 0 })
17 extern struct ipe_policy __rcu *ipe_active_policy;
18 extern bool success_audit;
19 extern bool enforce;
21 struct ipe_superblock {
22 bool initramfs;
25 #ifdef CONFIG_IPE_PROP_DM_VERITY
26 struct ipe_bdev {
27 #ifdef CONFIG_IPE_PROP_DM_VERITY_SIGNATURE
28 bool dm_verity_signed;
29 #endif /* CONFIG_IPE_PROP_DM_VERITY_SIGNATURE */
30 struct digest_info *root_hash;
32 #endif /* CONFIG_IPE_PROP_DM_VERITY */
34 #ifdef CONFIG_IPE_PROP_FS_VERITY_BUILTIN_SIG
35 struct ipe_inode {
36 bool fs_verity_signed;
38 #endif /* CONFIG_IPE_PROP_FS_VERITY_BUILTIN_SIG */
40 struct ipe_eval_ctx {
41 enum ipe_op_type op;
42 enum ipe_hook_type hook;
44 const struct file *file;
45 bool initramfs;
46 #ifdef CONFIG_IPE_PROP_DM_VERITY
47 const struct ipe_bdev *ipe_bdev;
48 #endif /* CONFIG_IPE_PROP_DM_VERITY */
49 #ifdef CONFIG_IPE_PROP_FS_VERITY
50 const struct inode *ino;
51 #endif /* CONFIG_IPE_PROP_FS_VERITY */
52 #ifdef CONFIG_IPE_PROP_FS_VERITY_BUILTIN_SIG
53 const struct ipe_inode *ipe_inode;
54 #endif /* CONFIG_IPE_PROP_FS_VERITY_BUILTIN_SIG */
57 enum ipe_match {
58 IPE_MATCH_RULE = 0,
59 IPE_MATCH_TABLE,
60 IPE_MATCH_GLOBAL,
61 __IPE_MATCH_MAX
64 void ipe_build_eval_ctx(struct ipe_eval_ctx *ctx,
65 const struct file *file,
66 enum ipe_op_type op,
67 enum ipe_hook_type hook);
68 int ipe_evaluate_event(const struct ipe_eval_ctx *const ctx);
70 #endif /* _IPE_EVAL_H */