xref: /titanic_52/usr/src/uts/common/des/des.h (revision bdfc6d18da790deeec2e0eb09c625902defe2498)
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_DES_H
35 #define	_SYS_DES_H
36 
37 #pragma ident	"%Z%%M%	%I%	%E% SMI"
38 
39 /*
40  * Generic DES driver interface
41  * Keep this file hardware independent!
42  */
43 
44 #include <sys/ioccom.h>
45 
46 #ifdef	__cplusplus
47 extern "C" {
48 #endif
49 
50 #define	DES_MAXLEN 	65536	/* maximum # of bytes to encrypt  */
51 #define	DES_QUICKLEN	16	/* maximum # of bytes to encrypt quickly */
52 
53 enum desdir { ENCRYPT, DECRYPT };
54 enum desmode { CBC, ECB };
55 
56 /*
57  * parameters to ioctl call
58  */
59 struct desparams {
60 	uchar_t des_key[8];	/* key (with low bit parity) */
61 	enum desdir des_dir;	/* direction */
62 	enum desmode des_mode;	/* mode */
63 	uchar_t des_ivec[8];	/* input vector */
64 	unsigned int des_len;	/* number of bytes to crypt */
65 	union {
66 		uchar_t UDES_data[DES_QUICKLEN];
67 		uchar_t *UDES_buf;
68 	} UDES;
69 #define	des_data	UDES.UDES_data	/* direct data here if quick */
70 #define	des_buf		UDES.UDES_buf	/* otherwise, pointer to data */
71 };
72 
73 /*
74  * Encrypt an arbitrary sized buffer
75  */
76 #define	DESIOCBLOCK	_IOWR('d', 6, struct desparams)
77 
78 /*
79  * Encrypt of small amount of data, quickly
80  */
81 #define	DESIOCQUICK	_IOWR('d', 7, struct desparams)
82 
83 #ifdef	__cplusplus
84 }
85 #endif
86 
87 #endif	/* _SYS_DES_H */
88