Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * evm.h
4 *
5 * Copyright (c) 2009 IBM Corporation
6 * Author: Mimi Zohar <zohar@us.ibm.com>
7 */
8
9#ifndef _LINUX_EVM_H
10#define _LINUX_EVM_H
11
12#include <linux/integrity.h>
13#include <linux/xattr.h>
14
15#ifdef CONFIG_EVM
16extern int evm_set_key(void *key, size_t keylen);
17extern enum integrity_status evm_verifyxattr(struct dentry *dentry,
18 const char *xattr_name,
19 void *xattr_value,
20 size_t xattr_value_len);
21int evm_fix_hmac(struct dentry *dentry, const char *xattr_name,
22 const char *xattr_value, size_t xattr_value_len);
23int evm_inode_init_security(struct inode *inode, struct inode *dir,
24 const struct qstr *qstr, struct xattr *xattrs,
25 int *xattr_count);
26extern bool evm_revalidate_status(const char *xattr_name);
27extern int evm_protected_xattr_if_enabled(const char *req_xattr_name);
28extern int evm_read_protected_xattrs(struct dentry *dentry, u8 *buffer,
29 int buffer_size, char type,
30 bool canonical_fmt);
31extern bool evm_metadata_changed(struct inode *inode,
32 struct inode *metadata_inode);
33#ifdef CONFIG_FS_POSIX_ACL
34extern int posix_xattr_acl(const char *xattrname);
35#else
36static inline int posix_xattr_acl(const char *xattrname)
37{
38 return 0;
39}
40#endif
41#else
42
43static inline int evm_set_key(void *key, size_t keylen)
44{
45 return -EOPNOTSUPP;
46}
47
48#ifdef CONFIG_INTEGRITY
49static inline enum integrity_status evm_verifyxattr(struct dentry *dentry,
50 const char *xattr_name,
51 void *xattr_value,
52 size_t xattr_value_len)
53{
54 return INTEGRITY_UNKNOWN;
55}
56
57static inline int evm_fix_hmac(struct dentry *dentry, const char *xattr_name,
58 const char *xattr_value, size_t xattr_value_len)
59{
60 return -EOPNOTSUPP;
61}
62#endif
63
64static inline int evm_inode_init_security(struct inode *inode, struct inode *dir,
65 const struct qstr *qstr,
66 struct xattr *xattrs,
67 int *xattr_count)
68{
69 return 0;
70}
71
72static inline bool evm_revalidate_status(const char *xattr_name)
73{
74 return false;
75}
76
77static inline int evm_protected_xattr_if_enabled(const char *req_xattr_name)
78{
79 return false;
80}
81
82static inline int evm_read_protected_xattrs(struct dentry *dentry, u8 *buffer,
83 int buffer_size, char type,
84 bool canonical_fmt)
85{
86 return -EOPNOTSUPP;
87}
88
89static inline bool evm_metadata_changed(struct inode *inode,
90 struct inode *metadata_inode)
91{
92 return false;
93}
94
95#endif /* CONFIG_EVM */
96#endif /* LINUX_EVM_H */