Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/tirpc/rpcsvc/crypt.x is written in an unsupported language. File is not indexed.

0001 /*
0002  * Copyright (c) 1996
0003  *      Bill Paul <wpaul@ctr.columbia.edu>.  All rights reserved.
0004  *
0005  * Redistribution and use in source and binary forms, with or without
0006  * modification, are permitted provided that the following conditions
0007  * are met:
0008  * 1. Redistributions of source code must retain the above copyright
0009  *    notice, this list of conditions and the following disclaimer.
0010  * 2. Redistributions in binary form must reproduce the above copyright
0011  *    notice, this list of conditions and the following disclaimer in the
0012  *    documentation and/or other materials provided with the distribution.
0013  * 3. All advertising materials mentioning features or use of this software
0014  *    must display the following acknowledgement:
0015  *      This product includes software developed by Bill Paul.
0016  * 4. Neither the name of the author nor the names of any co-contributors
0017  *    may be used to endorse or promote products derived from this software
0018  *    without specific prior written permission.
0019  *
0020  * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
0021  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0022  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0023  * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR CONTRIBUTORS BE LIABLE
0024  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0025  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
0026  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0027  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0028  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
0029  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0030  * SUCH DAMAGE.
0031  */
0032 
0033 #ifndef RPC_HDR
0034 %#include <sys/cdefs.h>
0035 %__FBSDID("$FreeBSD: src/include/rpcsvc/crypt.x,v 1.5 2003/05/04 02:51:42 obrien Exp $");
0036 #endif
0037 
0038 /*
0039  * This protocol definition exists because of the U.S. government and
0040  * its stupid export laws. We can't export DES code from the United
0041  * States to other countries (even though the code already exists
0042  * outside the U.S. -- go figure that one out) but we need to make
0043  * Secure RPC work. The normal way around this is to break the DES
0044  * code out into a shared library; we can then provide a dummy lib
0045  * in the base OS and provide the real lib in the secure dist, which
0046  * the user can install later. But we need Secure RPC for NIS+, and
0047  * there are several system programs that use NIS+ which are statically
0048  * linked. We would have to provide replacements for these programs
0049  * in the secure dist, but there are a lot, and this is a pain. The
0050  * shared lib trick won't work for these programs, and we can't change
0051  * them once they're compiled.
0052  *
0053  * One solution for this problem is to do the DES encryption as a system
0054  * call; no programs need to be changed and we can even supply the DES
0055  * support as an LKM. But this bloats the kernel. Maybe if we have
0056  * Secure NFS one day this will be worth it, but for now we should keep
0057  * this mess in user space.
0058  *
0059  * So we have this second solution: we provide a server that does the
0060  * DES encryption for us. In this case, the server is keyserv (we need
0061  * it to make Secure RPC work anyway) and we use this protocol to ship
0062  * the data back and forth between keyserv and the application.
0063  */
0064 
0065 enum des_dir { ENCRYPT_DES, DECRYPT_DES };
0066 enum des_mode { CBC_DES, ECB_DES };
0067 
0068 struct desargs {
0069         u_char des_key[8];      /* key (with low bit parity) */
0070         des_dir des_dir;        /* direction */
0071         des_mode des_mode;      /* mode */
0072         u_char des_ivec[8];     /* input vector */
0073         opaque desbuf<>;
0074 };
0075 
0076 struct desresp {
0077         opaque desbuf<>;
0078         u_char des_ivec[8];
0079         int stat;
0080 };
0081 
0082 program CRYPT_PROG {
0083         version CRYPT_VERS {
0084                 desresp
0085                 DES_CRYPT(desargs) = 1;
0086         } = 1; 
0087 } = 600100029;