updates.
authorPekka Riikonen <priikone@silcnet.org>
Wed, 4 Apr 2001 14:36:21 +0000 (14:36 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Wed, 4 Apr 2001 14:36:21 +0000 (14:36 +0000)
apps/silcd/server.c
apps/silcd/server_internal.h
lib/silccrypt/silccipher.h
lib/silcske/silcske.c

index 1ba577a403e9e11106c0b27bcac287a30e74f475..579f5033ebc8637b14d13fe7464a52053fc3e5d6 100644 (file)
@@ -848,8 +848,8 @@ SILC_TASK_CALLBACK(silc_server_connect_to_router_final)
   SilcServerEntry id_entry;
   SilcBuffer packet;
   SilcServerHBContext hb_context;
+  SilcServerRekeyContext rekey;
   unsigned char *id_string;
-  SilcIDListData idata;
 
   SILC_LOG_DEBUG(("Start"));
 
@@ -914,8 +914,7 @@ SILC_TASK_CALLBACK(silc_server_connect_to_router_final)
   sock->type = SILC_SOCKET_TYPE_ROUTER;
   server->id_entry->router = id_entry;
   server->router = id_entry;
-  idata = (SilcIDListData)sock->user_data;
-  idata->registered = TRUE;
+  server->router->data.registered = TRUE;
 
   /* Perform keepalive. The `hb_context' will be freed automatically
      when finally calling the silc_socket_free function. XXX hardcoded 
@@ -926,12 +925,14 @@ SILC_TASK_CALLBACK(silc_server_connect_to_router_final)
                            silc_server_perform_heartbeat,
                            server->timeout_queue);
 
-  /* Register re-key timeout */
-  idata->rekey->timeout = 60; /* XXX hardcoded */
-  idata->rekey->context = (void *)server;
+  /* Registed re-key timeout */
+  rekey = silc_calloc(1, sizeof(*rekey));
+  rekey->server = server;
+  rekey->sock = sock;
+  rekey->timeout = 3600; /* XXX hardcoded */
   silc_task_register(server->timeout_queue, sock->sock, 
                     silc_server_rekey_callback,
-                    (void *)sock, idata->rekey->timeout, 0,
+                    (void *)rekey, rekey->timeout, 0,
                     SILC_TASK_TIMEOUT, SILC_TASK_PRI_NORMAL);
 
   /* If we are router then announce our possible servers. */
@@ -3604,9 +3605,8 @@ SilcClientEntry silc_server_get_client_resolve(SilcServer server,
 
 SILC_TASK_CALLBACK(silc_server_rekey_callback)
 {
-  SilcSocketConnection sock = (SilcSocketConnection)context;
-  SilcIDListData idata = (SilcIDListData)sock->user_data;
-  SilcServer server = (SilcServer)idata->rekey->context;
+  SilcServerRekeyContext rekey = (SilcServerRekeyContext)context;
+  SilcServer server = rekey->server;
   SilcProtocol protocol;
   SilcServerRekeyInternalContext *proto_ctx;
 
@@ -3616,23 +3616,24 @@ SILC_TASK_CALLBACK(silc_server_rekey_callback)
      to the protocol. */
   proto_ctx = silc_calloc(1, sizeof(*proto_ctx));
   proto_ctx->server = (void *)server;
-  proto_ctx->sock = sock;
+  proto_ctx->context = context;
+  proto_ctx->sock = rekey->sock;
   proto_ctx->responder = FALSE;
       
   /* Perform rekey protocol. Will call the final callback after the
      protocol is over. */
   silc_protocol_alloc(SILC_PROTOCOL_SERVER_REKEY, 
                      &protocol, proto_ctx, silc_server_rekey_final);
-  sock->protocol = protocol;
+  rekey->sock->protocol = protocol;
       
   /* Run the protocol */
   protocol->execute(server->timeout_queue, 0, protocol, 
-                   sock->sock, 0, 0);
+                   rekey->sock->sock, 0, 0);
 
   /* Re-register re-key timeout */
-  silc_task_register(server->timeout_queue, sock->sock
+  silc_task_register(server->timeout_queue, 0
                     silc_server_rekey_callback,
-                    context, idata->rekey->timeout, 0,
+                    context, rekey->timeout, 0,
                     SILC_TASK_TIMEOUT, SILC_TASK_PRI_NORMAL);
 }
 
index bc215e07da8db9358021808434226b094048ab06..1de43890672c3e09ca8816ec55be816bf78fdc84 100644 (file)
@@ -160,6 +160,13 @@ typedef struct {
   uint32 failure;
 } *SilcServerFailureContext;
 
+/* Session key's re-key context. */
+typedef struct {
+  SilcServer server;
+  SilcSocketConnection sock;
+  uint32 timeout;
+} *SilcServerRekeyContext;
+
 /* Macros */
 
 /* Registers generic task for file descriptor for reading from network and
index d998d020b475dbd7eced515b8457a5f2abbf349e..14fcbc9cb4065364af2c5d6d218ae27d3749fd61 100644 (file)
@@ -44,7 +44,7 @@
 typedef struct {
   char *name;
   uint32 block_len;
-  unsigned key_len;
+  uint32 key_len;
 
   int (*set_key)(void *, const unsigned char *, uint32);
   int (*set_key_with_string)(void *, const unsigned char *, uint32);
index 4e884f441dd28d82e3bbd31ba1706ed126ce32e0..4d73f2403e20786e240492b559c66306d1defa29 100644 (file)
@@ -281,7 +281,7 @@ SilcSKEStatus silc_ske_initiator_phase_2(SilcSKE ske,
     uint32 hash_len, sign_len;
 
     SILC_LOG_DEBUG(("We are doing mutual authentication"));
-    SILC_LOG_DEBUG(("Computing HASH value"));
+    SILC_LOG_DEBUG(("Computing HASH_i value"));
 
     /* Compute the hash value */
     memset(hash, 0, sizeof(hash));