xref: /illumos-gate/usr/src/uts/common/sys/des.h (revision c5bab7026b8e0ac44b25ee08507ea360f177d844)
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 /*
23  * Copyright 1998 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1983-1989 AT&T	*/
28 /*	  All Rights Reserved	*/
29 
30 /*
31  * Portions of this source code were derived from Berkeley 4.3 BSD
32  * under license from the Regents of the University of California.
33  */
34 
35 #ifndef _SYS_DES_H
36 #define	_SYS_DES_H
37 
38 /*
39  * Generic DES driver interface
40  * Keep this file hardware independent!
41  */
42 
43 #include <sys/ioccom.h>
44 
45 #ifdef	__cplusplus
46 extern "C" {
47 #endif
48 
49 #define	DES_MAXLEN 	65536	/* maximum # of bytes to encrypt  */
50 #define	DES_QUICKLEN	16	/* maximum # of bytes to encrypt quickly */
51 
52 enum desdir { ENCRYPT, DECRYPT };
53 enum desmode { CBC, ECB };
54 
55 /*
56  * parameters to ioctl call
57  */
58 struct desparams {
59 	uchar_t des_key[8];	/* key (with low bit parity) */
60 	enum desdir des_dir;	/* direction */
61 	enum desmode des_mode;	/* mode */
62 	uchar_t des_ivec[8];	/* input vector */
63 	unsigned des_len;	/* number of bytes to crypt */
64 	union {
65 		uchar_t UDES_data[DES_QUICKLEN];
66 		uchar_t *UDES_buf;
67 	} UDES;
68 #define	des_data	UDES.UDES_data	/* direct data here if quick */
69 #define	des_buf		UDES.UDES_buf	/* otherwise, pointer to data */
70 };
71 
72 /*
73  * Encrypt an arbitrary sized buffer
74  */
75 #define	DESIOCBLOCK	_IOWR('d', 6, struct desparams)
76 
77 /*
78  * Encrypt of small amount of data, quickly
79  */
80 #define	DESIOCQUICK	_IOWR('d', 7, struct desparams)
81 
82 #ifdef	__cplusplus
83 }
84 #endif
85 
86 #endif	/* _SYS_DES_H */
87