xref: /onnv-gate/usr/src/uts/common/rpc/key_prot.x (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Key server protocol definition
24*0Sstevel@tonic-gate  * Copyright (C) 1990, 1991 Sun Microsystems, Inc.
25*0Sstevel@tonic-gate  *
26*0Sstevel@tonic-gate  * The keyserver is a public key storage/encryption/decryption service
27*0Sstevel@tonic-gate  * The encryption method used is based on the Diffie-Hellman exponential
28*0Sstevel@tonic-gate  * key exchange technology.
29*0Sstevel@tonic-gate  *
30*0Sstevel@tonic-gate  * The key server is local to each machine, akin to the portmapper.
31*0Sstevel@tonic-gate  * Under TI-RPC, communication with the keyserver is through the
32*0Sstevel@tonic-gate  * loopback transport.
33*0Sstevel@tonic-gate  *
34*0Sstevel@tonic-gate  * NOTE: This .x file generates the USER level headers for the keyserver.
35*0Sstevel@tonic-gate  * the KERNEL level headers are created by hand as they kernel has special
36*0Sstevel@tonic-gate  * requirements.
37*0Sstevel@tonic-gate  */
38*0Sstevel@tonic-gate 
39*0Sstevel@tonic-gate %#pragma ident	"%Z%%M%	%I%	%E% SMI"
40*0Sstevel@tonic-gate %
41*0Sstevel@tonic-gate %/* Copyright (c)  1990, 1991 Sun Microsystems, Inc. */
42*0Sstevel@tonic-gate %
43*0Sstevel@tonic-gate %/*
44*0Sstevel@tonic-gate % * Compiled from key_prot.x using rpcgen.
45*0Sstevel@tonic-gate % * DO NOT EDIT THIS FILE!
46*0Sstevel@tonic-gate % * This is NOT source code!
47*0Sstevel@tonic-gate % */
48*0Sstevel@tonic-gate 
49*0Sstevel@tonic-gate /*
50*0Sstevel@tonic-gate  * PROOT and MODULUS define the way the Diffie-Hellman key is generated.
51*0Sstevel@tonic-gate  *
52*0Sstevel@tonic-gate  * MODULUS should be chosen as a prime of the form: MODULUS == 2*p + 1,
53*0Sstevel@tonic-gate  * where p is also prime.
54*0Sstevel@tonic-gate  *
55*0Sstevel@tonic-gate  * PROOT satisfies the following two conditions:
56*0Sstevel@tonic-gate  * (1) (PROOT ** 2) % MODULUS != 1
57*0Sstevel@tonic-gate  * (2) (PROOT ** p) % MODULUS != 1
58*0Sstevel@tonic-gate  *
59*0Sstevel@tonic-gate  */
60*0Sstevel@tonic-gate 
61*0Sstevel@tonic-gate const PROOT = 3;
62*0Sstevel@tonic-gate const HEXMODULUS = "d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b";
63*0Sstevel@tonic-gate 
64*0Sstevel@tonic-gate const HEXKEYBYTES = 48;		/* HEXKEYBYTES == strlen(HEXMODULUS) */
65*0Sstevel@tonic-gate const KEYSIZE = 192;		/* KEYSIZE == bit length of key */
66*0Sstevel@tonic-gate const KEYBYTES = 24;		/* byte length of key */
67*0Sstevel@tonic-gate 
68*0Sstevel@tonic-gate /*
69*0Sstevel@tonic-gate  * The first 16 hex digits of the encrypted secret key are used as
70*0Sstevel@tonic-gate  * a checksum in the database.
71*0Sstevel@tonic-gate  */
72*0Sstevel@tonic-gate const KEYCHECKSUMSIZE = 16;
73*0Sstevel@tonic-gate 
74*0Sstevel@tonic-gate /*
75*0Sstevel@tonic-gate  * status of operation
76*0Sstevel@tonic-gate  */
77*0Sstevel@tonic-gate enum keystatus {
78*0Sstevel@tonic-gate 	KEY_SUCCESS,	/* no problems */
79*0Sstevel@tonic-gate 	KEY_NOSECRET,	/* no secret key stored */
80*0Sstevel@tonic-gate 	KEY_UNKNOWN,	/* unknown netname */
81*0Sstevel@tonic-gate 	KEY_SYSTEMERR, 	/* system error (out of memory, encryption failure) */
82*0Sstevel@tonic-gate 	KEY_BADALG,	/* unknown algorithm type */
83*0Sstevel@tonic-gate 	KEY_BADLEN	/* unsupported keysize */
84*0Sstevel@tonic-gate };
85*0Sstevel@tonic-gate 
86*0Sstevel@tonic-gate typedef opaque keybuf[HEXKEYBYTES];	/* store key in hex */
87*0Sstevel@tonic-gate typedef opaque keybuf3<>;		/* store key in binary */
88*0Sstevel@tonic-gate 
89*0Sstevel@tonic-gate typedef string netnamestr<MAXNETNAMELEN>;
90*0Sstevel@tonic-gate 
91*0Sstevel@tonic-gate /*
92*0Sstevel@tonic-gate  * algorithm type & key size
93*0Sstevel@tonic-gate  */
94*0Sstevel@tonic-gate typedef int keylen_t;
95*0Sstevel@tonic-gate typedef int algtype_t;
96*0Sstevel@tonic-gate 
97*0Sstevel@tonic-gate struct mechtype {
98*0Sstevel@tonic-gate 	keylen_t keylen;
99*0Sstevel@tonic-gate 	algtype_t algtype;
100*0Sstevel@tonic-gate };
101*0Sstevel@tonic-gate 
102*0Sstevel@tonic-gate /*
103*0Sstevel@tonic-gate  * number of keys for KEY_GEN_3 to return
104*0Sstevel@tonic-gate  */
105*0Sstevel@tonic-gate typedef int keynum_t;
106*0Sstevel@tonic-gate 
107*0Sstevel@tonic-gate /*
108*0Sstevel@tonic-gate  * Result of KEY_GEN_3
109*0Sstevel@tonic-gate  */
110*0Sstevel@tonic-gate typedef des_block deskeyarray<>;
111*0Sstevel@tonic-gate 
112*0Sstevel@tonic-gate /*
113*0Sstevel@tonic-gate  * Argument to ENCRYPT or DECRYPT
114*0Sstevel@tonic-gate  */
115*0Sstevel@tonic-gate struct cryptkeyarg {
116*0Sstevel@tonic-gate 	netnamestr remotename;
117*0Sstevel@tonic-gate 	des_block deskey;
118*0Sstevel@tonic-gate };
119*0Sstevel@tonic-gate 
120*0Sstevel@tonic-gate /*
121*0Sstevel@tonic-gate  * Argument to ENCRYPT_PK or DECRYPT_PK
122*0Sstevel@tonic-gate  */
123*0Sstevel@tonic-gate struct cryptkeyarg2 {
124*0Sstevel@tonic-gate 	netnamestr remotename;
125*0Sstevel@tonic-gate 	netobj	remotekey;	/* Contains a length up to 1024 bytes */
126*0Sstevel@tonic-gate 	des_block deskey;
127*0Sstevel@tonic-gate };
128*0Sstevel@tonic-gate 
129*0Sstevel@tonic-gate /*
130*0Sstevel@tonic-gate  * Argument to ENCRYPT_3, ENCRYPT_PK_3, DECRYPT_3, DECRYPT_PK_3
131*0Sstevel@tonic-gate  */
132*0Sstevel@tonic-gate struct cryptkeyarg3 {
133*0Sstevel@tonic-gate 	netnamestr remotename;
134*0Sstevel@tonic-gate 	keybuf3 remotekey;
135*0Sstevel@tonic-gate 	deskeyarray deskey;
136*0Sstevel@tonic-gate 	algtype_t algtype;
137*0Sstevel@tonic-gate 	keylen_t keylen;
138*0Sstevel@tonic-gate };
139*0Sstevel@tonic-gate 
140*0Sstevel@tonic-gate /*
141*0Sstevel@tonic-gate  * Result of ENCRYPT, DECRYPT, ENCRYPT_PK, DECRYPT_PK, KEY_GET_CONV
142*0Sstevel@tonic-gate  */
143*0Sstevel@tonic-gate union cryptkeyres switch (keystatus status) {
144*0Sstevel@tonic-gate case KEY_SUCCESS:
145*0Sstevel@tonic-gate 	des_block deskey;
146*0Sstevel@tonic-gate default:
147*0Sstevel@tonic-gate 	void;
148*0Sstevel@tonic-gate };
149*0Sstevel@tonic-gate 
150*0Sstevel@tonic-gate /*
151*0Sstevel@tonic-gate  * Result of ENCRYPT_3, DECRYPT_3, ENCRYPT_PK_3, DECRYPT_PK_3, KEY_GET_CONV_3
152*0Sstevel@tonic-gate  */
153*0Sstevel@tonic-gate union cryptkeyres3 switch (keystatus status) {
154*0Sstevel@tonic-gate case KEY_SUCCESS:
155*0Sstevel@tonic-gate 	deskeyarray deskey;
156*0Sstevel@tonic-gate default:
157*0Sstevel@tonic-gate 	void;
158*0Sstevel@tonic-gate };
159*0Sstevel@tonic-gate 
160*0Sstevel@tonic-gate const MAXGIDS  = 16;	/* max number of gids in gid list */
161*0Sstevel@tonic-gate 
162*0Sstevel@tonic-gate /*
163*0Sstevel@tonic-gate  * Unix credential
164*0Sstevel@tonic-gate  */
165*0Sstevel@tonic-gate struct unixcred {
166*0Sstevel@tonic-gate 	u_int uid;
167*0Sstevel@tonic-gate 	u_int gid;
168*0Sstevel@tonic-gate 	u_int gids<MAXGIDS>;
169*0Sstevel@tonic-gate };
170*0Sstevel@tonic-gate 
171*0Sstevel@tonic-gate /*
172*0Sstevel@tonic-gate  * Unix credential, without arbitrary limit
173*0Sstevel@tonic-gate  */
174*0Sstevel@tonic-gate struct unixcred3 {
175*0Sstevel@tonic-gate 	u_int uid;
176*0Sstevel@tonic-gate 	u_int gid;
177*0Sstevel@tonic-gate 	u_int gids<>;
178*0Sstevel@tonic-gate };
179*0Sstevel@tonic-gate 
180*0Sstevel@tonic-gate /*
181*0Sstevel@tonic-gate  * Result returned from GETCRED
182*0Sstevel@tonic-gate  */
183*0Sstevel@tonic-gate union getcredres switch (keystatus status) {
184*0Sstevel@tonic-gate case KEY_SUCCESS:
185*0Sstevel@tonic-gate 	unixcred cred;
186*0Sstevel@tonic-gate default:
187*0Sstevel@tonic-gate 	void;
188*0Sstevel@tonic-gate };
189*0Sstevel@tonic-gate 
190*0Sstevel@tonic-gate /*
191*0Sstevel@tonic-gate  * Result returned from GETCRED_3
192*0Sstevel@tonic-gate  */
193*0Sstevel@tonic-gate union getcredres3 switch (keystatus status) {
194*0Sstevel@tonic-gate case KEY_SUCCESS:
195*0Sstevel@tonic-gate 	unixcred3 cred;
196*0Sstevel@tonic-gate default:
197*0Sstevel@tonic-gate 	void;
198*0Sstevel@tonic-gate };
199*0Sstevel@tonic-gate 
200*0Sstevel@tonic-gate /*
201*0Sstevel@tonic-gate  * key_netstarg;
202*0Sstevel@tonic-gate  */
203*0Sstevel@tonic-gate struct key_netstarg {
204*0Sstevel@tonic-gate 	keybuf st_priv_key;
205*0Sstevel@tonic-gate 	keybuf st_pub_key;
206*0Sstevel@tonic-gate 	netnamestr st_netname;
207*0Sstevel@tonic-gate };
208*0Sstevel@tonic-gate 
209*0Sstevel@tonic-gate struct key_netstarg3 {
210*0Sstevel@tonic-gate 	keybuf3 st_priv_key;
211*0Sstevel@tonic-gate 	keybuf3 st_pub_key;
212*0Sstevel@tonic-gate 	netnamestr st_netname;
213*0Sstevel@tonic-gate 	algtype_t algtype;
214*0Sstevel@tonic-gate 	keylen_t keylen;
215*0Sstevel@tonic-gate 	des_block userkey;
216*0Sstevel@tonic-gate };
217*0Sstevel@tonic-gate 
218*0Sstevel@tonic-gate union key_netstres switch (keystatus status){
219*0Sstevel@tonic-gate case KEY_SUCCESS:
220*0Sstevel@tonic-gate 	key_netstarg knet;
221*0Sstevel@tonic-gate default:
222*0Sstevel@tonic-gate 	void;
223*0Sstevel@tonic-gate };
224*0Sstevel@tonic-gate 
225*0Sstevel@tonic-gate union key_netstres3 switch (keystatus status){
226*0Sstevel@tonic-gate case KEY_SUCCESS:
227*0Sstevel@tonic-gate 	key_netstarg3 knet;
228*0Sstevel@tonic-gate default:
229*0Sstevel@tonic-gate 	void;
230*0Sstevel@tonic-gate };
231*0Sstevel@tonic-gate 
232*0Sstevel@tonic-gate /*
233*0Sstevel@tonic-gate  * Argument to KEY_GET_CONV_3
234*0Sstevel@tonic-gate  */
235*0Sstevel@tonic-gate struct deskeyarg3 {
236*0Sstevel@tonic-gate 	keybuf3 pub_key;
237*0Sstevel@tonic-gate 	int nkeys;
238*0Sstevel@tonic-gate 	algtype_t algtype ;
239*0Sstevel@tonic-gate 	keylen_t keylen;
240*0Sstevel@tonic-gate };
241*0Sstevel@tonic-gate 
242*0Sstevel@tonic-gate /*
243*0Sstevel@tonic-gate  * Argument to KEY_SET_3
244*0Sstevel@tonic-gate  */
245*0Sstevel@tonic-gate struct setkeyarg3 {
246*0Sstevel@tonic-gate 	keybuf3 key;
247*0Sstevel@tonic-gate 	des_block userkey;
248*0Sstevel@tonic-gate 	algtype_t algtype ;
249*0Sstevel@tonic-gate 	keylen_t keylen;
250*0Sstevel@tonic-gate };
251*0Sstevel@tonic-gate 
252*0Sstevel@tonic-gate #ifdef RPC_HDR
253*0Sstevel@tonic-gate %
254*0Sstevel@tonic-gate %#ifndef opaque
255*0Sstevel@tonic-gate %#define	opaque char
256*0Sstevel@tonic-gate %#endif
257*0Sstevel@tonic-gate %
258*0Sstevel@tonic-gate #endif
259*0Sstevel@tonic-gate program KEY_PROG {
260*0Sstevel@tonic-gate 	version KEY_VERS {
261*0Sstevel@tonic-gate 
262*0Sstevel@tonic-gate 		/*
263*0Sstevel@tonic-gate 		 * This is my secret key.
264*0Sstevel@tonic-gate 	 	 * Store it for me.
265*0Sstevel@tonic-gate 		 */
266*0Sstevel@tonic-gate 		keystatus
267*0Sstevel@tonic-gate 		KEY_SET(keybuf) = 1;
268*0Sstevel@tonic-gate 
269*0Sstevel@tonic-gate 		/*
270*0Sstevel@tonic-gate 		 * I want to talk to X.
271*0Sstevel@tonic-gate 		 * Encrypt a conversation key for me.
272*0Sstevel@tonic-gate 	 	 */
273*0Sstevel@tonic-gate 		cryptkeyres
274*0Sstevel@tonic-gate 		KEY_ENCRYPT(cryptkeyarg) = 2;
275*0Sstevel@tonic-gate 
276*0Sstevel@tonic-gate 		/*
277*0Sstevel@tonic-gate 		 * X just sent me a message.
278*0Sstevel@tonic-gate 		 * Decrypt the conversation key for me.
279*0Sstevel@tonic-gate 		 */
280*0Sstevel@tonic-gate 		cryptkeyres
281*0Sstevel@tonic-gate 		KEY_DECRYPT(cryptkeyarg) = 3;
282*0Sstevel@tonic-gate 
283*0Sstevel@tonic-gate 		/*
284*0Sstevel@tonic-gate 		 * Generate a secure conversation key for me
285*0Sstevel@tonic-gate 		 */
286*0Sstevel@tonic-gate 		des_block
287*0Sstevel@tonic-gate 		KEY_GEN(void) = 4;
288*0Sstevel@tonic-gate 
289*0Sstevel@tonic-gate 		/*
290*0Sstevel@tonic-gate 		 * Get me the uid, gid and group-access-list associated
291*0Sstevel@tonic-gate 		 * with this netname (for kernel which cannot use NIS)
292*0Sstevel@tonic-gate 		 */
293*0Sstevel@tonic-gate 		getcredres
294*0Sstevel@tonic-gate 		KEY_GETCRED(netnamestr) = 5;
295*0Sstevel@tonic-gate 	} = 1;
296*0Sstevel@tonic-gate 	version KEY_VERS2 {
297*0Sstevel@tonic-gate 
298*0Sstevel@tonic-gate 		/*
299*0Sstevel@tonic-gate 		 * #######
300*0Sstevel@tonic-gate 		 * Procedures 1-5 are identical to version 1
301*0Sstevel@tonic-gate 		 * #######
302*0Sstevel@tonic-gate 		 */
303*0Sstevel@tonic-gate 
304*0Sstevel@tonic-gate 		/*
305*0Sstevel@tonic-gate 		 * This is my secret key.
306*0Sstevel@tonic-gate 	 	 * Store it for me.
307*0Sstevel@tonic-gate 		 */
308*0Sstevel@tonic-gate 		keystatus
309*0Sstevel@tonic-gate 		KEY_SET(keybuf) = 1;
310*0Sstevel@tonic-gate 
311*0Sstevel@tonic-gate 		/*
312*0Sstevel@tonic-gate 		 * I want to talk to X.
313*0Sstevel@tonic-gate 		 * Encrypt a conversation key for me.
314*0Sstevel@tonic-gate 	 	 */
315*0Sstevel@tonic-gate 		cryptkeyres
316*0Sstevel@tonic-gate 		KEY_ENCRYPT(cryptkeyarg) = 2;
317*0Sstevel@tonic-gate 
318*0Sstevel@tonic-gate 		/*
319*0Sstevel@tonic-gate 		 * X just sent me a message.
320*0Sstevel@tonic-gate 		 * Decrypt the conversation key for me.
321*0Sstevel@tonic-gate 		 */
322*0Sstevel@tonic-gate 		cryptkeyres
323*0Sstevel@tonic-gate 		KEY_DECRYPT(cryptkeyarg) = 3;
324*0Sstevel@tonic-gate 
325*0Sstevel@tonic-gate 		/*
326*0Sstevel@tonic-gate 		 * Generate a secure conversation key for me
327*0Sstevel@tonic-gate 		 */
328*0Sstevel@tonic-gate 		des_block
329*0Sstevel@tonic-gate 		KEY_GEN(void) = 4;
330*0Sstevel@tonic-gate 
331*0Sstevel@tonic-gate 		/*
332*0Sstevel@tonic-gate 		 * Get me the uid, gid and group-access-list associated
333*0Sstevel@tonic-gate 		 * with this netname (for kernel which cannot use NIS)
334*0Sstevel@tonic-gate 		 */
335*0Sstevel@tonic-gate 		getcredres
336*0Sstevel@tonic-gate 		KEY_GETCRED(netnamestr) = 5;
337*0Sstevel@tonic-gate 
338*0Sstevel@tonic-gate 		/*
339*0Sstevel@tonic-gate 		 * I want to talk to X. and I know X's public key
340*0Sstevel@tonic-gate 		 * Encrypt a conversation key for me.
341*0Sstevel@tonic-gate 	 	 */
342*0Sstevel@tonic-gate 		cryptkeyres
343*0Sstevel@tonic-gate 		KEY_ENCRYPT_PK(cryptkeyarg2) = 6;
344*0Sstevel@tonic-gate 
345*0Sstevel@tonic-gate 		/*
346*0Sstevel@tonic-gate 		 * X just sent me a message. and I know X's public key
347*0Sstevel@tonic-gate 		 * Decrypt the conversation key for me.
348*0Sstevel@tonic-gate 		 */
349*0Sstevel@tonic-gate 		cryptkeyres
350*0Sstevel@tonic-gate 		KEY_DECRYPT_PK(cryptkeyarg2) = 7;
351*0Sstevel@tonic-gate 
352*0Sstevel@tonic-gate 		/*
353*0Sstevel@tonic-gate 		 * Store my public key, netname and private key.
354*0Sstevel@tonic-gate 		 */
355*0Sstevel@tonic-gate 		keystatus
356*0Sstevel@tonic-gate 		KEY_NET_PUT(key_netstarg) = 8;
357*0Sstevel@tonic-gate 
358*0Sstevel@tonic-gate 		/*
359*0Sstevel@tonic-gate 		 * Retrieve my public key, netname and private key.
360*0Sstevel@tonic-gate 		 */
361*0Sstevel@tonic-gate  		key_netstres
362*0Sstevel@tonic-gate 		KEY_NET_GET(void) = 9;
363*0Sstevel@tonic-gate 
364*0Sstevel@tonic-gate 		/*
365*0Sstevel@tonic-gate 		 * Return me the conversation (common) key that is constructed
366*0Sstevel@tonic-gate 		 * from my secret key and this publickey.
367*0Sstevel@tonic-gate 		 */
368*0Sstevel@tonic-gate 		cryptkeyres
369*0Sstevel@tonic-gate 		KEY_GET_CONV(keybuf) = 10;
370*0Sstevel@tonic-gate 	} = 2;
371*0Sstevel@tonic-gate 	version KEY_VERS3 {
372*0Sstevel@tonic-gate 
373*0Sstevel@tonic-gate 		/*
374*0Sstevel@tonic-gate 		 * #######
375*0Sstevel@tonic-gate 		 * Procedures 1-10 are identical to versions 1 & 2
376*0Sstevel@tonic-gate 		 * #######
377*0Sstevel@tonic-gate 		 */
378*0Sstevel@tonic-gate 
379*0Sstevel@tonic-gate 		/*
380*0Sstevel@tonic-gate 		 * This is my secret key.
381*0Sstevel@tonic-gate 	 	 * Store it for me.
382*0Sstevel@tonic-gate 		 */
383*0Sstevel@tonic-gate 		keystatus
384*0Sstevel@tonic-gate 		KEY_SET(keybuf) = 1;
385*0Sstevel@tonic-gate 
386*0Sstevel@tonic-gate 		/*
387*0Sstevel@tonic-gate 		 * I want to talk to X.
388*0Sstevel@tonic-gate 		 * Encrypt a conversation key for me.
389*0Sstevel@tonic-gate 	 	 */
390*0Sstevel@tonic-gate 		cryptkeyres
391*0Sstevel@tonic-gate 		KEY_ENCRYPT(cryptkeyarg) = 2;
392*0Sstevel@tonic-gate 
393*0Sstevel@tonic-gate 		/*
394*0Sstevel@tonic-gate 		 * X just sent me a message.
395*0Sstevel@tonic-gate 		 * Decrypt the conversation key for me.
396*0Sstevel@tonic-gate 		 */
397*0Sstevel@tonic-gate 		cryptkeyres
398*0Sstevel@tonic-gate 		KEY_DECRYPT(cryptkeyarg) = 3;
399*0Sstevel@tonic-gate 
400*0Sstevel@tonic-gate 		/*
401*0Sstevel@tonic-gate 		 * Generate a secure conversation key for me
402*0Sstevel@tonic-gate 		 */
403*0Sstevel@tonic-gate 		des_block
404*0Sstevel@tonic-gate 		KEY_GEN(void) = 4;
405*0Sstevel@tonic-gate 
406*0Sstevel@tonic-gate 		/*
407*0Sstevel@tonic-gate 		 * Get me the uid, gid and group-access-list associated
408*0Sstevel@tonic-gate 		 * with this netname (for kernel which cannot use NIS)
409*0Sstevel@tonic-gate 		 */
410*0Sstevel@tonic-gate 		getcredres
411*0Sstevel@tonic-gate 		KEY_GETCRED(netnamestr) = 5;
412*0Sstevel@tonic-gate 
413*0Sstevel@tonic-gate 		/*
414*0Sstevel@tonic-gate 		 * I want to talk to X. and I know X's public key
415*0Sstevel@tonic-gate 		 * Encrypt a conversation key for me.
416*0Sstevel@tonic-gate 	 	 */
417*0Sstevel@tonic-gate 		cryptkeyres
418*0Sstevel@tonic-gate 		KEY_ENCRYPT_PK(cryptkeyarg2) = 6;
419*0Sstevel@tonic-gate 
420*0Sstevel@tonic-gate 		/*
421*0Sstevel@tonic-gate 		 * X just sent me a message. and I know X's public key
422*0Sstevel@tonic-gate 		 * Decrypt the conversation key for me.
423*0Sstevel@tonic-gate 		 */
424*0Sstevel@tonic-gate 		cryptkeyres
425*0Sstevel@tonic-gate 		KEY_DECRYPT_PK(cryptkeyarg2) = 7;
426*0Sstevel@tonic-gate 
427*0Sstevel@tonic-gate 		/*
428*0Sstevel@tonic-gate 		 * Store my public key, netname and private key.
429*0Sstevel@tonic-gate 		 */
430*0Sstevel@tonic-gate 		keystatus
431*0Sstevel@tonic-gate 		KEY_NET_PUT(key_netstarg) = 8;
432*0Sstevel@tonic-gate 
433*0Sstevel@tonic-gate 		/*
434*0Sstevel@tonic-gate 		 * Retrieve my public key, netname and private key.
435*0Sstevel@tonic-gate 		 */
436*0Sstevel@tonic-gate  		key_netstres
437*0Sstevel@tonic-gate 		KEY_NET_GET(void) = 9;
438*0Sstevel@tonic-gate 
439*0Sstevel@tonic-gate 		/*
440*0Sstevel@tonic-gate 		 * Return me the conversation (common) key that is constructed
441*0Sstevel@tonic-gate 		 * from my secret key and this publickey.
442*0Sstevel@tonic-gate 		 */
443*0Sstevel@tonic-gate 		cryptkeyres
444*0Sstevel@tonic-gate 		KEY_GET_CONV(keybuf) = 10;
445*0Sstevel@tonic-gate 
446*0Sstevel@tonic-gate 		/*
447*0Sstevel@tonic-gate 		 * #######
448*0Sstevel@tonic-gate 		 * Procedures new in version 3 follow...
449*0Sstevel@tonic-gate 		 * #######
450*0Sstevel@tonic-gate 		 */
451*0Sstevel@tonic-gate 
452*0Sstevel@tonic-gate 		/*
453*0Sstevel@tonic-gate 		 * This is my secret key.
454*0Sstevel@tonic-gate 	 	 * Store it for me.
455*0Sstevel@tonic-gate 		 */
456*0Sstevel@tonic-gate 		keystatus
457*0Sstevel@tonic-gate 		KEY_SET_3(setkeyarg3) = 11;
458*0Sstevel@tonic-gate 
459*0Sstevel@tonic-gate 		/*
460*0Sstevel@tonic-gate 		 * I want to talk to X.
461*0Sstevel@tonic-gate 		 * Encrypt a conversation key for me.
462*0Sstevel@tonic-gate 	 	 */
463*0Sstevel@tonic-gate 		cryptkeyres3
464*0Sstevel@tonic-gate 		KEY_ENCRYPT_3(cryptkeyarg3) = 12;
465*0Sstevel@tonic-gate 
466*0Sstevel@tonic-gate 		/*
467*0Sstevel@tonic-gate 		 * X just sent me a message.
468*0Sstevel@tonic-gate 		 * Decrypt the conversation key for me.
469*0Sstevel@tonic-gate 		 */
470*0Sstevel@tonic-gate 		cryptkeyres3
471*0Sstevel@tonic-gate 		KEY_DECRYPT_3(cryptkeyarg3) = 13;
472*0Sstevel@tonic-gate 
473*0Sstevel@tonic-gate 		/*
474*0Sstevel@tonic-gate 		 * Generate secure conversation key(s) for me
475*0Sstevel@tonic-gate 		 */
476*0Sstevel@tonic-gate 		deskeyarray
477*0Sstevel@tonic-gate 		KEY_GEN_3(keynum_t) = 14;
478*0Sstevel@tonic-gate 
479*0Sstevel@tonic-gate 		/*
480*0Sstevel@tonic-gate 		 * Get me the uid, gid and group-access-list associated
481*0Sstevel@tonic-gate 		 * with this netname (for kernel which cannot use NIS)
482*0Sstevel@tonic-gate 		 */
483*0Sstevel@tonic-gate 		getcredres3
484*0Sstevel@tonic-gate 		KEY_GETCRED_3(netnamestr) = 15;
485*0Sstevel@tonic-gate 
486*0Sstevel@tonic-gate 		/*
487*0Sstevel@tonic-gate 		 * I want to talk to X. and I know X's public key
488*0Sstevel@tonic-gate 		 * Encrypt a conversation key for me.
489*0Sstevel@tonic-gate 	 	 */
490*0Sstevel@tonic-gate 		cryptkeyres3
491*0Sstevel@tonic-gate 		KEY_ENCRYPT_PK_3(cryptkeyarg3) = 16;
492*0Sstevel@tonic-gate 
493*0Sstevel@tonic-gate 		/*
494*0Sstevel@tonic-gate 		 * X just sent me a message. and I know X's public key
495*0Sstevel@tonic-gate 		 * Decrypt the conversation key for me.
496*0Sstevel@tonic-gate 		 */
497*0Sstevel@tonic-gate 		cryptkeyres3
498*0Sstevel@tonic-gate 		KEY_DECRYPT_PK_3(cryptkeyarg3) = 17;
499*0Sstevel@tonic-gate 
500*0Sstevel@tonic-gate 		/*
501*0Sstevel@tonic-gate 		 * Store my public key, netname and private key.
502*0Sstevel@tonic-gate 		 */
503*0Sstevel@tonic-gate 		keystatus
504*0Sstevel@tonic-gate 		KEY_NET_PUT_3(key_netstarg3) = 18;
505*0Sstevel@tonic-gate 
506*0Sstevel@tonic-gate 		/*
507*0Sstevel@tonic-gate 		 * Retrieve my public key, netname and private key.
508*0Sstevel@tonic-gate 		 */
509*0Sstevel@tonic-gate  		key_netstres3
510*0Sstevel@tonic-gate 		KEY_NET_GET_3(key_netstarg3) = 19;
511*0Sstevel@tonic-gate 
512*0Sstevel@tonic-gate 		/*
513*0Sstevel@tonic-gate 		 * Return me the conversation (common) key that is constructed
514*0Sstevel@tonic-gate 		 * from my secret key and this publickey.
515*0Sstevel@tonic-gate 		 */
516*0Sstevel@tonic-gate 		cryptkeyres3
517*0Sstevel@tonic-gate 		KEY_GET_CONV_3(deskeyarg3) = 20;
518*0Sstevel@tonic-gate 
519*0Sstevel@tonic-gate 		/*
520*0Sstevel@tonic-gate 		 * Clear all the secret/public/netname triplets for the caller
521*0Sstevel@tonic-gate 		 */
522*0Sstevel@tonic-gate 		keystatus
523*0Sstevel@tonic-gate 		KEY_CLEAR_3(void) = 21;
524*0Sstevel@tonic-gate 
525*0Sstevel@tonic-gate 	} = 3;
526*0Sstevel@tonic-gate } = 100029;
527