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