xref: /titanic_50/usr/src/uts/common/des/softdes.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  *
22  * Copyright 1998 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
27 /*	  All Rights Reserved  	*/
28 
29 /*
30  * Portions of this source code were derived from Berkeley 4.3 BSD
31  * under license from the Regents of the University of California.
32  */
33 
34 #ifndef _SYS_SOFTDES_H
35 #define	_SYS_SOFTDES_H
36 
37 #pragma ident	"%Z%%M%	%I%	%E% SMI"
38 
39 #ifdef	__cplusplus
40 extern "C" {
41 #endif
42 
43 /*
44  * softdes.h,  Data types and definition for software DES
45  */
46 
47 /*
48  * A chunk is an area of storage used in three different ways
49  * - As a 64 bit quantity (in high endian notation)
50  * - As a 48 bit quantity (6 low order bits per byte)
51  * - As a 32 bit quantity (first 4 bytes)
52  */
53 typedef union {
54 	struct {
55 /*
56  * This (and the one farther down) looks awfully backwards???
57  */
58 #ifdef _LONG_LONG_LTOH
59 		uint32_t	_long1;
60 		uint32_t	_long0;
61 #else
62 		uint32_t	_long0;
63 		uint32_t	_long1;
64 #endif
65 	} _longs;
66 
67 #define	long0	_longs._long0
68 #define	long1	_longs._long1
69 	struct {
70 #ifdef _LONG_LONG_LTOH
71 		uchar_t	_byte7;
72 		uchar_t	_byte6;
73 		uchar_t	_byte5;
74 		uchar_t	_byte4;
75 		uchar_t	_byte3;
76 		uchar_t	_byte2;
77 		uchar_t	_byte1;
78 		uchar_t	_byte0;
79 #else
80 		uchar_t	_byte0;
81 		uchar_t	_byte1;
82 		uchar_t	_byte2;
83 		uchar_t	_byte3;
84 		uchar_t	_byte4;
85 		uchar_t	_byte5;
86 		uchar_t	_byte6;
87 		uchar_t	_byte7;
88 #endif
89 	} _bytes;
90 #define	byte0	_bytes._byte0
91 #define	byte1	_bytes._byte1
92 #define	byte2	_bytes._byte2
93 #define	byte3	_bytes._byte3
94 #define	byte4	_bytes._byte4
95 #define	byte5	_bytes._byte5
96 #define	byte6	_bytes._byte6
97 #define	byte7	_bytes._byte7
98 } chunk_t;
99 
100 /*
101  * Intermediate key storage
102  * Created by des_setkey, used by des_encrypt and des_decrypt
103  * 16 48 bit values
104  */
105 struct deskeydata {
106 	chunk_t	keyval[16];
107 };
108 
109 #ifdef	__cplusplus
110 }
111 #endif
112 
113 #endif	/* _SYS_SOFTDES_H */
114