0f935e7a34a3e2d17fb701bf5a7d562d62c162be
[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 #include <hcrypto/des.h>
18
19 /* crypt_conn.c */
20 extern afs_int32 rxkad_DecryptPacket(const struct rx_connection *conn,
21                                      const fc_KeySchedule * schedule,
22                                      const fc_InitializationVector * ivec,
23                                      const int len, struct rx_packet *packet);
24 extern afs_int32 rxkad_EncryptPacket(const struct rx_connection *conn,
25                                      const fc_KeySchedule * schedule,
26                                      const fc_InitializationVector * ivec,
27                                      const int len, struct rx_packet *packet);
28
29
30 /* fcrypt.c */
31 extern int fc_keysched(struct ktc_encryptionKey *key,
32                        fc_KeySchedule schedule);
33 extern afs_int32 fc_ecb_encrypt(void * clear, void * cipher,
34                                 const fc_KeySchedule schedule, int encrypt);
35 extern afs_int32 fc_cbc_encrypt(void *input, void *output, afs_int32 length,
36                                 const fc_KeySchedule key, afs_uint32 * iv,
37                                 int encrypt);
38
39 /* rxkad_client.c */
40 extern int rxkad_AllocCID(struct rx_securityClass *aobj,
41                           struct rx_connection *aconn);
42 extern struct rx_securityClass *rxkad_NewClientSecurityObject(rxkad_level
43                                                               level, struct
44                                                               ktc_encryptionKey
45                                                               *sessionkey,
46                                                               afs_int32 kvno,
47                                                               int ticketLen,
48                                                               char *ticket);
49 extern int rxkad_GetResponse(struct rx_securityClass *aobj,
50                              struct rx_connection *aconn,
51                              struct rx_packet *apacket);
52 extern void rxkad_ResetState(void);
53
54 /* rxkad_common.c */
55 extern void rxkad_Init(void);
56
57 struct rxkad_endpoint;
58 extern int rxkad_SetupEndpoint(struct rx_connection *aconnp,
59                                struct rxkad_endpoint *aendpointp);
60 struct rxkad_v2ChallengeResponse;
61 extern afs_uint32 rxkad_CksumChallengeResponse(struct
62                                                rxkad_v2ChallengeResponse
63                                                *v2r);
64 extern int rxkad_DeriveXORInfo(struct rx_connection *aconnp,
65                                fc_KeySchedule * aschedule, char *aivec,
66                                char *aresult);
67 extern void rxkad_SetLevel(struct rx_connection *conn, rxkad_level level);
68 extern int rxkad_Close(struct rx_securityClass *aobj);
69 extern int rxkad_NewConnection(struct rx_securityClass *aobj,
70                                struct rx_connection *aconn);
71 extern int rxkad_DestroyConnection(struct rx_securityClass *aobj,
72                                    struct rx_connection *aconn);
73 extern int rxkad_CheckPacket(struct rx_securityClass *aobj,
74                              struct rx_call *acall,
75                              struct rx_packet *apacket);
76 extern int rxkad_PreparePacket(struct rx_securityClass *aobj,
77                                struct rx_call *acall,
78                                struct rx_packet *apacket);
79 extern int rxkad_GetStats(struct rx_securityClass *aobj,
80                           struct rx_connection *aconn,
81                           struct rx_securityObjectStats *astats);
82 extern rxkad_level rxkad_StringToLevel(char *string);
83 extern char *rxkad_LevelToString(rxkad_level level);
84
85 /* rxkad_errs.c */
86
87 /* rxkad_server.c */
88 extern struct rx_securityClass *rxkad_NewServerSecurityObject(rxkad_level
89                                                               level, void
90                                                               *get_key_rock,
91                                                               int (*get_key)
92
93
94
95                                                               (void
96                                                                *get_key_rock,
97                                                                int kvno,
98                                                                struct
99                                                                ktc_encryptionKey
100                                                                * serverKey),
101                                                               int (*user_ok)
102
103
104
105                                                               (char *name,
106                                                                char
107                                                                *instance,
108                                                                char *cell,
109                                                                afs_int32
110                                                                kvno));
111 extern int rxkad_CheckAuthentication(struct rx_securityClass *aobj,
112                                      struct rx_connection *aconn);
113 extern int rxkad_CreateChallenge(struct rx_securityClass *aobj,
114                                  struct rx_connection *aconn);
115 extern int rxkad_GetChallenge(struct rx_securityClass *aobj,
116                               struct rx_connection *aconn,
117                               struct rx_packet *apacket);
118 extern int rxkad_CheckResponse(struct rx_securityClass *aobj,
119                                struct rx_connection *aconn,
120                                struct rx_packet *apacket);
121 extern afs_int32 rxkad_GetServerInfo(struct rx_connection *aconn,
122                                      rxkad_level * level,
123                                      afs_uint32 * expiration, char *name,
124                                      char *instance, char *cell,
125                                      afs_int32 * kvno);
126 extern afs_int32 rxkad_SetConfiguration(struct rx_securityClass *aobj,
127                                         struct rx_connection *aconn,
128                                         rx_securityConfigVariables atype,
129                                         void * avalue, void **aresult);
130
131 /* ticket.c */
132 extern int tkt_DecodeTicket(char *asecret, afs_int32 ticketLen,
133                             struct ktc_encryptionKey *key, char *name,
134                             char *inst, char *cell, struct ktc_encryptionKey *sessionKey,
135                             afs_int32 * host, afs_uint32 * start,
136                             afs_uint32 * end);
137 extern int tkt_MakeTicket(char *ticket, int *ticketLen,
138                           struct ktc_encryptionKey *key, char *name,
139                           char *inst, char *cell, afs_uint32 start,
140                           afs_uint32 end,
141                           struct ktc_encryptionKey *sessionKey,
142                           afs_uint32 host, char *sname, char *sinst);
143 extern int tkt_CheckTimes(afs_uint32 start, afs_uint32 end, afs_uint32 now);
144 extern afs_int32 ktohl(char flags, afs_int32 l);
145 extern afs_uint32 life_to_time(afs_uint32 start, unsigned char life);
146 extern unsigned char time_to_life(afs_uint32 start, afs_uint32 end);
147
148 /* crc.c */
149 extern void _rxkad_crc_init_table(void);
150 extern afs_uint32 _rxkad_crc_update(const char *p, size_t len, afs_uint32 res);
151
152 /* ticket5.c */
153 extern int tkt_DecodeTicket5(char *ticket, afs_int32 ticket_len,
154                              int (*get_key) (void *, int,
155                                              struct ktc_encryptionKey *),
156                              char *get_key_rock, int serv_kvno, char *name,
157                              char *inst, char *cell, struct ktc_encryptionKey *session_key,
158                              afs_int32 * host, afs_uint32 * start,
159                              afs_uint32 * end, afs_int32 disableDotCheck);
160
161 #endif