5 Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
7 Copyright (C) 1997 - 2000 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
24 /* SILC client protocol types */
25 #define SILC_PROTOCOL_CLIENT_NONE 0
26 #define SILC_PROTOCOL_CLIENT_CONNECTION_AUTH 1
27 #define SILC_PROTOCOL_CLIENT_KEY_EXCHANGE 2
28 #define SILC_PROTOCOL_CLIENT_REKEY 3
29 /* #define SILC_PROTOCOL_CLIENT_MAX 255 */
31 /* Internal context for key exchange protocol */
34 SilcSocketConnection sock;
38 void *dest_id; /* Destination ID from packet */
39 SilcIdType dest_id_type; /* Destination ID type */
41 SilcTask timeout_task;
42 SilcPacketContext *packet;
44 SilcSKESendPacketCb send_packet; /* SKE's packet sending callback */
45 SilcSKEVerifyCb verify; /* SKE's key verify callback */
46 SilcSKE ske; /* The SKE object */
47 SilcSKEKeyMaterial *keymat; /* The negotiated key material */
48 void *context; /* Internal context */
49 } SilcClientKEInternalContext;
51 /* Internal context for connection authentication protocol */
54 SilcSocketConnection sock;
56 /* SKE object from Key Exchange protocol. */
59 /* Auth method that must be used. This is resolved before this
60 connection authentication protocol is started. */
61 SilcProtocolAuthMeth auth_meth;
63 /* Destinations ID from KE protocol context */
65 SilcIdType dest_id_type;
67 /* Authentication data if we alreay know it. This is filled before
68 starting the protocol if we know the authentication data. Otherwise
69 these are and remain NULL. */
70 unsigned char *auth_data;
71 SilcUInt32 auth_data_len;
73 SilcTask timeout_task;
74 } SilcClientConnAuthInternalContext;
76 /* Internal context for the rekey protocol */
80 SilcSocketConnection sock;
81 bool responder; /* TRUE if we are receiving party */
82 bool pfs; /* TRUE if PFS is to be used */
83 SilcSKE ske; /* Defined if PFS is used */
84 SilcPacketContext *packet;
85 } SilcClientRekeyInternalContext;
88 void silc_client_protocols_register(void);
89 void silc_client_protocols_unregister(void);
90 void silc_client_protocol_ke_send_packet(SilcSKE ske,
94 void silc_client_protocol_ke_verify_key(SilcSKE ske,
95 unsigned char *pk_data,
97 SilcSKEPKType pk_type,
99 SilcSKEVerifyCbCompletion completion,
100 void *completion_context);
101 void silc_client_protocol_ke_set_keys(SilcSKE ske,
102 SilcSocketConnection sock,
103 SilcSKEKeyMaterial *keymat,
108 SilcSKEDiffieHellmanGroup group,