xref: /illumos-gate/usr/src/uts/common/des/softdes.h (revision 45ede40b2394db7967e59f19288fae9b62efd4aa)
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 #ifdef	__cplusplus
38 extern "C" {
39 #endif
40 
41 /*
42  * softdes.h,  Data types and definition for software DES
43  */
44 
45 /*
46  * A chunk is an area of storage used in three different ways
47  * - As a 64 bit quantity (in high endian notation)
48  * - As a 48 bit quantity (6 low order bits per byte)
49  * - As a 32 bit quantity (first 4 bytes)
50  */
51 typedef union {
52 	struct {
53 /*
54  * This (and the one farther down) looks awfully backwards???
55  */
56 #ifdef _LONG_LONG_LTOH
57 		uint32_t	_long1;
58 		uint32_t	_long0;
59 #else
60 		uint32_t	_long0;
61 		uint32_t	_long1;
62 #endif
63 	} _longs;
64 
65 #define	long0	_longs._long0
66 #define	long1	_longs._long1
67 	struct {
68 #ifdef _LONG_LONG_LTOH
69 		uchar_t	_byte7;
70 		uchar_t	_byte6;
71 		uchar_t	_byte5;
72 		uchar_t	_byte4;
73 		uchar_t	_byte3;
74 		uchar_t	_byte2;
75 		uchar_t	_byte1;
76 		uchar_t	_byte0;
77 #else
78 		uchar_t	_byte0;
79 		uchar_t	_byte1;
80 		uchar_t	_byte2;
81 		uchar_t	_byte3;
82 		uchar_t	_byte4;
83 		uchar_t	_byte5;
84 		uchar_t	_byte6;
85 		uchar_t	_byte7;
86 #endif
87 	} _bytes;
88 #define	byte0	_bytes._byte0
89 #define	byte1	_bytes._byte1
90 #define	byte2	_bytes._byte2
91 #define	byte3	_bytes._byte3
92 #define	byte4	_bytes._byte4
93 #define	byte5	_bytes._byte5
94 #define	byte6	_bytes._byte6
95 #define	byte7	_bytes._byte7
96 } chunk_t;
97 
98 /*
99  * Intermediate key storage
100  * Created by des_setkey, used by des_encrypt and des_decrypt
101  * 16 48 bit values
102  */
103 struct deskeydata {
104 	chunk_t	keyval[16];
105 };
106 
107 #ifdef	__cplusplus
108 }
109 #endif
110 
111 #endif	/* _SYS_SOFTDES_H */
112