126209Swpaul/*  @(#)des.h	2.2 88/08/10 4.0 RPCSRC; from 2.7 88/02/08 SMI  */
283265Speter/* $FreeBSD$ */
326209Swpaul/*
426209Swpaul * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
526209Swpaul * unrestricted use provided that this legend is included on all tape
626209Swpaul * media and as a part of the software program in whole or part.  Users
726209Swpaul * may copy or modify Sun RPC without charge, but are not authorized
826209Swpaul * to license or distribute it to anyone else except as part of a product or
926209Swpaul * program developed by the user.
1026209Swpaul *
1126209Swpaul * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
1226209Swpaul * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
1326209Swpaul * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
1426209Swpaul *
1526209Swpaul * Sun RPC is provided with no support and without any obligation on the
1626209Swpaul * part of Sun Microsystems, Inc. to assist in its use, correction,
1726209Swpaul * modification or enhancement.
1826209Swpaul *
1926209Swpaul * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
2026209Swpaul * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
2126209Swpaul * OR ANY PART THEREOF.
2226209Swpaul *
2326209Swpaul * In no event will Sun Microsystems, Inc. be liable for any lost revenue
2426209Swpaul * or profits or other special, indirect and consequential damages, even if
2526209Swpaul * Sun has been advised of the possibility of such damages.
2626209Swpaul *
2726209Swpaul * Sun Microsystems, Inc.
2826209Swpaul * 2550 Garcia Avenue
2926209Swpaul * Mountain View, California  94043
3026209Swpaul */
3126209Swpaul/*
3226209Swpaul * Generic DES driver interface
3326209Swpaul * Keep this file hardware independent!
3426209Swpaul * Copyright (c) 1986 by Sun Microsystems, Inc.
3526209Swpaul */
3626209Swpaul
3726209Swpaul#define DES_MAXLEN 	65536	/* maximum # of bytes to encrypt  */
3826209Swpaul#define DES_QUICKLEN	16	/* maximum # of bytes to encrypt quickly */
3926209Swpaul
4026209Swpaulenum desdir { ENCRYPT, DECRYPT };
4126209Swpaulenum desmode { CBC, ECB };
4226209Swpaul
4326209Swpaul/*
4426209Swpaul * parameters to ioctl call
4526209Swpaul */
4626209Swpaulstruct desparams {
4726209Swpaul	u_char des_key[8];	/* key (with low bit parity) */
4826209Swpaul	enum desdir des_dir;	/* direction */
4926209Swpaul	enum desmode des_mode;	/* mode */
5026209Swpaul	u_char des_ivec[8];	/* input vector */
5126209Swpaul	unsigned des_len;	/* number of bytes to crypt */
5226209Swpaul	union {
5326209Swpaul		u_char UDES_data[DES_QUICKLEN];
5426209Swpaul		u_char *UDES_buf;
5526209Swpaul	} UDES;
5626209Swpaul#	define des_data UDES.UDES_data	/* direct data here if quick */
5726209Swpaul#	define des_buf	UDES.UDES_buf	/* otherwise, pointer to data */
5826209Swpaul};
5926209Swpaul
6039661Swpaul#ifdef notdef
6139661Swpaul
6226209Swpaul/*
6339661Swpaul * These ioctls are only implemented in SunOS. Maybe someday
6439661Swpaul * if somebody writes a driver for DES hardware that works
6539661Swpaul * with FreeBSD, we can being that back.
6639661Swpaul */
6739661Swpaul
6839661Swpaul/*
6926209Swpaul * Encrypt an arbitrary sized buffer
7026209Swpaul */
7183265Speter#define	DESIOCBLOCK	_IOWR('d', 6, struct desparams)
7226209Swpaul
7326209Swpaul/*
7426209Swpaul * Encrypt of small amount of data, quickly
7526209Swpaul */
7683265Speter#define DESIOCQUICK	_IOWR('d', 7, struct desparams)
7726209Swpaul
7839661Swpaul#endif
7939661Swpaul
8026209Swpaul/*
8126209Swpaul * Software DES.
8226209Swpaul */
8393032Simpextern int _des_crypt( char *, int, struct desparams * );
84