Initial import
[project/librpc-uclibc.git] / rpc / auth_des.h
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, write to the Free
16    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17    02111-1307 USA.  */
18
19 #ifndef _RPC_AUTH_DES_H
20 #define _RPC_AUTH_DES_H 1
21
22 #include <sys/cdefs.h>
23 #include <rpc/auth.h>
24
25 __BEGIN_DECLS
26
27 #if 0
28 /* There are two kinds of "names": fullnames and nicknames */
29 enum authdes_namekind
30   {
31     ADN_FULLNAME,
32     ADN_NICKNAME
33   };
34
35 /* A fullname contains the network name of the client,
36    a conversation key and the window */
37 struct authdes_fullname
38   {
39     char *name;         /* network name of client, up to MAXNETNAMELEN */
40     des_block key;      /* conversation key */
41     uint32_t window;    /* associated window */
42   };
43
44 /* A credential */
45 struct authdes_cred
46   {
47     enum authdes_namekind adc_namekind;
48     struct authdes_fullname adc_fullname;
49     uint32_t adc_nickname;
50   };
51 #endif
52
53 /* A timeval replacement for !32bit platforms */
54 struct rpc_timeval
55   {
56     uint32_t tv_sec;            /* Seconds.  */
57     uint32_t tv_usec;           /* Microseconds.  */
58   };
59
60 #if 0
61 /* A des authentication verifier */
62 struct authdes_verf
63   {
64     union
65       {
66         struct rpc_timeval adv_ctime;   /* clear time */
67         des_block adv_xtime;            /* crypt time */
68       }
69     adv_time_u;
70     uint32_t adv_int_u;
71   };
72
73 /* des authentication verifier: client variety
74
75    adv_timestamp is the current time.
76    adv_winverf is the credential window + 1.
77    Both are encrypted using the conversation key. */
78 #define adv_timestamp  adv_time_u.adv_ctime
79 #define adv_xtimestamp adv_time_u.adv_xtime
80 #define adv_winverf    adv_int_u
81
82 /* des authentication verifier: server variety
83
84    adv_timeverf is the client's timestamp + client's window
85    adv_nickname is the server's nickname for the client.
86    adv_timeverf is encrypted using the conversation key. */
87 #define adv_timeverf   adv_time_u.adv_ctime
88 #define adv_xtimeverf  adv_time_u.adv_xtime
89 #define adv_nickname   adv_int_u
90
91 /* Map a des credential into a unix cred. */
92 extern int authdes_getucred (__const struct authdes_cred * __adc,
93                              uid_t * __uid, gid_t * __gid,
94                              short *__grouplen, gid_t * __groups) __THROW;
95
96 /* Get the public key for NAME and place it in KEY.  NAME can only be
97    up to MAXNETNAMELEN bytes long and the destination buffer KEY should
98    have HEXKEYBYTES + 1 bytes long to fit all characters from the key.  */
99 extern int getpublickey (__const char *__name, char *__key) __THROW;
100
101 /* Get the secret key for NAME and place it in KEY.  PASSWD is used to
102    decrypt the encrypted key stored in the database.  NAME can only be
103    up to MAXNETNAMELEN bytes long and the destination buffer KEY
104    should have HEXKEYBYTES + 1 bytes long to fit all characters from
105    the key.  */
106 extern int getsecretkey (__const char *__name, char *__key,
107                          __const char *__passwd) __THROW;
108 #endif
109
110 extern int rtime (struct sockaddr_in *__addrp, struct rpc_timeval *__timep,
111                   struct rpc_timeval *__timeout) __THROW;
112 libc_hidden_proto(rtime)
113
114 __END_DECLS
115
116
117 #endif /* rpc/auth_des.h */