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