xref: /titanic_41/usr/src/uts/common/sys/tsol/label_macro.h (revision b9dac67bf3a63377e9c38679121e360b643b6a68)
145916cd2Sjpk /*
245916cd2Sjpk  * CDDL HEADER START
345916cd2Sjpk  *
445916cd2Sjpk  * The contents of this file are subject to the terms of the
545916cd2Sjpk  * Common Development and Distribution License (the "License").
645916cd2Sjpk  * You may not use this file except in compliance with the License.
745916cd2Sjpk  *
845916cd2Sjpk  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
945916cd2Sjpk  * or http://www.opensolaris.org/os/licensing.
1045916cd2Sjpk  * See the License for the specific language governing permissions
1145916cd2Sjpk  * and limitations under the License.
1245916cd2Sjpk  *
1345916cd2Sjpk  * When distributing Covered Code, include this CDDL HEADER in each
1445916cd2Sjpk  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1545916cd2Sjpk  * If applicable, add the following below this CDDL HEADER, with the
1645916cd2Sjpk  * fields enclosed by brackets "[]" replaced with your own identifying
1745916cd2Sjpk  * information: Portions Copyright [yyyy] [name of copyright owner]
1845916cd2Sjpk  *
1945916cd2Sjpk  * CDDL HEADER END
2045916cd2Sjpk  */
2145916cd2Sjpk /*
2245916cd2Sjpk  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
2345916cd2Sjpk  * Use is subject to license terms.
2445916cd2Sjpk  */
2545916cd2Sjpk 
2645916cd2Sjpk #ifndef	_LABEL_MACRO_H
2745916cd2Sjpk #define	_LABEL_MACRO_H
2845916cd2Sjpk 
2945916cd2Sjpk #pragma ident	"%Z%%M%	%I%	%E% SMI"
3045916cd2Sjpk 
3145916cd2Sjpk #include <sys/types.h>
3245916cd2Sjpk 
3345916cd2Sjpk #ifdef	__cplusplus
3445916cd2Sjpk extern "C" {
3545916cd2Sjpk #endif
3645916cd2Sjpk 
3745916cd2Sjpk /* PRIVATE ONLY TO THE LABEL LIBRARY.  DO NOT USE ELSEWHERE */
3845916cd2Sjpk 
3945916cd2Sjpk /* Actual Binary Label Structure Definitions */
4045916cd2Sjpk 
4145916cd2Sjpk typedef int16_t	_Classification;
4245916cd2Sjpk typedef struct {
4345916cd2Sjpk 	union {
4445916cd2Sjpk 		uint8_t		class_ar[2];
4545916cd2Sjpk 		_Classification	class_chunk;
4645916cd2Sjpk 	} class_u;
4745916cd2Sjpk } Classification_t;
4845916cd2Sjpk 
4945916cd2Sjpk typedef struct {
5045916cd2Sjpk 	uint32_t c1;
5145916cd2Sjpk 	uint32_t c2;
5245916cd2Sjpk 	uint32_t c3;
5345916cd2Sjpk 	uint32_t c4;
5445916cd2Sjpk 	uint32_t c5;
5545916cd2Sjpk 	uint32_t c6;
5645916cd2Sjpk 	uint32_t c7;
5745916cd2Sjpk 	uint32_t c8;
5845916cd2Sjpk } Compartments_t;
5945916cd2Sjpk 
6045916cd2Sjpk typedef struct {
6145916cd2Sjpk 	uint32_t m1;
6245916cd2Sjpk 	uint32_t m2;
6345916cd2Sjpk 	uint32_t m3;
6445916cd2Sjpk 	uint32_t m4;
6545916cd2Sjpk 	uint32_t m5;
6645916cd2Sjpk 	uint32_t m6;
6745916cd2Sjpk 	uint32_t m7;
6845916cd2Sjpk 	uint32_t m8;
6945916cd2Sjpk } Markings_t;
7045916cd2Sjpk 
7145916cd2Sjpk typedef struct _mac_label_impl {
7245916cd2Sjpk 	uint8_t id;		/* Magic to say label type */
7345916cd2Sjpk 	uint8_t _c_len;		/* Number of Compartment words */
7445916cd2Sjpk 	Classification_t classification;
7545916cd2Sjpk 	Compartments_t compartments;
7645916cd2Sjpk } _mac_label_impl_t;
7745916cd2Sjpk 
7845916cd2Sjpk typedef _mac_label_impl_t	_blevel_impl_t,		/* compatibility */
7945916cd2Sjpk 				_bslabel_impl_t,	/* Sensitivity Label */
8045916cd2Sjpk 				_bclear_impl_t;		/* Clearance */
8145916cd2Sjpk 
8245916cd2Sjpk typedef struct _binary_information_label_impl {	/* Information Label */
8345916cd2Sjpk 	_mac_label_impl_t	binformation_level;
8445916cd2Sjpk 	Markings_t markings;
8545916cd2Sjpk } _bilabel_impl_t;
8645916cd2Sjpk 
8745916cd2Sjpk typedef struct _binary_cmw_label_impl {		/* CMW Label */
8845916cd2Sjpk 	_bslabel_impl_t bcl_sensitivity_label;
8945916cd2Sjpk 	_bilabel_impl_t bcl_information_label;
9045916cd2Sjpk } _bclabel_impl_t;
9145916cd2Sjpk 
9245916cd2Sjpk typedef struct _binary_level_range_impl {	/* Level Range */
9345916cd2Sjpk 	_mac_label_impl_t lower_bound;
9445916cd2Sjpk 	_mac_label_impl_t upper_bound;
9545916cd2Sjpk } _brange_impl_t, brange_t;
9645916cd2Sjpk 
97*b9dac67bSrica #define	NMLP_MAX	0x10
98*b9dac67bSrica #define	NSLS_MAX	0x4
99*b9dac67bSrica 
100*b9dac67bSrica typedef _mac_label_impl_t blset_t[NSLS_MAX];
101*b9dac67bSrica 
10245916cd2Sjpk /* Label Identifier Types */
10345916cd2Sjpk 
10445916cd2Sjpk #define	SUN_MAC_ID	0x41	/* MAC label, legacy SUN_SL_ID */
10545916cd2Sjpk #define	SUN_UCLR_ID	0x49	/* User Clearance, legacy SUN_CLR_ID */
10645916cd2Sjpk 
10745916cd2Sjpk #define	_C_LEN		8	/* number of compartments words */
10845916cd2Sjpk 
10945916cd2Sjpk /* m_label_t macros */
11045916cd2Sjpk #define	_MTYPE(l, t) \
11145916cd2Sjpk 	(((_mac_label_impl_t *)(l))->id == (t))
11245916cd2Sjpk 
11345916cd2Sjpk #define	_MSETTYPE(l, t) \
11445916cd2Sjpk 	(((_mac_label_impl_t *)(l))->id = (t))
11545916cd2Sjpk 
11645916cd2Sjpk #define	_MGETTYPE(l)	(((_mac_label_impl_t *)(l))->id)
11745916cd2Sjpk 
11845916cd2Sjpk #define	_MEQUAL(l1, l2) \
11945916cd2Sjpk 	(LCLASS(l1) == LCLASS(l2) && \
12045916cd2Sjpk 	(l1)->_comps.c1 == (l2)->_comps.c1 && \
12145916cd2Sjpk 	(l1)->_comps.c2 == (l2)->_comps.c2 && \
12245916cd2Sjpk 	(l1)->_comps.c3 == (l2)->_comps.c3 && \
12345916cd2Sjpk 	(l1)->_comps.c4 == (l2)->_comps.c4 && \
12445916cd2Sjpk 	(l1)->_comps.c5 == (l2)->_comps.c5 && \
12545916cd2Sjpk 	(l1)->_comps.c6 == (l2)->_comps.c6 && \
12645916cd2Sjpk 	(l1)->_comps.c7 == (l2)->_comps.c7 && \
12745916cd2Sjpk 	(l1)->_comps.c8 == (l2)->_comps.c8)
12845916cd2Sjpk 
12945916cd2Sjpk #define	SUN_INVALID_ID	0	/* uninitialized label */
13045916cd2Sjpk #define	SUN_CMW_ID	0x83	/* 104 - total bytes in CMW Label */
13145916cd2Sjpk #define	SUN_SL_ID	0x41	/* 36 - total bytes in Sensitivity Label */
13245916cd2Sjpk #define	SUN_SL_UN	0xF1	/* undefined Sensitivity Label */
13345916cd2Sjpk #define	SUN_IL_ID	0x42	/* 68 - total bytes in Information Label */
13445916cd2Sjpk #define	SUN_IL_UN	0x73	/* undefined Information Label */
13545916cd2Sjpk #define	SUN_CLR_ID	0x49	/* 36 - total bytes in Clearance */
13645916cd2Sjpk #define	SUN_CLR_UN	0xF9	/* undefined Clearance */
13745916cd2Sjpk 
13845916cd2Sjpk #define	_bcl_sl		bcl_sensitivity_label
13945916cd2Sjpk #define	_bcl_il		bcl_information_label
14045916cd2Sjpk #define	_bslev_il	binformation_level
14145916cd2Sjpk 
14245916cd2Sjpk #define	_lclass		classification
14345916cd2Sjpk #ifdef	_BIG_ENDIAN
14445916cd2Sjpk #define	LCLASS(slp)	((slp)->_lclass.class_u.class_chunk)
14545916cd2Sjpk #define	LCLASS_SET(slp, l)	((slp)->_lclass.class_u.class_chunk = (l))
14645916cd2Sjpk #else
14745916cd2Sjpk #define	LCLASS(slp)	\
14845916cd2Sjpk 	((_Classification)(((slp)->_lclass.class_u.class_ar[0] << 8) | \
14945916cd2Sjpk 	(slp)->_lclass.class_u.class_ar[1]))
15045916cd2Sjpk #define	LCLASS_SET(slp, l)	\
15145916cd2Sjpk 	((slp)->_lclass.class_u.class_ar[0] = (uint8_t)((l)>> 8), \
15245916cd2Sjpk 	(slp)->_lclass.class_u.class_ar[1] = (uint8_t)(l))
15345916cd2Sjpk #endif	/* _BIG_ENDIAN */
15445916cd2Sjpk #define	_comps		compartments
15545916cd2Sjpk 
15645916cd2Sjpk #define	_iid		_bslev_il.id
15745916cd2Sjpk #define	_i_c_len		_bslev_il._c_len
15845916cd2Sjpk #define	_iclass		_bslev_il._lclass
15945916cd2Sjpk #ifdef	_BIG_ENDIAN
16045916cd2Sjpk #define	ICLASS(ilp)	((ilp)->_iclass.class_u.class_chunk)
16145916cd2Sjpk #define	ICLASS_SET(ilp, l)	((ilp)->_iclass.class_u.class_chunk = (l))
16245916cd2Sjpk #else
16345916cd2Sjpk #define	ICLASS(ilp)	\
16445916cd2Sjpk 	((_Classification)(((ilp)->_iclass.class_u.class_ar[0] << 8) | \
16545916cd2Sjpk 	(ilp)->_iclass.class_u.class_ar[1]))
16645916cd2Sjpk #define	ICLASS_SET(ilp, l)	\
16745916cd2Sjpk 	((ilp)->_iclass.class_u.class_ar[0] = (uint8_t)((l)>> 8), \
16845916cd2Sjpk 	(ilp)->_iclass.class_u.class_ar[1] = (uint8_t)(l))
16945916cd2Sjpk #endif	/* _BIG_ENDIAN */
17045916cd2Sjpk #define	_icomps		_bslev_il._comps
17145916cd2Sjpk #define	_imarks		markings
17245916cd2Sjpk 
17345916cd2Sjpk /* Manifest Constant Values */
17445916cd2Sjpk 
17545916cd2Sjpk #define	LOW_CLASS	0	/* Admin_Low classification value */
17645916cd2Sjpk #define	HIGH_CLASS	0x7FFF	/* Admin_High classification value */
17745916cd2Sjpk #define	EMPTY_SET	0	/* Empty compartments and markings set */
17845916cd2Sjpk #define	UNIVERSAL_SET	0xFFFFFFFFU	/* Universal compartments and */
17945916cd2Sjpk 					/* markings set */
18045916cd2Sjpk 
18145916cd2Sjpk /* Construct initial labels */
18245916cd2Sjpk 
18345916cd2Sjpk #define	_LOW_LABEL(l, t) \
18445916cd2Sjpk 	((l)->id = t, (l)->_c_len = _C_LEN, LCLASS_SET(l, LOW_CLASS), \
18545916cd2Sjpk 	(l)->_comps.c1 = (l)->_comps.c2 = (l)->_comps.c3 = (l)->_comps.c4 = \
18645916cd2Sjpk 	(l)->_comps.c5 = (l)->_comps.c6 = (l)->_comps.c7 = (l)->_comps.c8 = \
18745916cd2Sjpk 	EMPTY_SET)
18845916cd2Sjpk 
18945916cd2Sjpk #define	_HIGH_LABEL(l, t) \
19045916cd2Sjpk 	((l)->id = t, (l)->_c_len = _C_LEN, LCLASS_SET(l, HIGH_CLASS), \
19145916cd2Sjpk 	(l)->_comps.c1 = (l)->_comps.c2 = (l)->_comps.c3 = (l)->_comps.c4 = \
19245916cd2Sjpk 	(l)->_comps.c5 = (l)->_comps.c6 = (l)->_comps.c7 = (l)->_comps.c8 = \
19345916cd2Sjpk 	UNIVERSAL_SET)
19445916cd2Sjpk 
19545916cd2Sjpk /* Macro equivalents */
19645916cd2Sjpk 
19745916cd2Sjpk /* Is this memory a properly formatted label of type t? */
19845916cd2Sjpk #define	BLTYPE(l, t) \
19945916cd2Sjpk 	((t) == SUN_CMW_ID ? \
20045916cd2Sjpk 	(((_bclabel_impl_t *)(l))->_bcl_sl.id == SUN_SL_ID || \
20145916cd2Sjpk 	((_bclabel_impl_t *)(l))->_bcl_sl.id == SUN_SL_UN) && \
20245916cd2Sjpk 	(((_bclabel_impl_t *)(l))->_bcl_il._iid == SUN_IL_ID || \
20345916cd2Sjpk 	((_bclabel_impl_t *)(l))->_bcl_il._iid == SUN_IL_UN) : \
20445916cd2Sjpk 	((_mac_label_impl_t *)(l))->id == (t))
20545916cd2Sjpk 
20645916cd2Sjpk /* Are the levels of these labels equal? */
20745916cd2Sjpk #define	BLEQUAL(l1, l2) \
20845916cd2Sjpk 	_BLEQUAL((_mac_label_impl_t *)(l1), (_mac_label_impl_t *)(l2))
20945916cd2Sjpk 
21045916cd2Sjpk #define	_BLEQUAL(l1, l2) \
21145916cd2Sjpk 	(LCLASS(l1) == LCLASS(l2) && \
21245916cd2Sjpk 	(l1)->_comps.c1 == (l2)->_comps.c1 && \
21345916cd2Sjpk 	(l1)->_comps.c2 == (l2)->_comps.c2 && \
21445916cd2Sjpk 	(l1)->_comps.c3 == (l2)->_comps.c3 && \
21545916cd2Sjpk 	(l1)->_comps.c4 == (l2)->_comps.c4 && \
21645916cd2Sjpk 	(l1)->_comps.c5 == (l2)->_comps.c5 && \
21745916cd2Sjpk 	(l1)->_comps.c6 == (l2)->_comps.c6 && \
21845916cd2Sjpk 	(l1)->_comps.c7 == (l2)->_comps.c7 && \
21945916cd2Sjpk 	(l1)->_comps.c8 == (l2)->_comps.c8)
22045916cd2Sjpk 
22145916cd2Sjpk /* Does the level of l1 dominate that of l2? */
22245916cd2Sjpk #define	BLDOMINATES(l1, l2) \
22345916cd2Sjpk 	_BLDOMINATES((_mac_label_impl_t *)(l1), (_mac_label_impl_t *)(l2))
22445916cd2Sjpk 
22545916cd2Sjpk #define	_BLDOMINATES(l1, l2) (LCLASS(l1) >= LCLASS(l2) && \
22645916cd2Sjpk 	(l2)->_comps.c1 == ((l1)->_comps.c1 & (l2)->_comps.c1) && \
22745916cd2Sjpk 	(l2)->_comps.c2 == ((l1)->_comps.c2 & (l2)->_comps.c2) && \
22845916cd2Sjpk 	(l2)->_comps.c3 == ((l1)->_comps.c3 & (l2)->_comps.c3) && \
22945916cd2Sjpk 	(l2)->_comps.c4 == ((l1)->_comps.c4 & (l2)->_comps.c4) && \
23045916cd2Sjpk 	(l2)->_comps.c5 == ((l1)->_comps.c5 & (l2)->_comps.c5) && \
23145916cd2Sjpk 	(l2)->_comps.c6 == ((l1)->_comps.c6 & (l2)->_comps.c6) && \
23245916cd2Sjpk 	(l2)->_comps.c7 == ((l1)->_comps.c7 & (l2)->_comps.c7) && \
23345916cd2Sjpk 	(l2)->_comps.c8 == ((l1)->_comps.c8 & (l2)->_comps.c8))
23445916cd2Sjpk 
23545916cd2Sjpk /* Does the level of l1 strictly dominate that of l2? */
23645916cd2Sjpk #define	BLSTRICTDOM(l1, l2) (!BLEQUAL(l1, l2) && BLDOMINATES(l1, l2))
23745916cd2Sjpk 
23845916cd2Sjpk /* Is the level of l within the range r? */
23945916cd2Sjpk #define	BLINRANGE(l, r)\
24045916cd2Sjpk 	(BLDOMINATES((l), &((r)->lower_bound)) && \
24145916cd2Sjpk 	BLDOMINATES(&((r)->upper_bound), (l)))
24245916cd2Sjpk 
24345916cd2Sjpk /* Least Upper Bound level l1 and l2 replacing l1 with the result. */
24445916cd2Sjpk #define	BLMAXIMUM(l1, l2) \
24545916cd2Sjpk 	_BLMAXIMUM((_mac_label_impl_t *)(l1), (_mac_label_impl_t *)(l2))
24645916cd2Sjpk 
24745916cd2Sjpk #define	_BLMAXIMUM(l1, l2)\
24845916cd2Sjpk 	(((l1)->_lclass = (LCLASS(l1) < LCLASS(l2)) ? \
24945916cd2Sjpk 	(l2)->_lclass : (l1)->_lclass), \
25045916cd2Sjpk 	(l1)->_comps.c1 |= (l2)->_comps.c1, \
25145916cd2Sjpk 	(l1)->_comps.c2 |= (l2)->_comps.c2, \
25245916cd2Sjpk 	(l1)->_comps.c3 |= (l2)->_comps.c3, \
25345916cd2Sjpk 	(l1)->_comps.c4 |= (l2)->_comps.c4, \
25445916cd2Sjpk 	(l1)->_comps.c5 |= (l2)->_comps.c5, \
25545916cd2Sjpk 	(l1)->_comps.c6 |= (l2)->_comps.c6, \
25645916cd2Sjpk 	(l1)->_comps.c7 |= (l2)->_comps.c7, \
25745916cd2Sjpk 	(l1)->_comps.c8 |= (l2)->_comps.c8)
25845916cd2Sjpk 
25945916cd2Sjpk /* Greatest Lower Bound level l1 and l2 replacing l1 with the result. */
26045916cd2Sjpk #define	BLMINIMUM(l1, l2) \
26145916cd2Sjpk 	_BLMINIMUM((_mac_label_impl_t *)(l1), (_mac_label_impl_t *)(l2))
26245916cd2Sjpk 
26345916cd2Sjpk #define	_BLMINIMUM(l1, l2)\
26445916cd2Sjpk 	(((l1)->_lclass = (LCLASS(l1) > LCLASS(l2)) ? \
26545916cd2Sjpk 	(l2)->_lclass : (l1)->_lclass), \
26645916cd2Sjpk 	(l1)->_comps.c1 &= (l2)->_comps.c1, \
26745916cd2Sjpk 	(l1)->_comps.c2 &= (l2)->_comps.c2, \
26845916cd2Sjpk 	(l1)->_comps.c3 &= (l2)->_comps.c3, \
26945916cd2Sjpk 	(l1)->_comps.c4 &= (l2)->_comps.c4, \
27045916cd2Sjpk 	(l1)->_comps.c5 &= (l2)->_comps.c5, \
27145916cd2Sjpk 	(l1)->_comps.c6 &= (l2)->_comps.c6, \
27245916cd2Sjpk 	(l1)->_comps.c7 &= (l2)->_comps.c7, \
27345916cd2Sjpk 	(l1)->_comps.c8 &= (l2)->_comps.c8)
27445916cd2Sjpk 
27545916cd2Sjpk /* Create Manifest Labels */
27645916cd2Sjpk 
27745916cd2Sjpk /* Write a System_Low CMW Label into this memory. */
27845916cd2Sjpk #define	BCLLOW(l) (BSLLOW(BCLTOSL(l)), BILLOW(BCLTOIL(l)))
27945916cd2Sjpk 
28045916cd2Sjpk /* Write a System_Low Sensitivity Label into this memory. */
28145916cd2Sjpk #define	BSLLOW(l) _BSLLOW((_bslabel_impl_t *)(l))
28245916cd2Sjpk 
28345916cd2Sjpk #define	_BSLLOW(l) \
28445916cd2Sjpk 	((l)->id = SUN_SL_ID, (l)->_c_len = _C_LEN, LCLASS_SET(l, LOW_CLASS), \
28545916cd2Sjpk 	(l)->_comps.c1 = (l)->_comps.c2 = (l)->_comps.c3 = (l)->_comps.c4 = \
28645916cd2Sjpk 	(l)->_comps.c5 = (l)->_comps.c6 = (l)->_comps.c7 = (l)->_comps.c8 = \
28745916cd2Sjpk 	EMPTY_SET)
28845916cd2Sjpk 
28945916cd2Sjpk /* Write a System_High Sensitivity Label into this memory. */
29045916cd2Sjpk #define	BSLHIGH(l) _BSLHIGH((_bslabel_impl_t *)(l))
29145916cd2Sjpk 
29245916cd2Sjpk #define	_BSLHIGH(l) \
29345916cd2Sjpk 	((l)->id = SUN_SL_ID, (l)->_c_len = _C_LEN, LCLASS_SET(l, HIGH_CLASS), \
29445916cd2Sjpk 	(l)->_comps.c1 = (l)->_comps.c2 = (l)->_comps.c3 = (l)->_comps.c4 = \
29545916cd2Sjpk 	(l)->_comps.c5 = (l)->_comps.c6 = (l)->_comps.c7 = (l)->_comps.c8 = \
29645916cd2Sjpk 	UNIVERSAL_SET)
29745916cd2Sjpk 
29845916cd2Sjpk /* Write a System_Low Information Label into this memory. */
29945916cd2Sjpk #define	BILLOW(l) _BILLOW((_bilabel_impl_t *)(l))
30045916cd2Sjpk 
30145916cd2Sjpk #define	_BILLOW(l) \
30245916cd2Sjpk 	((l)->_iid = SUN_IL_ID, (l)->_i_c_len = _C_LEN, \
30345916cd2Sjpk 	ICLASS_SET(l, LOW_CLASS), \
30445916cd2Sjpk 	(l)->_icomps.c1 = (l)->_icomps.c2 = (l)->_icomps.c3 = \
30545916cd2Sjpk 	(l)->_icomps.c4 = (l)->_icomps.c5 = (l)->_icomps.c6 = \
30645916cd2Sjpk 	(l)->_icomps.c7 = (l)->_icomps.c8 = EMPTY_SET, \
30745916cd2Sjpk 	(l)->_imarks.m1 = (l)->_imarks.m2 = (l)->_imarks.m3 = \
30845916cd2Sjpk 	(l)->_imarks.m4 = (l)->_imarks.m5 = (l)->_imarks.m6 = \
30945916cd2Sjpk 	(l)->_imarks.m7 = (l)->_imarks.m8 = EMPTY_SET)
31045916cd2Sjpk 
31145916cd2Sjpk 
31245916cd2Sjpk /* Write a System_Low Sensitivity Label into this memory. */
31345916cd2Sjpk #define	BCLEARLOW(l) _BCLEARLOW((_bclear_impl_t *)(l))
31445916cd2Sjpk 
31545916cd2Sjpk #define	_BCLEARLOW(c) \
31645916cd2Sjpk 	((c)->id = SUN_CLR_ID, (c)->_c_len = _C_LEN, \
31745916cd2Sjpk 	LCLASS_SET(c, LOW_CLASS), \
31845916cd2Sjpk 	(c)->_comps.c1 = (c)->_comps.c2 = (c)->_comps.c3 = (c)->_comps.c4 = \
31945916cd2Sjpk 	(c)->_comps.c5 = (c)->_comps.c6 = (c)->_comps.c7 = (c)->_comps.c8 = \
32045916cd2Sjpk 	EMPTY_SET)
32145916cd2Sjpk 
32245916cd2Sjpk /* Write a System_High Sensitivity Label into this memory. */
32345916cd2Sjpk #define	BCLEARHIGH(l) _BCLEARHIGH((_bclear_impl_t *)(l))
32445916cd2Sjpk 
32545916cd2Sjpk #define	_BCLEARHIGH(c) \
32645916cd2Sjpk 	((c)->id = SUN_CLR_ID, (c)->_c_len = _C_LEN, \
32745916cd2Sjpk 	LCLASS_SET(c, HIGH_CLASS), \
32845916cd2Sjpk 	(c)->_comps.c1 = (c)->_comps.c2 = (c)->_comps.c3 = (c)->_comps.c4 = \
32945916cd2Sjpk 	(c)->_comps.c5 = (c)->_comps.c6 = (c)->_comps.c7 = (c)->_comps.c8 = \
33045916cd2Sjpk 	UNIVERSAL_SET)
33145916cd2Sjpk 
33245916cd2Sjpk /* Write an undefined Sensitivity Label into this memory. */
33345916cd2Sjpk #define	BSLUNDEF(l) (((_bslabel_impl_t *)(l))->id = SUN_SL_UN)
33445916cd2Sjpk 
33545916cd2Sjpk /* Write an undefined Clearance into this memory. */
33645916cd2Sjpk #define	BCLEARUNDEF(c) (((_bclear_impl_t *)(c))->id = SUN_CLR_UN)
33745916cd2Sjpk 
33845916cd2Sjpk /* Retrieve the Sensitivity Label portion of a CMW Label */
33945916cd2Sjpk #define	BCLTOSL(l) ((bslabel_t *)&((_bclabel_impl_t *)(l))->_bcl_sl)
34045916cd2Sjpk 
34145916cd2Sjpk /* Retrieve the Information Label portion of a CMW Label */
34245916cd2Sjpk #define	BCLTOIL(l) ((_bilabel_impl_t *)&((_bclabel_impl_t *)(l))->_bcl_il)
34345916cd2Sjpk 
34445916cd2Sjpk /* Copy the Sensitivity Label portion from a CMW Label */
34545916cd2Sjpk #define	GETCSL(l1, l2) \
34645916cd2Sjpk 	(*((_bslabel_impl_t *)(l1)) = ((_bclabel_impl_t *)(l2))->_bcl_sl)
34745916cd2Sjpk 
34845916cd2Sjpk /* Replace the Sensitivity Label portion of a CMW Label */
34945916cd2Sjpk #define	SETCSL(l1, l2) \
35045916cd2Sjpk 	(((_bclabel_impl_t *)(l1))->_bcl_sl = *((_bslabel_impl_t *)(l2)))
35145916cd2Sjpk 
35245916cd2Sjpk /* Set type of this memory to the label type 't' */
35345916cd2Sjpk #define	SETBLTYPE(l, t) (((_bclabel_impl_t *)(l))->_bcl_sl.id = (t))
35445916cd2Sjpk 
35545916cd2Sjpk #define	GETBLTYPE(l)	(((const _bclabel_impl_t *)(l))->_bcl_sl.id)
35645916cd2Sjpk 
35745916cd2Sjpk #ifdef	__cplusplus
35845916cd2Sjpk }
35945916cd2Sjpk #endif
36045916cd2Sjpk 
36145916cd2Sjpk #endif	/* !_LABEL_MACRO_H */
362