xref: /linux/rust/helpers/security.c (revision bcc8fd3e1573c502edc0cb61abea0e113a761799)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include <linux/security.h>
4 
5 #ifndef CONFIG_SECURITY
rust_helper_security_cred_getsecid(const struct cred * c,u32 * secid)6 __rust_helper void rust_helper_security_cred_getsecid(const struct cred *c,
7 						      u32 *secid)
8 {
9 	security_cred_getsecid(c, secid);
10 }
11 
rust_helper_security_secid_to_secctx(u32 secid,struct lsm_context * cp)12 __rust_helper int rust_helper_security_secid_to_secctx(u32 secid,
13 						       struct lsm_context *cp)
14 {
15 	return security_secid_to_secctx(secid, cp);
16 }
17 
rust_helper_security_release_secctx(struct lsm_context * cp)18 __rust_helper void rust_helper_security_release_secctx(struct lsm_context *cp)
19 {
20 	security_release_secctx(cp);
21 }
22 
23 __rust_helper int
rust_helper_security_binder_set_context_mgr(const struct cred * mgr)24 rust_helper_security_binder_set_context_mgr(const struct cred *mgr)
25 {
26 	return security_binder_set_context_mgr(mgr);
27 }
28 
29 __rust_helper int
rust_helper_security_binder_transaction(const struct cred * from,const struct cred * to)30 rust_helper_security_binder_transaction(const struct cred *from,
31 					const struct cred *to)
32 {
33 	return security_binder_transaction(from, to);
34 }
35 
36 __rust_helper int
rust_helper_security_binder_transfer_binder(const struct cred * from,const struct cred * to)37 rust_helper_security_binder_transfer_binder(const struct cred *from,
38 					    const struct cred *to)
39 {
40 	return security_binder_transfer_binder(from, to);
41 }
42 
rust_helper_security_binder_transfer_file(const struct cred * from,const struct cred * to,const struct file * file)43 __rust_helper int rust_helper_security_binder_transfer_file(
44 	const struct cred *from, const struct cred *to, const struct file *file)
45 {
46 	return security_binder_transfer_file(from, to, file);
47 }
48 #endif
49