5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 2005 - 2007 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; version 2 of the License.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
23 /* Packet retry counter and timer defines for UDP transport. */
24 #define SILC_SKE_RETRY_COUNT 4 /* Max packet retry count */
25 #define SILC_SKE_RETRY_MUL 2 /* Retry timer interval growth */
26 #define SILC_SKE_RETRY_RAND 2 /* Randomizer, timeout += rnd % 2 */
27 #define SILC_SKE_RETRY_MIN 1 /* Min retry timeout, seconds */
29 /* Length of cookie in Start Payload */
30 #define SILC_SKE_COOKIE_LEN 16
33 struct SilcSKEStruct {
34 SilcPacketStream stream;
37 SilcSKECallbacks callbacks;
41 /* Negotiated Security properties. May be NULL in case of error. */
42 SilcSKESecurityProperties prop;
44 /* Key Exchange payloads filled during key negotiation with
45 remote data. Responder may save local data here as well. */
46 SilcSKEStartPayload start_payload;
47 SilcSKEKEPayload ke1_payload;
48 SilcSKEKEPayload ke2_payload;
50 /* Temporary copy of the KE Start Payload used in the
52 SilcBuffer start_payload_copy;
54 /* Random number x, 1 < x < q. This is the secret exponent
55 used in Diffie Hellman computations. */
58 /* The secret shared key */
61 /* The hash value HASH of the key exchange */
65 char *version; /* Local version */
66 char *remote_version; /* Remote version */
68 SilcPublicKey public_key;
69 SilcPrivateKey private_key;
70 SilcSKEPKType pk_type;
72 SilcSKESecurityPropertyFlag flags;
73 SilcSKEKeyMaterial keymat;
74 SilcSKERekeyMaterial rekey;
75 SilcSchedule schedule;
77 SilcAsyncOperationStruct op;
78 SilcUInt16 session_port;
80 /* Packet retransmission */
81 SilcUInt16 retry_timer;
82 SilcUInt16 retry_count;
83 struct SilcSKEPacketRetransmission {
85 SilcPacketFlags flags;
90 SilcUInt16 timeout; /* SKE timeout */
92 unsigned int aborted : 1; /* Set when SKE aborted */
93 unsigned int freed : 1; /* Set when freed during session */
94 unsigned int responder : 1; /* Set when we are responder side */
95 unsigned int running : 1; /* Set when SKE is running */
96 unsigned int rekeying : 1; /* Set when rekeying */
99 #endif /* SILCSKE_I_H */