prototyping-20040623
[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                                                                 (char
91                                                                  *get_key_rock,
92                                                                  int kvno,
93                                                                  struct
94                                                                  ktc_encryptionKey
95                                                                  * serverKey),
96                                                               int (*user_ok)
97                                                                 (char *name,
98                                                                  char
99                                                                  *instance,
100                                                                  char *cell,
101                                                                  afs_int32
102                                                                  kvno));
103 extern int rxkad_CheckAuthentication(struct rx_securityClass *aobj,
104                                      struct rx_connection *aconn);
105 extern int rxkad_CreateChallenge(struct rx_securityClass *aobj,
106                                  struct rx_connection *aconn);
107 extern int rxkad_GetChallenge(struct rx_securityClass *aobj,
108                               struct rx_connection *aconn,
109                               struct rx_packet *apacket);
110 extern int rxkad_CheckResponse(struct rx_securityClass *aobj,
111                                struct rx_connection *aconn,
112                                struct rx_packet *apacket);
113 extern afs_int32 rxkad_GetServerInfo(struct rx_connection *aconn,
114                                      rxkad_level * level,
115                                      afs_uint32 * expiration, char *name,
116                                      char *instance, char *cell,
117                                      afs_int32 * kvno);
118
119
120
121 /* ticket.c */
122 extern int tkt_DecodeTicket(char *asecret, afs_int32 ticketLen,
123                             struct ktc_encryptionKey *key, char *name,
124                             char *inst, char *cell, char *sessionKey,
125                             afs_int32 * host, afs_int32 * start,
126                             afs_int32 * end);
127 extern int tkt_MakeTicket(char *ticket, int *ticketLen,
128                           struct ktc_encryptionKey *key, char *name,
129                           char *inst, char *cell, afs_uint32 start,
130                           afs_uint32 end,
131                           struct ktc_encryptionKey *sessionKey,
132                           afs_uint32 host, char *sname, char *sinst);
133 extern int tkt_CheckTimes(afs_uint32 start, afs_uint32 end, afs_uint32 now);
134 extern afs_int32 ktohl(char flags, afs_int32 l);
135 extern afs_uint32 life_to_time(afs_uint32 start, unsigned char life);
136 extern unsigned char time_to_life(afs_uint32 start, afs_uint32 end);
137
138 /* ticket5.c */
139 extern int tkt_DecodeTicket5(char *ticket, afs_int32 ticket_len,
140                              int (*get_key) (char *, int,
141                                              struct ktc_encryptionKey *),
142                              char *get_key_rock, int serv_kvno, char *name,
143                              char *inst, char *cell, char *session_key,
144                              afs_int32 * host, afs_int32 * start,
145                              afs_int32 * end);
146
147 #endif