xref: /aosp_15_r20/external/selinux/libsepol/src/mls.h (revision 2d543d20722ada2425b5bdab9d0d1d29470e7bba)
1*2d543d20SAndroid Build Coastguard Worker /* Author: Stephen Smalley, <[email protected]>
2*2d543d20SAndroid Build Coastguard Worker  * Updated: Trusted Computer Solutions, Inc. <[email protected]>
3*2d543d20SAndroid Build Coastguard Worker  *
4*2d543d20SAndroid Build Coastguard Worker  *      Support for enhanced MLS infrastructure.
5*2d543d20SAndroid Build Coastguard Worker  *
6*2d543d20SAndroid Build Coastguard Worker  * Copyright (C) 2004-2005 Trusted Computer Solutions, Inc.
7*2d543d20SAndroid Build Coastguard Worker  *
8*2d543d20SAndroid Build Coastguard Worker  *  This library is free software; you can redistribute it and/or
9*2d543d20SAndroid Build Coastguard Worker  *  modify it under the terms of the GNU Lesser General Public
10*2d543d20SAndroid Build Coastguard Worker  *  License as published by the Free Software Foundation; either
11*2d543d20SAndroid Build Coastguard Worker  *  version 2.1 of the License, or (at your option) any later version.
12*2d543d20SAndroid Build Coastguard Worker  *
13*2d543d20SAndroid Build Coastguard Worker  *  This library is distributed in the hope that it will be useful,
14*2d543d20SAndroid Build Coastguard Worker  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15*2d543d20SAndroid Build Coastguard Worker  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16*2d543d20SAndroid Build Coastguard Worker  *  Lesser General Public License for more details.
17*2d543d20SAndroid Build Coastguard Worker  *
18*2d543d20SAndroid Build Coastguard Worker  *  You should have received a copy of the GNU Lesser General Public
19*2d543d20SAndroid Build Coastguard Worker  *  License along with this library; if not, write to the Free Software
20*2d543d20SAndroid Build Coastguard Worker  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21*2d543d20SAndroid Build Coastguard Worker  */
22*2d543d20SAndroid Build Coastguard Worker 
23*2d543d20SAndroid Build Coastguard Worker #ifndef _SEPOL_MLS_INTERNAL_H_
24*2d543d20SAndroid Build Coastguard Worker #define _SEPOL_MLS_INTERNAL_H_
25*2d543d20SAndroid Build Coastguard Worker 
26*2d543d20SAndroid Build Coastguard Worker #include "policydb_internal.h"
27*2d543d20SAndroid Build Coastguard Worker #include <sepol/policydb/context.h>
28*2d543d20SAndroid Build Coastguard Worker #include <sepol/policydb/policydb.h>
29*2d543d20SAndroid Build Coastguard Worker #include "handle.h"
30*2d543d20SAndroid Build Coastguard Worker 
31*2d543d20SAndroid Build Coastguard Worker extern int mls_from_string(sepol_handle_t * handle,
32*2d543d20SAndroid Build Coastguard Worker 			   const policydb_t * policydb,
33*2d543d20SAndroid Build Coastguard Worker 			   const char *str, context_struct_t * mls);
34*2d543d20SAndroid Build Coastguard Worker 
35*2d543d20SAndroid Build Coastguard Worker extern int mls_to_string(sepol_handle_t * handle,
36*2d543d20SAndroid Build Coastguard Worker 			 const policydb_t * policydb,
37*2d543d20SAndroid Build Coastguard Worker 			 const context_struct_t * mls, char **str);
38*2d543d20SAndroid Build Coastguard Worker 
39*2d543d20SAndroid Build Coastguard Worker /* Deprecated */
40*2d543d20SAndroid Build Coastguard Worker extern int mls_compute_context_len(const policydb_t * policydb,
41*2d543d20SAndroid Build Coastguard Worker 				   const context_struct_t * context);
42*2d543d20SAndroid Build Coastguard Worker 
43*2d543d20SAndroid Build Coastguard Worker /* Deprecated */
44*2d543d20SAndroid Build Coastguard Worker extern void mls_sid_to_context(const policydb_t * policydb,
45*2d543d20SAndroid Build Coastguard Worker 			       const context_struct_t * context,
46*2d543d20SAndroid Build Coastguard Worker 			       char **scontext);
47*2d543d20SAndroid Build Coastguard Worker 
48*2d543d20SAndroid Build Coastguard Worker /* Deprecated */
49*2d543d20SAndroid Build Coastguard Worker extern int mls_context_to_sid(const policydb_t * policydb,
50*2d543d20SAndroid Build Coastguard Worker 			      char oldc,
51*2d543d20SAndroid Build Coastguard Worker 			      char **scontext, context_struct_t * context);
52*2d543d20SAndroid Build Coastguard Worker 
53*2d543d20SAndroid Build Coastguard Worker extern int mls_context_isvalid(const policydb_t * p,
54*2d543d20SAndroid Build Coastguard Worker 			       const context_struct_t * c);
55*2d543d20SAndroid Build Coastguard Worker 
56*2d543d20SAndroid Build Coastguard Worker extern int mls_convert_context(policydb_t * oldp,
57*2d543d20SAndroid Build Coastguard Worker 			       policydb_t * newp, context_struct_t * context);
58*2d543d20SAndroid Build Coastguard Worker 
59*2d543d20SAndroid Build Coastguard Worker extern int mls_compute_sid(policydb_t * policydb,
60*2d543d20SAndroid Build Coastguard Worker 			   const context_struct_t * scontext,
61*2d543d20SAndroid Build Coastguard Worker 			   const context_struct_t * tcontext,
62*2d543d20SAndroid Build Coastguard Worker 			   sepol_security_class_t tclass,
63*2d543d20SAndroid Build Coastguard Worker 			   uint32_t specified, context_struct_t * newcontext);
64*2d543d20SAndroid Build Coastguard Worker 
65*2d543d20SAndroid Build Coastguard Worker extern int mls_setup_user_range(context_struct_t * fromcon, user_datum_t * user,
66*2d543d20SAndroid Build Coastguard Worker 				context_struct_t * usercon, int mls);
67*2d543d20SAndroid Build Coastguard Worker 
68*2d543d20SAndroid Build Coastguard Worker #endif
69