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