xref: /onnv-gate/usr/src/uts/common/sys/tsol/label_macro.h (revision 1676:37f4a3e2bd99)
1*1676Sjpk /*
2*1676Sjpk  * CDDL HEADER START
3*1676Sjpk  *
4*1676Sjpk  * The contents of this file are subject to the terms of the
5*1676Sjpk  * Common Development and Distribution License (the "License").
6*1676Sjpk  * You may not use this file except in compliance with the License.
7*1676Sjpk  *
8*1676Sjpk  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*1676Sjpk  * or http://www.opensolaris.org/os/licensing.
10*1676Sjpk  * See the License for the specific language governing permissions
11*1676Sjpk  * and limitations under the License.
12*1676Sjpk  *
13*1676Sjpk  * When distributing Covered Code, include this CDDL HEADER in each
14*1676Sjpk  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*1676Sjpk  * If applicable, add the following below this CDDL HEADER, with the
16*1676Sjpk  * fields enclosed by brackets "[]" replaced with your own identifying
17*1676Sjpk  * information: Portions Copyright [yyyy] [name of copyright owner]
18*1676Sjpk  *
19*1676Sjpk  * CDDL HEADER END
20*1676Sjpk  */
21*1676Sjpk /*
22*1676Sjpk  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23*1676Sjpk  * Use is subject to license terms.
24*1676Sjpk  */
25*1676Sjpk 
26*1676Sjpk #ifndef	_LABEL_MACRO_H
27*1676Sjpk #define	_LABEL_MACRO_H
28*1676Sjpk 
29*1676Sjpk #pragma ident	"%Z%%M%	%I%	%E% SMI"
30*1676Sjpk 
31*1676Sjpk #include <sys/types.h>
32*1676Sjpk 
33*1676Sjpk #ifdef	__cplusplus
34*1676Sjpk extern "C" {
35*1676Sjpk #endif
36*1676Sjpk 
37*1676Sjpk /* PRIVATE ONLY TO THE LABEL LIBRARY.  DO NOT USE ELSEWHERE */
38*1676Sjpk 
39*1676Sjpk /* Actual Binary Label Structure Definitions */
40*1676Sjpk 
41*1676Sjpk typedef int16_t	_Classification;
42*1676Sjpk typedef struct {
43*1676Sjpk 	union {
44*1676Sjpk 		uint8_t		class_ar[2];
45*1676Sjpk 		_Classification	class_chunk;
46*1676Sjpk 	} class_u;
47*1676Sjpk } Classification_t;
48*1676Sjpk 
49*1676Sjpk typedef struct {
50*1676Sjpk 	uint32_t c1;
51*1676Sjpk 	uint32_t c2;
52*1676Sjpk 	uint32_t c3;
53*1676Sjpk 	uint32_t c4;
54*1676Sjpk 	uint32_t c5;
55*1676Sjpk 	uint32_t c6;
56*1676Sjpk 	uint32_t c7;
57*1676Sjpk 	uint32_t c8;
58*1676Sjpk } Compartments_t;
59*1676Sjpk 
60*1676Sjpk typedef struct {
61*1676Sjpk 	uint32_t m1;
62*1676Sjpk 	uint32_t m2;
63*1676Sjpk 	uint32_t m3;
64*1676Sjpk 	uint32_t m4;
65*1676Sjpk 	uint32_t m5;
66*1676Sjpk 	uint32_t m6;
67*1676Sjpk 	uint32_t m7;
68*1676Sjpk 	uint32_t m8;
69*1676Sjpk } Markings_t;
70*1676Sjpk 
71*1676Sjpk typedef struct _mac_label_impl {
72*1676Sjpk 	uint8_t id;		/* Magic to say label type */
73*1676Sjpk 	uint8_t _c_len;		/* Number of Compartment words */
74*1676Sjpk 	Classification_t classification;
75*1676Sjpk 	Compartments_t compartments;
76*1676Sjpk } _mac_label_impl_t;
77*1676Sjpk 
78*1676Sjpk typedef _mac_label_impl_t	_blevel_impl_t,		/* compatibility */
79*1676Sjpk 				_bslabel_impl_t,	/* Sensitivity Label */
80*1676Sjpk 				_bclear_impl_t;		/* Clearance */
81*1676Sjpk 
82*1676Sjpk typedef struct _binary_information_label_impl {	/* Information Label */
83*1676Sjpk 	_mac_label_impl_t	binformation_level;
84*1676Sjpk 	Markings_t markings;
85*1676Sjpk } _bilabel_impl_t;
86*1676Sjpk 
87*1676Sjpk typedef struct _binary_cmw_label_impl {		/* CMW Label */
88*1676Sjpk 	_bslabel_impl_t bcl_sensitivity_label;
89*1676Sjpk 	_bilabel_impl_t bcl_information_label;
90*1676Sjpk } _bclabel_impl_t;
91*1676Sjpk 
92*1676Sjpk typedef struct _binary_level_range_impl {	/* Level Range */
93*1676Sjpk 	_mac_label_impl_t lower_bound;
94*1676Sjpk 	_mac_label_impl_t upper_bound;
95*1676Sjpk } _brange_impl_t, brange_t;
96*1676Sjpk 
97*1676Sjpk /* Label Identifier Types */
98*1676Sjpk 
99*1676Sjpk #define	SUN_MAC_ID	0x41	/* MAC label, legacy SUN_SL_ID */
100*1676Sjpk #define	SUN_UCLR_ID	0x49	/* User Clearance, legacy SUN_CLR_ID */
101*1676Sjpk 
102*1676Sjpk #define	_C_LEN		8	/* number of compartments words */
103*1676Sjpk 
104*1676Sjpk /* m_label_t macros */
105*1676Sjpk #define	_MTYPE(l, t) \
106*1676Sjpk 	(((_mac_label_impl_t *)(l))->id == (t))
107*1676Sjpk 
108*1676Sjpk #define	_MSETTYPE(l, t) \
109*1676Sjpk 	(((_mac_label_impl_t *)(l))->id = (t))
110*1676Sjpk 
111*1676Sjpk #define	_MGETTYPE(l)	(((_mac_label_impl_t *)(l))->id)
112*1676Sjpk 
113*1676Sjpk #define	_MEQUAL(l1, l2) \
114*1676Sjpk 	(LCLASS(l1) == LCLASS(l2) && \
115*1676Sjpk 	(l1)->_comps.c1 == (l2)->_comps.c1 && \
116*1676Sjpk 	(l1)->_comps.c2 == (l2)->_comps.c2 && \
117*1676Sjpk 	(l1)->_comps.c3 == (l2)->_comps.c3 && \
118*1676Sjpk 	(l1)->_comps.c4 == (l2)->_comps.c4 && \
119*1676Sjpk 	(l1)->_comps.c5 == (l2)->_comps.c5 && \
120*1676Sjpk 	(l1)->_comps.c6 == (l2)->_comps.c6 && \
121*1676Sjpk 	(l1)->_comps.c7 == (l2)->_comps.c7 && \
122*1676Sjpk 	(l1)->_comps.c8 == (l2)->_comps.c8)
123*1676Sjpk 
124*1676Sjpk #define	SUN_INVALID_ID	0	/* uninitialized label */
125*1676Sjpk #define	SUN_CMW_ID	0x83	/* 104 - total bytes in CMW Label */
126*1676Sjpk #define	SUN_SL_ID	0x41	/* 36 - total bytes in Sensitivity Label */
127*1676Sjpk #define	SUN_SL_UN	0xF1	/* undefined Sensitivity Label */
128*1676Sjpk #define	SUN_IL_ID	0x42	/* 68 - total bytes in Information Label */
129*1676Sjpk #define	SUN_IL_UN	0x73	/* undefined Information Label */
130*1676Sjpk #define	SUN_CLR_ID	0x49	/* 36 - total bytes in Clearance */
131*1676Sjpk #define	SUN_CLR_UN	0xF9	/* undefined Clearance */
132*1676Sjpk 
133*1676Sjpk #define	_bcl_sl		bcl_sensitivity_label
134*1676Sjpk #define	_bcl_il		bcl_information_label
135*1676Sjpk #define	_bslev_il	binformation_level
136*1676Sjpk 
137*1676Sjpk #define	_lclass		classification
138*1676Sjpk #ifdef	_BIG_ENDIAN
139*1676Sjpk #define	LCLASS(slp)	((slp)->_lclass.class_u.class_chunk)
140*1676Sjpk #define	LCLASS_SET(slp, l)	((slp)->_lclass.class_u.class_chunk = (l))
141*1676Sjpk #else
142*1676Sjpk #define	LCLASS(slp)	\
143*1676Sjpk 	((_Classification)(((slp)->_lclass.class_u.class_ar[0] << 8) | \
144*1676Sjpk 	(slp)->_lclass.class_u.class_ar[1]))
145*1676Sjpk #define	LCLASS_SET(slp, l)	\
146*1676Sjpk 	((slp)->_lclass.class_u.class_ar[0] = (uint8_t)((l)>> 8), \
147*1676Sjpk 	(slp)->_lclass.class_u.class_ar[1] = (uint8_t)(l))
148*1676Sjpk #endif	/* _BIG_ENDIAN */
149*1676Sjpk #define	_comps		compartments
150*1676Sjpk 
151*1676Sjpk #define	_iid		_bslev_il.id
152*1676Sjpk #define	_i_c_len		_bslev_il._c_len
153*1676Sjpk #define	_iclass		_bslev_il._lclass
154*1676Sjpk #ifdef	_BIG_ENDIAN
155*1676Sjpk #define	ICLASS(ilp)	((ilp)->_iclass.class_u.class_chunk)
156*1676Sjpk #define	ICLASS_SET(ilp, l)	((ilp)->_iclass.class_u.class_chunk = (l))
157*1676Sjpk #else
158*1676Sjpk #define	ICLASS(ilp)	\
159*1676Sjpk 	((_Classification)(((ilp)->_iclass.class_u.class_ar[0] << 8) | \
160*1676Sjpk 	(ilp)->_iclass.class_u.class_ar[1]))
161*1676Sjpk #define	ICLASS_SET(ilp, l)	\
162*1676Sjpk 	((ilp)->_iclass.class_u.class_ar[0] = (uint8_t)((l)>> 8), \
163*1676Sjpk 	(ilp)->_iclass.class_u.class_ar[1] = (uint8_t)(l))
164*1676Sjpk #endif	/* _BIG_ENDIAN */
165*1676Sjpk #define	_icomps		_bslev_il._comps
166*1676Sjpk #define	_imarks		markings
167*1676Sjpk 
168*1676Sjpk /* Manifest Constant Values */
169*1676Sjpk 
170*1676Sjpk #define	LOW_CLASS	0	/* Admin_Low classification value */
171*1676Sjpk #define	HIGH_CLASS	0x7FFF	/* Admin_High classification value */
172*1676Sjpk #define	EMPTY_SET	0	/* Empty compartments and markings set */
173*1676Sjpk #define	UNIVERSAL_SET	0xFFFFFFFFU	/* Universal compartments and */
174*1676Sjpk 					/* markings set */
175*1676Sjpk 
176*1676Sjpk /* Construct initial labels */
177*1676Sjpk 
178*1676Sjpk #define	_LOW_LABEL(l, t) \
179*1676Sjpk 	((l)->id = t, (l)->_c_len = _C_LEN, LCLASS_SET(l, LOW_CLASS), \
180*1676Sjpk 	(l)->_comps.c1 = (l)->_comps.c2 = (l)->_comps.c3 = (l)->_comps.c4 = \
181*1676Sjpk 	(l)->_comps.c5 = (l)->_comps.c6 = (l)->_comps.c7 = (l)->_comps.c8 = \
182*1676Sjpk 	EMPTY_SET)
183*1676Sjpk 
184*1676Sjpk #define	_HIGH_LABEL(l, t) \
185*1676Sjpk 	((l)->id = t, (l)->_c_len = _C_LEN, LCLASS_SET(l, HIGH_CLASS), \
186*1676Sjpk 	(l)->_comps.c1 = (l)->_comps.c2 = (l)->_comps.c3 = (l)->_comps.c4 = \
187*1676Sjpk 	(l)->_comps.c5 = (l)->_comps.c6 = (l)->_comps.c7 = (l)->_comps.c8 = \
188*1676Sjpk 	UNIVERSAL_SET)
189*1676Sjpk 
190*1676Sjpk /* Macro equivalents */
191*1676Sjpk 
192*1676Sjpk /* Is this memory a properly formatted label of type t? */
193*1676Sjpk #define	BLTYPE(l, t) \
194*1676Sjpk 	((t) == SUN_CMW_ID ? \
195*1676Sjpk 	(((_bclabel_impl_t *)(l))->_bcl_sl.id == SUN_SL_ID || \
196*1676Sjpk 	((_bclabel_impl_t *)(l))->_bcl_sl.id == SUN_SL_UN) && \
197*1676Sjpk 	(((_bclabel_impl_t *)(l))->_bcl_il._iid == SUN_IL_ID || \
198*1676Sjpk 	((_bclabel_impl_t *)(l))->_bcl_il._iid == SUN_IL_UN) : \
199*1676Sjpk 	((_mac_label_impl_t *)(l))->id == (t))
200*1676Sjpk 
201*1676Sjpk /* Are the levels of these labels equal? */
202*1676Sjpk #define	BLEQUAL(l1, l2) \
203*1676Sjpk 	_BLEQUAL((_mac_label_impl_t *)(l1), (_mac_label_impl_t *)(l2))
204*1676Sjpk 
205*1676Sjpk #define	_BLEQUAL(l1, l2) \
206*1676Sjpk 	(LCLASS(l1) == LCLASS(l2) && \
207*1676Sjpk 	(l1)->_comps.c1 == (l2)->_comps.c1 && \
208*1676Sjpk 	(l1)->_comps.c2 == (l2)->_comps.c2 && \
209*1676Sjpk 	(l1)->_comps.c3 == (l2)->_comps.c3 && \
210*1676Sjpk 	(l1)->_comps.c4 == (l2)->_comps.c4 && \
211*1676Sjpk 	(l1)->_comps.c5 == (l2)->_comps.c5 && \
212*1676Sjpk 	(l1)->_comps.c6 == (l2)->_comps.c6 && \
213*1676Sjpk 	(l1)->_comps.c7 == (l2)->_comps.c7 && \
214*1676Sjpk 	(l1)->_comps.c8 == (l2)->_comps.c8)
215*1676Sjpk 
216*1676Sjpk /* Does the level of l1 dominate that of l2? */
217*1676Sjpk #define	BLDOMINATES(l1, l2) \
218*1676Sjpk 	_BLDOMINATES((_mac_label_impl_t *)(l1), (_mac_label_impl_t *)(l2))
219*1676Sjpk 
220*1676Sjpk #define	_BLDOMINATES(l1, l2) (LCLASS(l1) >= LCLASS(l2) && \
221*1676Sjpk 	(l2)->_comps.c1 == ((l1)->_comps.c1 & (l2)->_comps.c1) && \
222*1676Sjpk 	(l2)->_comps.c2 == ((l1)->_comps.c2 & (l2)->_comps.c2) && \
223*1676Sjpk 	(l2)->_comps.c3 == ((l1)->_comps.c3 & (l2)->_comps.c3) && \
224*1676Sjpk 	(l2)->_comps.c4 == ((l1)->_comps.c4 & (l2)->_comps.c4) && \
225*1676Sjpk 	(l2)->_comps.c5 == ((l1)->_comps.c5 & (l2)->_comps.c5) && \
226*1676Sjpk 	(l2)->_comps.c6 == ((l1)->_comps.c6 & (l2)->_comps.c6) && \
227*1676Sjpk 	(l2)->_comps.c7 == ((l1)->_comps.c7 & (l2)->_comps.c7) && \
228*1676Sjpk 	(l2)->_comps.c8 == ((l1)->_comps.c8 & (l2)->_comps.c8))
229*1676Sjpk 
230*1676Sjpk /* Does the level of l1 strictly dominate that of l2? */
231*1676Sjpk #define	BLSTRICTDOM(l1, l2) (!BLEQUAL(l1, l2) && BLDOMINATES(l1, l2))
232*1676Sjpk 
233*1676Sjpk /* Is the level of l within the range r? */
234*1676Sjpk #define	BLINRANGE(l, r)\
235*1676Sjpk 	(BLDOMINATES((l), &((r)->lower_bound)) && \
236*1676Sjpk 	BLDOMINATES(&((r)->upper_bound), (l)))
237*1676Sjpk 
238*1676Sjpk /* Least Upper Bound level l1 and l2 replacing l1 with the result. */
239*1676Sjpk #define	BLMAXIMUM(l1, l2) \
240*1676Sjpk 	_BLMAXIMUM((_mac_label_impl_t *)(l1), (_mac_label_impl_t *)(l2))
241*1676Sjpk 
242*1676Sjpk #define	_BLMAXIMUM(l1, l2)\
243*1676Sjpk 	(((l1)->_lclass = (LCLASS(l1) < LCLASS(l2)) ? \
244*1676Sjpk 	(l2)->_lclass : (l1)->_lclass), \
245*1676Sjpk 	(l1)->_comps.c1 |= (l2)->_comps.c1, \
246*1676Sjpk 	(l1)->_comps.c2 |= (l2)->_comps.c2, \
247*1676Sjpk 	(l1)->_comps.c3 |= (l2)->_comps.c3, \
248*1676Sjpk 	(l1)->_comps.c4 |= (l2)->_comps.c4, \
249*1676Sjpk 	(l1)->_comps.c5 |= (l2)->_comps.c5, \
250*1676Sjpk 	(l1)->_comps.c6 |= (l2)->_comps.c6, \
251*1676Sjpk 	(l1)->_comps.c7 |= (l2)->_comps.c7, \
252*1676Sjpk 	(l1)->_comps.c8 |= (l2)->_comps.c8)
253*1676Sjpk 
254*1676Sjpk /* Greatest Lower Bound level l1 and l2 replacing l1 with the result. */
255*1676Sjpk #define	BLMINIMUM(l1, l2) \
256*1676Sjpk 	_BLMINIMUM((_mac_label_impl_t *)(l1), (_mac_label_impl_t *)(l2))
257*1676Sjpk 
258*1676Sjpk #define	_BLMINIMUM(l1, l2)\
259*1676Sjpk 	(((l1)->_lclass = (LCLASS(l1) > LCLASS(l2)) ? \
260*1676Sjpk 	(l2)->_lclass : (l1)->_lclass), \
261*1676Sjpk 	(l1)->_comps.c1 &= (l2)->_comps.c1, \
262*1676Sjpk 	(l1)->_comps.c2 &= (l2)->_comps.c2, \
263*1676Sjpk 	(l1)->_comps.c3 &= (l2)->_comps.c3, \
264*1676Sjpk 	(l1)->_comps.c4 &= (l2)->_comps.c4, \
265*1676Sjpk 	(l1)->_comps.c5 &= (l2)->_comps.c5, \
266*1676Sjpk 	(l1)->_comps.c6 &= (l2)->_comps.c6, \
267*1676Sjpk 	(l1)->_comps.c7 &= (l2)->_comps.c7, \
268*1676Sjpk 	(l1)->_comps.c8 &= (l2)->_comps.c8)
269*1676Sjpk 
270*1676Sjpk /* Create Manifest Labels */
271*1676Sjpk 
272*1676Sjpk /* Write a System_Low CMW Label into this memory. */
273*1676Sjpk #define	BCLLOW(l) (BSLLOW(BCLTOSL(l)), BILLOW(BCLTOIL(l)))
274*1676Sjpk 
275*1676Sjpk /* Write a System_Low Sensitivity Label into this memory. */
276*1676Sjpk #define	BSLLOW(l) _BSLLOW((_bslabel_impl_t *)(l))
277*1676Sjpk 
278*1676Sjpk #define	_BSLLOW(l) \
279*1676Sjpk 	((l)->id = SUN_SL_ID, (l)->_c_len = _C_LEN, LCLASS_SET(l, LOW_CLASS), \
280*1676Sjpk 	(l)->_comps.c1 = (l)->_comps.c2 = (l)->_comps.c3 = (l)->_comps.c4 = \
281*1676Sjpk 	(l)->_comps.c5 = (l)->_comps.c6 = (l)->_comps.c7 = (l)->_comps.c8 = \
282*1676Sjpk 	EMPTY_SET)
283*1676Sjpk 
284*1676Sjpk /* Write a System_High Sensitivity Label into this memory. */
285*1676Sjpk #define	BSLHIGH(l) _BSLHIGH((_bslabel_impl_t *)(l))
286*1676Sjpk 
287*1676Sjpk #define	_BSLHIGH(l) \
288*1676Sjpk 	((l)->id = SUN_SL_ID, (l)->_c_len = _C_LEN, LCLASS_SET(l, HIGH_CLASS), \
289*1676Sjpk 	(l)->_comps.c1 = (l)->_comps.c2 = (l)->_comps.c3 = (l)->_comps.c4 = \
290*1676Sjpk 	(l)->_comps.c5 = (l)->_comps.c6 = (l)->_comps.c7 = (l)->_comps.c8 = \
291*1676Sjpk 	UNIVERSAL_SET)
292*1676Sjpk 
293*1676Sjpk /* Write a System_Low Information Label into this memory. */
294*1676Sjpk #define	BILLOW(l) _BILLOW((_bilabel_impl_t *)(l))
295*1676Sjpk 
296*1676Sjpk #define	_BILLOW(l) \
297*1676Sjpk 	((l)->_iid = SUN_IL_ID, (l)->_i_c_len = _C_LEN, \
298*1676Sjpk 	ICLASS_SET(l, LOW_CLASS), \
299*1676Sjpk 	(l)->_icomps.c1 = (l)->_icomps.c2 = (l)->_icomps.c3 = \
300*1676Sjpk 	(l)->_icomps.c4 = (l)->_icomps.c5 = (l)->_icomps.c6 = \
301*1676Sjpk 	(l)->_icomps.c7 = (l)->_icomps.c8 = EMPTY_SET, \
302*1676Sjpk 	(l)->_imarks.m1 = (l)->_imarks.m2 = (l)->_imarks.m3 = \
303*1676Sjpk 	(l)->_imarks.m4 = (l)->_imarks.m5 = (l)->_imarks.m6 = \
304*1676Sjpk 	(l)->_imarks.m7 = (l)->_imarks.m8 = EMPTY_SET)
305*1676Sjpk 
306*1676Sjpk 
307*1676Sjpk /* Write a System_Low Sensitivity Label into this memory. */
308*1676Sjpk #define	BCLEARLOW(l) _BCLEARLOW((_bclear_impl_t *)(l))
309*1676Sjpk 
310*1676Sjpk #define	_BCLEARLOW(c) \
311*1676Sjpk 	((c)->id = SUN_CLR_ID, (c)->_c_len = _C_LEN, \
312*1676Sjpk 	LCLASS_SET(c, LOW_CLASS), \
313*1676Sjpk 	(c)->_comps.c1 = (c)->_comps.c2 = (c)->_comps.c3 = (c)->_comps.c4 = \
314*1676Sjpk 	(c)->_comps.c5 = (c)->_comps.c6 = (c)->_comps.c7 = (c)->_comps.c8 = \
315*1676Sjpk 	EMPTY_SET)
316*1676Sjpk 
317*1676Sjpk /* Write a System_High Sensitivity Label into this memory. */
318*1676Sjpk #define	BCLEARHIGH(l) _BCLEARHIGH((_bclear_impl_t *)(l))
319*1676Sjpk 
320*1676Sjpk #define	_BCLEARHIGH(c) \
321*1676Sjpk 	((c)->id = SUN_CLR_ID, (c)->_c_len = _C_LEN, \
322*1676Sjpk 	LCLASS_SET(c, HIGH_CLASS), \
323*1676Sjpk 	(c)->_comps.c1 = (c)->_comps.c2 = (c)->_comps.c3 = (c)->_comps.c4 = \
324*1676Sjpk 	(c)->_comps.c5 = (c)->_comps.c6 = (c)->_comps.c7 = (c)->_comps.c8 = \
325*1676Sjpk 	UNIVERSAL_SET)
326*1676Sjpk 
327*1676Sjpk /* Write an undefined Sensitivity Label into this memory. */
328*1676Sjpk #define	BSLUNDEF(l) (((_bslabel_impl_t *)(l))->id = SUN_SL_UN)
329*1676Sjpk 
330*1676Sjpk /* Write an undefined Clearance into this memory. */
331*1676Sjpk #define	BCLEARUNDEF(c) (((_bclear_impl_t *)(c))->id = SUN_CLR_UN)
332*1676Sjpk 
333*1676Sjpk /* Retrieve the Sensitivity Label portion of a CMW Label */
334*1676Sjpk #define	BCLTOSL(l) ((bslabel_t *)&((_bclabel_impl_t *)(l))->_bcl_sl)
335*1676Sjpk 
336*1676Sjpk /* Retrieve the Information Label portion of a CMW Label */
337*1676Sjpk #define	BCLTOIL(l) ((_bilabel_impl_t *)&((_bclabel_impl_t *)(l))->_bcl_il)
338*1676Sjpk 
339*1676Sjpk /* Copy the Sensitivity Label portion from a CMW Label */
340*1676Sjpk #define	GETCSL(l1, l2) \
341*1676Sjpk 	(*((_bslabel_impl_t *)(l1)) = ((_bclabel_impl_t *)(l2))->_bcl_sl)
342*1676Sjpk 
343*1676Sjpk /* Replace the Sensitivity Label portion of a CMW Label */
344*1676Sjpk #define	SETCSL(l1, l2) \
345*1676Sjpk 	(((_bclabel_impl_t *)(l1))->_bcl_sl = *((_bslabel_impl_t *)(l2)))
346*1676Sjpk 
347*1676Sjpk /* Set type of this memory to the label type 't' */
348*1676Sjpk #define	SETBLTYPE(l, t) (((_bclabel_impl_t *)(l))->_bcl_sl.id = (t))
349*1676Sjpk 
350*1676Sjpk #define	GETBLTYPE(l)	(((const _bclabel_impl_t *)(l))->_bcl_sl.id)
351*1676Sjpk 
352*1676Sjpk #ifdef	__cplusplus
353*1676Sjpk }
354*1676Sjpk #endif
355*1676Sjpk 
356*1676Sjpk #endif	/* !_LABEL_MACRO_H */
357