1 /* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3 
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License as published by the Free Software Foundation; either
7    version 2.1 of the License, or (at your option) any later version.
8 
9    The GNU C Library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Lesser General Public License for more details.
13 
14    You should have received a copy of the GNU Lesser General Public
15    License along with the GNU C Library; if not, see
16    <http://www.gnu.org/licenses/>.  */
17 
18 #ifndef _RPC_AUTH_DES_H
19 #define _RPC_AUTH_DES_H	1
20 
21 #include <sys/cdefs.h>
22 #include <rpc/auth.h>
23 
24 __BEGIN_DECLS
25 
26 #if 0
27 /* There are two kinds of "names": fullnames and nicknames */
28 enum authdes_namekind
29   {
30     ADN_FULLNAME,
31     ADN_NICKNAME
32   };
33 
34 /* A fullname contains the network name of the client,
35    a conversation key and the window */
36 struct authdes_fullname
37   {
38     char *name;		/* network name of client, up to MAXNETNAMELEN */
39     des_block key;	/* conversation key */
40     uint32_t window;	/* associated window */
41   };
42 
43 /* A credential */
44 struct authdes_cred
45   {
46     enum authdes_namekind adc_namekind;
47     struct authdes_fullname adc_fullname;
48     uint32_t adc_nickname;
49   };
50 #endif
51 
52 /* A timeval replacement for !32bit platforms */
53 struct rpc_timeval
54   {
55     uint32_t tv_sec;            /* Seconds.  */
56     uint32_t tv_usec;           /* Microseconds.  */
57   };
58 
59 #if 0
60 /* A des authentication verifier */
61 struct authdes_verf
62   {
63     union
64       {
65 	struct rpc_timeval adv_ctime;	/* clear time */
66 	des_block adv_xtime;		/* crypt time */
67       }
68     adv_time_u;
69     uint32_t adv_int_u;
70   };
71 
72 /* des authentication verifier: client variety
73 
74    adv_timestamp is the current time.
75    adv_winverf is the credential window + 1.
76    Both are encrypted using the conversation key. */
77 #define adv_timestamp  adv_time_u.adv_ctime
78 #define adv_xtimestamp adv_time_u.adv_xtime
79 #define adv_winverf    adv_int_u
80 
81 /* des authentication verifier: server variety
82 
83    adv_timeverf is the client's timestamp + client's window
84    adv_nickname is the server's nickname for the client.
85    adv_timeverf is encrypted using the conversation key. */
86 #define adv_timeverf   adv_time_u.adv_ctime
87 #define adv_xtimeverf  adv_time_u.adv_xtime
88 #define adv_nickname   adv_int_u
89 
90 /* Map a des credential into a unix cred. */
91 extern int authdes_getucred (const struct authdes_cred * __adc,
92 			     uid_t * __uid, gid_t * __gid,
93 			     short *__grouplen, gid_t * __groups) __THROW;
94 
95 /* Get the public key for NAME and place it in KEY.  NAME can only be
96    up to MAXNETNAMELEN bytes long and the destination buffer KEY should
97    have HEXKEYBYTES + 1 bytes long to fit all characters from the key.  */
98 extern int getpublickey (const char *__name, char *__key) __THROW;
99 
100 /* Get the secret key for NAME and place it in KEY.  PASSWD is used to
101    decrypt the encrypted key stored in the database.  NAME can only be
102    up to MAXNETNAMELEN bytes long and the destination buffer KEY
103    should have HEXKEYBYTES + 1 bytes long to fit all characters from
104    the key.  */
105 extern int getsecretkey (const char *__name, char *__key,
106 			 const char *__passwd) __THROW;
107 #endif
108 
109 extern int rtime (struct sockaddr_in *__addrp, struct rpc_timeval *__timep,
110 		  struct rpc_timeval *__timeout) __THROW;
111 
112 __END_DECLS
113 
114 
115 #endif /* rpc/auth_des.h */
116