xref: /freebsd/include/rpc/auth_des.h (revision 380a989b3223d455375b4fae70fd0b9bdd43bafb)
1 /*	@(#)auth_des.h	2.2 88/07/29 4.0 RPCSRC; from 1.3 88/02/08 SMI */
2 /*
3  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
4  * unrestricted use provided that this legend is included on all tape
5  * media and as a part of the software program in whole or part.  Users
6  * may copy or modify Sun RPC without charge, but are not authorized
7  * to license or distribute it to anyone else except as part of a product or
8  * program developed by the user.
9  *
10  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
11  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
12  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
13  *
14  * Sun RPC is provided with no support and without any obligation on the
15  * part of Sun Microsystems, Inc. to assist in its use, correction,
16  * modification or enhancement.
17  *
18  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
19  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
20  * OR ANY PART THEREOF.
21  *
22  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
23  * or profits or other special, indirect and consequential damages, even if
24  * Sun has been advised of the possibility of such damages.
25  *
26  * Sun Microsystems, Inc.
27  * 2550 Garcia Avenue
28  * Mountain View, California  94043
29  */
30 
31 /*
32  * Copyright (c) 1988 by Sun Microsystems, Inc.
33  */
34 
35 /*
36  * auth_des.h, Protocol for DES style authentication for RPC
37  */
38 
39 #ifndef _AUTH_DES_
40 #define _AUTH_DES_
41 
42 /*
43  * There are two kinds of "names": fullnames and nicknames
44  */
45 enum authdes_namekind {
46 	ADN_FULLNAME,
47 	ADN_NICKNAME
48 };
49 
50 /*
51  * A fullname contains the network name of the client,
52  * a conversation key and the window
53  */
54 struct authdes_fullname {
55 	char *name;		/* network name of client, up to MAXNETNAMELEN */
56 	des_block key;		/* conversation key */
57 	u_long window;		/* associated window */
58 };
59 
60 
61 /*
62  * A credential
63  */
64 struct authdes_cred {
65 	enum authdes_namekind adc_namekind;
66 	struct authdes_fullname adc_fullname;
67 	u_long adc_nickname;
68 };
69 
70 
71 
72 /*
73  * A des authentication verifier
74  */
75 struct authdes_verf {
76 	union {
77 		struct timeval adv_ctime;	/* clear time */
78 		des_block adv_xtime;		/* crypt time */
79 	} adv_time_u;
80 	u_long adv_int_u;
81 };
82 
83 /*
84  * des authentication verifier: client variety
85  *
86  * adv_timestamp is the current time.
87  * adv_winverf is the credential window + 1.
88  * Both are encrypted using the conversation key.
89  */
90 #define adv_timestamp	adv_time_u.adv_ctime
91 #define adv_xtimestamp	adv_time_u.adv_xtime
92 #define adv_winverf	adv_int_u
93 
94 /*
95  * des authentication verifier: server variety
96  *
97  * adv_timeverf is the client's timestamp + client's window
98  * adv_nickname is the server's nickname for the client.
99  * adv_timeverf is encrypted using the conversation key.
100  */
101 #define adv_timeverf	adv_time_u.adv_ctime
102 #define adv_xtimeverf	adv_time_u.adv_xtime
103 #define adv_nickname	adv_int_u
104 
105 __BEGIN_DECLS
106 extern int authdes_getucred __P(( struct authdes_cred *, uid_t *, gid_t *, int *, gid_t * ));
107 __END_DECLS
108 
109 #endif /* ndef _AUTH_DES_ */
110