833d157f8b1147db141bb50a8a21e2da3e1948ee
[silc.git] / lib / silcske / silcske_i.h
1 /*
2
3   silcske_i.h
4
5   Author: Pekka Riikonen <priikone@silcnet.org>
6
7   Copyright (C) 2005 Pekka Riikonen
8
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.
12
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.
17
18 */
19
20 #ifndef SILCSKE_I_H
21 #define SILCSKE_I_H
22
23 /* Length of cookie in Start Payload */
24 #define SILC_SKE_COOKIE_LEN 16
25
26 /* SKE context */
27 struct SilcSKEStruct {
28   SilcPacketStream stream;
29   SilcRng rng;
30   SilcSKECallbacks callbacks;
31   void *user_data;
32   SilcSKEStatus status;
33
34   /* Negotiated Security properties.  May be NULL in case of error. */
35   SilcSKESecurityProperties prop;
36
37   /* Key Exchange payloads filled during key negotiation with
38      remote data. Responder may save local data here as well. */
39   SilcSKEStartPayload start_payload;
40   SilcSKEKEPayload ke1_payload;
41   SilcSKEKEPayload ke2_payload;
42
43   /* Temporary copy of the KE Start Payload used in the
44      HASH computation. */
45   SilcBuffer start_payload_copy;
46
47   /* Random number x, 1 < x < q. This is the secret exponent
48      used in Diffie Hellman computations. */
49   SilcMPInt *x;
50
51   /* The secret shared key */
52   SilcMPInt *KEY;
53
54   /* The hash value HASH of the key exchange */
55   unsigned char *hash;
56   SilcUInt32 hash_len;
57
58   char *version;                      /* Local version */
59   char *remote_version;               /* Remote version */
60
61   SilcPublicKey public_key;
62   SilcPrivateKey private_key;
63   SilcSKEPKType pk_type;
64   SilcPacket packet;
65   SilcSKESecurityPropertyFlag flags;
66   SilcSKEKeyMaterial keymat;
67   SilcSKERekeyMaterial rekey;
68   SilcSchedule schedule;
69   SilcFSMStruct fsm;
70   SilcAsyncOperationStruct op;
71
72   unsigned int aborted    : 1;
73   unsigned int responder  : 1;
74 };
75
76 #endif /* SILCSKE_I_H */