des.h revision 26209
11573Srgrimes/*  @(#)des.h	2.2 88/08/10 4.0 RPCSRC; from 2.7 88/02/08 SMI  */
21573Srgrimes/*
31573Srgrimes * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
41573Srgrimes * unrestricted use provided that this legend is included on all tape
51573Srgrimes * media and as a part of the software program in whole or part.  Users
61573Srgrimes * may copy or modify Sun RPC without charge, but are not authorized
71573Srgrimes * to license or distribute it to anyone else except as part of a product or
81573Srgrimes * program developed by the user.
91573Srgrimes *
101573Srgrimes * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
111573Srgrimes * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
121573Srgrimes * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
131573Srgrimes *
141573Srgrimes * Sun RPC is provided with no support and without any obligation on the
151573Srgrimes * part of Sun Microsystems, Inc. to assist in its use, correction,
16249808Semaste * modification or enhancement.
171573Srgrimes *
181573Srgrimes * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
191573Srgrimes * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
201573Srgrimes * OR ANY PART THEREOF.
211573Srgrimes *
221573Srgrimes * In no event will Sun Microsystems, Inc. be liable for any lost revenue
231573Srgrimes * or profits or other special, indirect and consequential damages, even if
241573Srgrimes * Sun has been advised of the possibility of such damages.
251573Srgrimes *
261573Srgrimes * Sun Microsystems, Inc.
271573Srgrimes * 2550 Garcia Avenue
281573Srgrimes * Mountain View, California  94043
291573Srgrimes */
301573Srgrimes/*
311573Srgrimes * Generic DES driver interface
321573Srgrimes * Keep this file hardware independent!
331573Srgrimes * Copyright (c) 1986 by Sun Microsystems, Inc.
341573Srgrimes */
351573Srgrimes
3692986Sobrien#define DES_MAXLEN 	65536	/* maximum # of bytes to encrypt  */
3792986Sobrien#define DES_QUICKLEN	16	/* maximum # of bytes to encrypt quickly */
381573Srgrimes
3972373Sdeischenenum desdir { ENCRYPT, DECRYPT };
401573Srgrimesenum desmode { CBC, ECB };
4172373Sdeischen
4272373Sdeischen/*
431573Srgrimes * parameters to ioctl call
44178778Sjhb */
45178778Sjhbstruct desparams {
46178778Sjhb	u_char des_key[8];	/* key (with low bit parity) */
4716586Sjraynard	enum desdir des_dir;	/* direction */
4872373Sdeischen	enum desmode des_mode;	/* mode */
491573Srgrimes	u_char des_ivec[8];	/* input vector */
5072373Sdeischen	unsigned des_len;	/* number of bytes to crypt */
5172373Sdeischen	union {
5272373Sdeischen		u_char UDES_data[DES_QUICKLEN];
5372373Sdeischen		u_char *UDES_buf;
5472373Sdeischen	} UDES;
5572373Sdeischen#	define des_data UDES.UDES_data	/* direct data here if quick */
561573Srgrimes#	define des_buf	UDES.UDES_buf	/* otherwise, pointer to data */
57178721Sjhb};
58178721Sjhb
59178721Sjhb/*
60178721Sjhb * Encrypt an arbitrary sized buffer
61178721Sjhb */
62178721Sjhb#define	DESIOCBLOCK	_IOWR(d, 6, struct desparams)
63178721Sjhb
64/*
65 * Encrypt of small amount of data, quickly
66 */
67#define DESIOCQUICK	_IOWR(d, 7, struct desparams)
68
69/*
70 * Software DES.
71 */
72extern int _des_crypt __P(( char *, int, struct desparams * ));
73