fix-rxkad-prototype-20050415
[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(void * clear, void * cipher,
32                                 fc_KeySchedule schedule, int encrypt);
33 extern afs_int32 fc_cbc_encrypt(void *input, void *output, afs_int32 length,
34                                 fc_KeySchedule key, afs_uint32 * iv,
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 struct rxkad_endpoint;
54 extern int rxkad_SetupEndpoint(struct rx_connection *aconnp,
55                                struct rxkad_endpoint *aendpointp);
56 struct rxkad_v2ChallengeResponse;
57 extern afs_uint32 rxkad_CksumChallengeResponse(struct
58                                                rxkad_v2ChallengeResponse
59                                                *v2r);
60 extern int rxkad_DeriveXORInfo(struct rx_connection *aconnp,
61                                fc_KeySchedule * aschedule, char *aivec,
62                                char *aresult);
63 extern void rxkad_SetLevel(struct rx_connection *conn, rxkad_level level);
64 extern int rxkad_Close(struct rx_securityClass *aobj);
65 extern int rxkad_NewConnection(struct rx_securityClass *aobj,
66                                struct rx_connection *aconn);
67 extern int rxkad_DestroyConnection(struct rx_securityClass *aobj,
68                                    struct rx_connection *aconn);
69 extern int rxkad_CheckPacket(struct rx_securityClass *aobj,
70                              struct rx_call *acall,
71                              struct rx_packet *apacket);
72 extern int rxkad_PreparePacket(struct rx_securityClass *aobj,
73                                struct rx_call *acall,
74                                struct rx_packet *apacket);
75 extern int rxkad_GetStats(struct rx_securityClass *aobj,
76                           struct rx_connection *aconn,
77                           struct rx_securityObjectStats *astats);
78 extern rxkad_level rxkad_StringToLevel(char *string);
79 extern char *rxkad_LevelToString(rxkad_level level);
80
81
82 /* rxkad_errs.c */
83
84 /* rxkad_server.c */
85 extern struct rx_securityClass *rxkad_NewServerSecurityObject(rxkad_level
86                                                               level, char
87                                                               *get_key_rock,
88                                                               int (*get_key)
89
90
91                                                                
92                                                               (char
93                                                                *get_key_rock,
94                                                                int kvno,
95                                                                struct
96                                                                ktc_encryptionKey
97                                                                * serverKey),
98                                                               int (*user_ok)
99
100
101                                                                
102                                                               (char *name,
103                                                                char
104                                                                *instance,
105                                                                char *cell,
106                                                                afs_int32
107                                                                kvno));
108 extern int rxkad_CheckAuthentication(struct rx_securityClass *aobj,
109                                      struct rx_connection *aconn);
110 extern int rxkad_CreateChallenge(struct rx_securityClass *aobj,
111                                  struct rx_connection *aconn);
112 extern int rxkad_GetChallenge(struct rx_securityClass *aobj,
113                               struct rx_connection *aconn,
114                               struct rx_packet *apacket);
115 extern int rxkad_CheckResponse(struct rx_securityClass *aobj,
116                                struct rx_connection *aconn,
117                                struct rx_packet *apacket);
118 extern afs_int32 rxkad_GetServerInfo(struct rx_connection *aconn,
119                                      rxkad_level * level,
120                                      afs_uint32 * expiration, char *name,
121                                      char *instance, char *cell,
122                                      afs_int32 * kvno);
123
124
125
126 /* ticket.c */
127 extern int tkt_DecodeTicket(char *asecret, afs_int32 ticketLen,
128                             struct ktc_encryptionKey *key, char *name,
129                             char *inst, char *cell, char *sessionKey,
130                             afs_int32 * host, afs_int32 * start,
131                             afs_int32 * end);
132 extern int tkt_MakeTicket(char *ticket, int *ticketLen,
133                           struct ktc_encryptionKey *key, char *name,
134                           char *inst, char *cell, afs_uint32 start,
135                           afs_uint32 end,
136                           struct ktc_encryptionKey *sessionKey,
137                           afs_uint32 host, char *sname, char *sinst);
138 extern int tkt_CheckTimes(afs_uint32 start, afs_uint32 end, afs_uint32 now);
139 extern afs_int32 ktohl(char flags, afs_int32 l);
140 extern afs_uint32 life_to_time(afs_uint32 start, unsigned char life);
141 extern unsigned char time_to_life(afs_uint32 start, afs_uint32 end);
142
143 /* ticket5.c */
144 extern int tkt_DecodeTicket5(char *ticket, afs_int32 ticket_len,
145                              int (*get_key) (char *, int,
146                                              struct ktc_encryptionKey *),
147                              char *get_key_rock, int serv_kvno, char *name,
148                              char *inst, char *cell, char *session_key,
149                              afs_int32 * host, afs_int32 * start,
150                              afs_int32 * end);
151
152 #endif