1f7e2700fSBill Paul /* @(#)des.h 2.2 88/08/10 4.0 RPCSRC; from 2.7 88/02/08 SMI */ 2c7a63613SPeter Wemm /* $FreeBSD$ */ 3f7e2700fSBill Paul /* 4f7e2700fSBill Paul * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 5f7e2700fSBill Paul * unrestricted use provided that this legend is included on all tape 6f7e2700fSBill Paul * media and as a part of the software program in whole or part. Users 7f7e2700fSBill Paul * may copy or modify Sun RPC without charge, but are not authorized 8f7e2700fSBill Paul * to license or distribute it to anyone else except as part of a product or 9f7e2700fSBill Paul * program developed by the user. 10f7e2700fSBill Paul * 11f7e2700fSBill Paul * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE 12f7e2700fSBill Paul * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 13f7e2700fSBill Paul * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. 14f7e2700fSBill Paul * 15f7e2700fSBill Paul * Sun RPC is provided with no support and without any obligation on the 16f7e2700fSBill Paul * part of Sun Microsystems, Inc. to assist in its use, correction, 17f7e2700fSBill Paul * modification or enhancement. 18f7e2700fSBill Paul * 19f7e2700fSBill Paul * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE 20f7e2700fSBill Paul * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC 21f7e2700fSBill Paul * OR ANY PART THEREOF. 22f7e2700fSBill Paul * 23f7e2700fSBill Paul * In no event will Sun Microsystems, Inc. be liable for any lost revenue 24f7e2700fSBill Paul * or profits or other special, indirect and consequential damages, even if 25f7e2700fSBill Paul * Sun has been advised of the possibility of such damages. 26f7e2700fSBill Paul * 27f7e2700fSBill Paul * Sun Microsystems, Inc. 28f7e2700fSBill Paul * 2550 Garcia Avenue 29f7e2700fSBill Paul * Mountain View, California 94043 30f7e2700fSBill Paul */ 31f7e2700fSBill Paul /* 32f7e2700fSBill Paul * Generic DES driver interface 33f7e2700fSBill Paul * Keep this file hardware independent! 34f7e2700fSBill Paul * Copyright (c) 1986 by Sun Microsystems, Inc. 35f7e2700fSBill Paul */ 36f7e2700fSBill Paul 37f7e2700fSBill Paul #define DES_MAXLEN 65536 /* maximum # of bytes to encrypt */ 38f7e2700fSBill Paul #define DES_QUICKLEN 16 /* maximum # of bytes to encrypt quickly */ 39f7e2700fSBill Paul 40f7e2700fSBill Paul enum desdir { ENCRYPT, DECRYPT }; 41f7e2700fSBill Paul enum desmode { CBC, ECB }; 42f7e2700fSBill Paul 43f7e2700fSBill Paul /* 44f7e2700fSBill Paul * parameters to ioctl call 45f7e2700fSBill Paul */ 46f7e2700fSBill Paul struct desparams { 47f7e2700fSBill Paul u_char des_key[8]; /* key (with low bit parity) */ 48f7e2700fSBill Paul enum desdir des_dir; /* direction */ 49f7e2700fSBill Paul enum desmode des_mode; /* mode */ 50f7e2700fSBill Paul u_char des_ivec[8]; /* input vector */ 51f7e2700fSBill Paul unsigned des_len; /* number of bytes to crypt */ 52f7e2700fSBill Paul union { 53f7e2700fSBill Paul u_char UDES_data[DES_QUICKLEN]; 54f7e2700fSBill Paul u_char *UDES_buf; 55f7e2700fSBill Paul } UDES; 56f7e2700fSBill Paul # define des_data UDES.UDES_data /* direct data here if quick */ 57f7e2700fSBill Paul # define des_buf UDES.UDES_buf /* otherwise, pointer to data */ 58f7e2700fSBill Paul }; 59f7e2700fSBill Paul 606ed6e301SBill Paul #ifdef notdef 616ed6e301SBill Paul 626ed6e301SBill Paul /* 636ed6e301SBill Paul * These ioctls are only implemented in SunOS. Maybe someday 646ed6e301SBill Paul * if somebody writes a driver for DES hardware that works 656ed6e301SBill Paul * with FreeBSD, we can being that back. 666ed6e301SBill Paul */ 676ed6e301SBill Paul 68f7e2700fSBill Paul /* 69f7e2700fSBill Paul * Encrypt an arbitrary sized buffer 70f7e2700fSBill Paul */ 71c7a63613SPeter Wemm #define DESIOCBLOCK _IOWR('d', 6, struct desparams) 72f7e2700fSBill Paul 73f7e2700fSBill Paul /* 74f7e2700fSBill Paul * Encrypt of small amount of data, quickly 75f7e2700fSBill Paul */ 76c7a63613SPeter Wemm #define DESIOCQUICK _IOWR('d', 7, struct desparams) 77f7e2700fSBill Paul 786ed6e301SBill Paul #endif 796ed6e301SBill Paul 80f7e2700fSBill Paul /* 81f7e2700fSBill Paul * Software DES. 82f7e2700fSBill Paul */ 83bb28f3c2SWarner Losh extern int _des_crypt( char *, int, struct desparams * ); 84