xref: /freebsd-src/include/rpcsvc/crypt.x (revision 5b31cc94b10d4bb7109c6b27940a0fc76a44a331)
1*3b0f7467SBill Paul /*
2*3b0f7467SBill Paul  * Copyright (c) 1996
3*3b0f7467SBill Paul  *	Bill Paul <wpaul@ctr.columbia.edu>.  All rights reserved.
4*3b0f7467SBill Paul  *
5*3b0f7467SBill Paul  * Redistribution and use in source and binary forms, with or without
6*3b0f7467SBill Paul  * modification, are permitted provided that the following conditions
7*3b0f7467SBill Paul  * are met:
8*3b0f7467SBill Paul  * 1. Redistributions of source code must retain the above copyright
9*3b0f7467SBill Paul  *    notice, this list of conditions and the following disclaimer.
10*3b0f7467SBill Paul  * 2. Redistributions in binary form must reproduce the above copyright
11*3b0f7467SBill Paul  *    notice, this list of conditions and the following disclaimer in the
12*3b0f7467SBill Paul  *    documentation and/or other materials provided with the distribution.
13*3b0f7467SBill Paul  * 3. All advertising materials mentioning features or use of this software
14*3b0f7467SBill Paul  *    must display the following acknowledgement:
15*3b0f7467SBill Paul  *	This product includes software developed by Bill Paul.
16*3b0f7467SBill Paul  * 4. Neither the name of the author nor the names of any co-contributors
17*3b0f7467SBill Paul  *    may be used to endorse or promote products derived from this software
18*3b0f7467SBill Paul  *    without specific prior written permission.
19*3b0f7467SBill Paul  *
20*3b0f7467SBill Paul  * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
21*3b0f7467SBill Paul  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22*3b0f7467SBill Paul  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23*3b0f7467SBill Paul  * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR CONTRIBUTORS BE LIABLE
24*3b0f7467SBill Paul  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25*3b0f7467SBill Paul  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26*3b0f7467SBill Paul  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27*3b0f7467SBill Paul  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28*3b0f7467SBill Paul  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29*3b0f7467SBill Paul  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30*3b0f7467SBill Paul  * SUCH DAMAGE.
31*3b0f7467SBill Paul  */
32*3b0f7467SBill Paul 
33*3b0f7467SBill Paul /*
34*3b0f7467SBill Paul  * This protocol definition exists because of the U.S. government and
35*3b0f7467SBill Paul  * its stupid export laws. We can't export DES code from the United
36*3b0f7467SBill Paul  * States to other countries (even though the code already exists
37*3b0f7467SBill Paul  * outside the U.S. -- go figure that one out) but we need to make
38*3b0f7467SBill Paul  * Secure RPC work. The normal way around this is to break the DES
39*3b0f7467SBill Paul  * code out into a shared library; we can then provide a dummy lib
40*3b0f7467SBill Paul  * in the base OS and provide the real lib in the secure dist, which
41*3b0f7467SBill Paul  * the user can install later. But we need Secure RPC for NIS+, and
42*3b0f7467SBill Paul  * there are several system programs that use NIS+ which are statically
43*3b0f7467SBill Paul  * linked. We would have to provide replacements for these programs
44*3b0f7467SBill Paul  * in the secure dist, but there are a lot, and this is a pain. The
45*3b0f7467SBill Paul  * shared lib trick won't work for these programs, and we can't change
46*3b0f7467SBill Paul  * them once they're compiled.
47*3b0f7467SBill Paul  *
48*3b0f7467SBill Paul  * One solution for this problem is to do the DES encryption as a system
49*3b0f7467SBill Paul  * call; no programs need to be changed and we can even supply the DES
50*3b0f7467SBill Paul  * support as an LKM. But this bloats the kernel. Maybe if we have
51*3b0f7467SBill Paul  * Secure NFS one day this will be worth it, but for now we should keep
52*3b0f7467SBill Paul  * this mess in user space.
53*3b0f7467SBill Paul  *
54*3b0f7467SBill Paul  * So we have this second solution: we provide a server that does the
55*3b0f7467SBill Paul  * DES encryption for us. In this case, the server is keyserv (we need
56*3b0f7467SBill Paul  * it to make Secure RPC work anyway) and we use this protocol to ship
57*3b0f7467SBill Paul  * the data back and forth between keyserv and the application.
58*3b0f7467SBill Paul  */
59*3b0f7467SBill Paul 
60*3b0f7467SBill Paul enum des_dir { ENCRYPT_DES, DECRYPT_DES };
61*3b0f7467SBill Paul enum des_mode { CBC_DES, ECB_DES };
62*3b0f7467SBill Paul 
63*3b0f7467SBill Paul struct desargs {
64*3b0f7467SBill Paul 	u_char des_key[8];	/* key (with low bit parity) */
65*3b0f7467SBill Paul 	des_dir des_dir;	/* direction */
66*3b0f7467SBill Paul 	des_mode des_mode;	/* mode */
67*3b0f7467SBill Paul 	u_char des_ivec[8];	/* input vector */
68*3b0f7467SBill Paul 	opaque desbuf<>;
69*3b0f7467SBill Paul };
70*3b0f7467SBill Paul 
71*3b0f7467SBill Paul struct desresp {
72*3b0f7467SBill Paul 	opaque desbuf<>;
73*3b0f7467SBill Paul 	u_char des_ivec[8];
74*3b0f7467SBill Paul 	int stat;
75*3b0f7467SBill Paul };
76*3b0f7467SBill Paul 
77*3b0f7467SBill Paul program CRYPT_PROG {
78*3b0f7467SBill Paul 	version CRYPT_VERS {
79*3b0f7467SBill Paul 		desresp
80*3b0f7467SBill Paul 		DES_CRYPT(desargs) = 1;
81*3b0f7467SBill Paul 	} = 1;
82*3b0f7467SBill Paul } = 600100029;
83