]> git.saurik.com Git - apple/libc.git/blame_incremental - mach.subproj/servers.subproj/key_defs.h
Libc-166.tar.gz
[apple/libc.git] / mach.subproj / servers.subproj / key_defs.h
... / ...
CommitLineData
1/*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22/*
23 * Mach Operating System
24 * Copyright (c) 1987 Carnegie-Mellon University
25 * All rights reserved. The CMU software License Agreement specifies
26 * the terms and conditions for use and redistribution.
27 */
28
29/*
30 * Definitions of encryption keys etc..
31 */
32
33/*
34 * HISTORY:
35 * 5-Jun-87 Robert Sansom (rds) at Carnegie Mellon University
36 * Added macros to convert keys between network and host order.
37 *
38 * 12-Apr-87 Robert Sansom (rds) at Carnegie Mellon University
39 * Added KEY_IS_NULL.
40 *
41 * 2-Feb-87 Robert Sansom (rds) at Carnegie Mellon University
42 * Added KEY_EQUAL.
43 *
44 * 5-Nov-86 Robert Sansom (rds) at Carnegie-Mellon University
45 * Started.
46 *
47 */
48
49#ifndef _KEY_DEFS_
50#define _KEY_DEFS_
51
52/*
53 * An encrytion key.
54 */
55typedef union {
56 unsigned char key_bytes[16];
57 unsigned long key_longs[4];
58} key_t, *key_ptr_t;
59
60#define KEY_EQUAL(key1, key2) \
61 ((key1.key_longs[0] == key2.key_longs[0]) \
62 && (key1.key_longs[1] == key2.key_longs[1]) \
63 && (key1.key_longs[2] == key2.key_longs[2]) \
64 && (key1.key_longs[3] == key2.key_longs[3]))
65
66#define KEY_IS_NULL(key) \
67 (((key).key_longs[0] == 0) && ((key).key_longs[1] == 0) \
68 && ((key).key_longs[2] == 0) && ((key).key_longs[3] == 0))
69
70
71/*
72 * Macros to convert keys between network and host byte order.
73 */
74#define NTOH_KEY(key) { \
75 (key).key_longs[0] = ntohl((key).key_longs[0]); \
76 (key).key_longs[1] = ntohl((key).key_longs[1]); \
77 (key).key_longs[2] = ntohl((key).key_longs[2]); \
78 (key).key_longs[3] = ntohl((key).key_longs[3]); \
79}
80
81#define HTON_KEY(key) { \
82 (key).key_longs[0] = htonl((key).key_longs[0]); \
83 (key).key_longs[1] = htonl((key).key_longs[1]); \
84 (key).key_longs[2] = htonl((key).key_longs[2]); \
85 (key).key_longs[3] = htonl((key).key_longs[3]); \
86}
87
88/*
89 * Structure used to transmit or store a token or a key.
90 */
91typedef union {
92 key_t si_key;
93 key_t si_token;
94} secure_info_t, *secure_info_ptr_t;
95
96/*
97 * Security Level of ports and messages.
98 */
99#define PORT_NOT_SECURE 0
100#define MESSAGE_NOT_SECURE 0
101
102#endif /* _KEY_DEFS_ */