blob: 90c5e88987fa8ac8039c5c47c972449ffc5cc60d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Multi-level security (MLS) policy operations.
3 *
4 * Author : Stephen Smalley, <sds@epoch.ncsc.mil>
5 */
6/*
7 * Updated: Trusted Computer Solutions, Inc. <dgoeddel@trustedcs.com>
8 *
9 * Support for enhanced MLS infrastructure.
10 *
Darrel Goeddel376bd9c2006-02-24 15:44:05 -060011 * Copyright (C) 2004-2006 Trusted Computer Solutions, Inc.
Linus Torvalds1da177e2005-04-16 15:20:36 -070012 */
13
14#ifndef _SS_MLS_H_
15#define _SS_MLS_H_
16
17#include "context.h"
18#include "policydb.h"
19
Venkat Yekkirala08554d62006-07-24 23:27:16 -070020/*
21 * Copies the MLS range from `src' into `dst'.
22 */
23static inline int mls_copy_context(struct context *dst,
24 struct context *src)
25{
26 int l, rc = 0;
27
28 /* Copy the MLS range from the source context */
29 for (l = 0; l < 2; l++) {
30 dst->range.level[l].sens = src->range.level[l].sens;
31 rc = ebitmap_cpy(&dst->range.level[l].cat,
32 &src->range.level[l].cat);
33 if (rc)
34 break;
35 }
36
37 return rc;
38}
39
Linus Torvalds1da177e2005-04-16 15:20:36 -070040int mls_compute_context_len(struct context *context);
41void mls_sid_to_context(struct context *context, char **scontext);
42int mls_context_isvalid(struct policydb *p, struct context *c);
43
44int mls_context_to_sid(char oldc,
45 char **scontext,
James Morrisf5c1d5b2005-07-28 01:07:37 -070046 struct context *context,
47 struct sidtab *s,
48 u32 def_sid);
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
Darrel Goeddel376bd9c2006-02-24 15:44:05 -060050int mls_from_string(char *str, struct context *context, gfp_t gfp_mask);
51
Linus Torvalds1da177e2005-04-16 15:20:36 -070052int mls_convert_context(struct policydb *oldp,
53 struct policydb *newp,
54 struct context *context);
55
56int mls_compute_sid(struct context *scontext,
57 struct context *tcontext,
58 u16 tclass,
59 u32 specified,
60 struct context *newcontext);
61
62int mls_setup_user_range(struct context *fromcon, struct user_datum *user,
63 struct context *usercon);
64
65#endif /* _SS_MLS_H */
66