Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:13:01

0001 /*  @(#)des.h   2.2 88/08/10 4.0 RPCSRC; from 2.7 88/02/08 SMI  */
0002 /* $FreeBSD: src/include/rpc/des.h,v 1.4 2002/03/23 17:24:55 imp Exp $ */
0003 /*
0004  * Copyright (c) 2009, Sun Microsystems, Inc.
0005  * All rights reserved.
0006  *
0007  * Redistribution and use in source and binary forms, with or without
0008  * modification, are permitted provided that the following conditions are met:
0009  * - Redistributions of source code must retain the above copyright notice,
0010  *   this list of conditions and the following disclaimer.
0011  * - Redistributions in binary form must reproduce the above copyright notice,
0012  *   this list of conditions and the following disclaimer in the documentation
0013  *   and/or other materials provided with the distribution.
0014  * - Neither the name of Sun Microsystems, Inc. nor the names of its
0015  *   contributors may be used to endorse or promote products derived
0016  *   from this software without specific prior written permission.
0017  *
0018  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0019  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0020  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0021  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
0022  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0023  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0024  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0025  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0026  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0027  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0028  * POSSIBILITY OF SUCH DAMAGE.
0029  */
0030 /*
0031  * Generic DES driver interface
0032  * Keep this file hardware independent!
0033  * Copyright (c) 1986 by Sun Microsystems, Inc.
0034  */
0035 
0036 #ifndef _RPC_DES_H_
0037 #define _RPC_DES_H_
0038 
0039 #define DES_MAXLEN  65536   /* maximum # of bytes to encrypt  */
0040 #define DES_QUICKLEN    16  /* maximum # of bytes to encrypt quickly */
0041 
0042 enum desdir { ENCRYPT, DECRYPT };
0043 enum desmode { CBC, ECB };
0044 
0045 /*
0046  * parameters to ioctl call
0047  */
0048 struct desparams {
0049     u_char des_key[8];  /* key (with low bit parity) */
0050     enum desdir des_dir;    /* direction */
0051     enum desmode des_mode;  /* mode */
0052     u_char des_ivec[8]; /* input vector */
0053     unsigned des_len;   /* number of bytes to crypt */
0054     union {
0055         u_char UDES_data[DES_QUICKLEN];
0056         u_char *UDES_buf;
0057     } UDES;
0058 #   define des_data UDES.UDES_data  /* direct data here if quick */
0059 #   define des_buf  UDES.UDES_buf   /* otherwise, pointer to data */
0060 };
0061 
0062 #ifdef notdef
0063 
0064 /*
0065  * These ioctls are only implemented in SunOS. Maybe someday
0066  * if somebody writes a driver for DES hardware that works
0067  * with FreeBSD, we can being that back.
0068  */
0069 
0070 /*
0071  * Encrypt an arbitrary sized buffer
0072  */
0073 #define DESIOCBLOCK _IOWR('d', 6, struct desparams)
0074 
0075 /* 
0076  * Encrypt of small amount of data, quickly
0077  */
0078 #define DESIOCQUICK _IOWR('d', 7, struct desparams) 
0079 
0080 #endif
0081 
0082 /*
0083  * Software DES.
0084  */
0085 extern int _des_crypt( char *, unsigned, struct desparams * );
0086 
0087 #endif