fix-indent-bug-with-lock-macros-part-three-20040818
[openafs.git] / src / rxkad / rxkad_prototypes.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #ifndef _RXKAD_PROTOTYPES_H
11 #define _RXKAD_PROTOTYPES_H
12
13 /* till the typedefs are moved elsewhere */
14 #include "fcrypt.h"
15 #include "rx/rx.h"
16
17 /* domestic/crypt_conn.c */
18 extern afs_int32 rxkad_DecryptPacket(const struct rx_connection *conn,
19                                      const fc_KeySchedule * schedule,
20                                      const fc_InitializationVector * ivec,
21                                      const int len, struct rx_packet *packet);
22 extern afs_int32 rxkad_EncryptPacket(const struct rx_connection *conn,
23                                      const fc_KeySchedule * schedule,
24                                      const fc_InitializationVector * ivec,
25                                      const int len, struct rx_packet *packet);
26
27
28 /* domestic/fcrypt.c */
29 extern int fc_keysched(struct ktc_encryptionKey *key,
30                        fc_KeySchedule schedule);
31 extern afs_int32 fc_ecb_encrypt(afs_uint32 * clear, afs_uint32 * cipher,
32                                 fc_KeySchedule schedule, int encrypt);
33 extern afs_int32 fc_cbc_encrypt(char *input, char *output, afs_int32 length,
34                                 fc_KeySchedule key, afs_uint32 * xor,
35                                 int encrypt);
36
37 /* rxkad_client.c */
38 extern int rxkad_AllocCID(struct rx_securityClass *aobj,
39                           struct rx_connection *aconn);
40 extern struct rx_securityClass *rxkad_NewClientSecurityObject(rxkad_level
41                                                               level, struct
42                                                               ktc_encryptionKey
43                                                               *sessionkey,
44                                                               afs_int32 kvno,
45                                                               int ticketLen,
46                                                               char *ticket);
47 extern int rxkad_GetResponse(struct rx_securityClass *aobj,
48                              struct rx_connection *aconn,
49                              struct rx_packet *apacket);
50 extern void rxkad_ResetState(void);
51
52 /* rxkad_common.c */
53 #if 0
54 /* can't prototype these due to types */
55 extern int rxkad_SetupEndpoint(struct rx_connection *aconnp,
56                                struct rxkad_endpoint *aendpointp);
57 extern afs_uint32 rxkad_CksumChallengeResponse(struct
58                                                rxkad_v2ChallengeResponse
59                                                *v2r);
60 #endif
61 extern int rxkad_DeriveXORInfo(struct rx_connection *aconnp,
62                                fc_KeySchedule * aschedule, char *aivec,
63                                char *aresult);
64 extern void rxkad_SetLevel(struct rx_connection *conn, rxkad_level level);
65 extern int rxkad_Close(struct rx_securityClass *aobj);
66 extern int rxkad_NewConnection(struct rx_securityClass *aobj,
67                                struct rx_connection *aconn);
68 extern int rxkad_DestroyConnection(struct rx_securityClass *aobj,
69                                    struct rx_connection *aconn);
70 extern int rxkad_CheckPacket(struct rx_securityClass *aobj,
71                              struct rx_call *acall,
72                              struct rx_packet *apacket);
73 extern int rxkad_PreparePacket(struct rx_securityClass *aobj,
74                                struct rx_call *acall,
75                                struct rx_packet *apacket);
76 extern int rxkad_GetStats(struct rx_securityClass *aobj,
77                           struct rx_connection *aconn,
78                           struct rx_securityObjectStats *astats);
79 extern rxkad_level rxkad_StringToLevel(char *string);
80 extern char *rxkad_LevelToString(rxkad_level level);
81
82
83 /* rxkad_errs.c */
84
85 /* rxkad_server.c */
86 extern struct rx_securityClass *rxkad_NewServerSecurityObject(rxkad_level
87                                                               level, char
88                                                               *get_key_rock,
89                                                               int (*get_key)
90
91
92                                                                
93                                                               (char
94                                                                *get_key_rock,
95                                                                int kvno,
96                                                                struct
97                                                                ktc_encryptionKey
98                                                                * serverKey),
99                                                               int (*user_ok)
100
101
102                                                                
103                                                               (char *name,
104                                                                char
105                                                                *instance,
106                                                                char *cell,
107                                                                afs_int32
108                                                                kvno));
109 extern int rxkad_CheckAuthentication(struct rx_securityClass *aobj,
110                                      struct rx_connection *aconn);
111 extern int rxkad_CreateChallenge(struct rx_securityClass *aobj,
112                                  struct rx_connection *aconn);
113 extern int rxkad_GetChallenge(struct rx_securityClass *aobj,
114                               struct rx_connection *aconn,
115                               struct rx_packet *apacket);
116 extern int rxkad_CheckResponse(struct rx_securityClass *aobj,
117                                struct rx_connection *aconn,
118                                struct rx_packet *apacket);
119 extern afs_int32 rxkad_GetServerInfo(struct rx_connection *aconn,
120                                      rxkad_level * level,
121                                      afs_uint32 * expiration, char *name,
122                                      char *instance, char *cell,
123                                      afs_int32 * kvno);
124
125
126
127 /* ticket.c */
128 extern int tkt_DecodeTicket(char *asecret, afs_int32 ticketLen,
129                             struct ktc_encryptionKey *key, char *name,
130                             char *inst, char *cell, char *sessionKey,
131                             afs_int32 * host, afs_int32 * start,
132                             afs_int32 * end);
133 extern int tkt_MakeTicket(char *ticket, int *ticketLen,
134                           struct ktc_encryptionKey *key, char *name,
135                           char *inst, char *cell, afs_uint32 start,
136                           afs_uint32 end,
137                           struct ktc_encryptionKey *sessionKey,
138                           afs_uint32 host, char *sname, char *sinst);
139 extern int tkt_CheckTimes(afs_uint32 start, afs_uint32 end, afs_uint32 now);
140 extern afs_int32 ktohl(char flags, afs_int32 l);
141 extern afs_uint32 life_to_time(afs_uint32 start, unsigned char life);
142 extern unsigned char time_to_life(afs_uint32 start, afs_uint32 end);
143
144 /* ticket5.c */
145 extern int tkt_DecodeTicket5(char *ticket, afs_int32 ticket_len,
146                              int (*get_key) (char *, int,
147                                              struct ktc_encryptionKey *),
148                              char *get_key_rock, int serv_kvno, char *name,
149                              char *inst, char *cell, char *session_key,
150                              afs_int32 * host, afs_int32 * start,
151                              afs_int32 * end);
152
153 #endif