xref: /titanic_50/usr/src/lib/libbc/inc/include/sys/des.h (revision 554ff184129088135ad2643c1c9832174a17be88)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
23 
24 /*
25  * Generic DES driver interface
26  * Keep this file hardware independent!
27  * Copyright (c) 1986 by Sun Microsystems, Inc.
28  */
29 
30 #ifndef _sys_des_h
31 #define _sys_des_h
32 
33 #define DES_MAXLEN 	65536	/* maximum # of bytes to encrypt  */
34 #define DES_QUICKLEN	16	/* maximum # of bytes to encrypt quickly */
35 
36 enum desdir { ENCRYPT, DECRYPT };
37 enum desmode { CBC, ECB };
38 
39 /*
40  * parameters to ioctl call
41  */
42 struct desparams {
43 	u_char des_key[8];	/* key (with low bit parity) */
44 	enum desdir des_dir;	/* direction */
45 	enum desmode des_mode;	/* mode */
46 	u_char des_ivec[8];	/* input vector */
47 	unsigned des_len;	/* number of bytes to crypt */
48 	union {
49 		u_char UDES_data[DES_QUICKLEN];
50 		u_char *UDES_buf;
51 	} UDES;
52 #	define des_data UDES.UDES_data	/* direct data here if quick */
53 #	define des_buf	UDES.UDES_buf	/* otherwise, pointer to data */
54 };
55 
56 /*
57  * Encrypt an arbitrary sized buffer
58  */
59 #define	DESIOCBLOCK	_IOWR(d, 6, struct desparams)
60 
61 /*
62  * Encrypt of small amount of data, quickly
63  */
64 #define DESIOCQUICK	_IOWR(d, 7, struct desparams)
65 
66 #endif /*!_sys_des_h*/
67