From 53568d96fcfd23540d0f73ff07280284acebcd65 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Wed, 4 Apr 2001 14:36:21 +0000 Subject: [PATCH] updates. --- apps/silcd/server.c | 31 ++++++++++++++++--------------- apps/silcd/server_internal.h | 7 +++++++ lib/silccrypt/silccipher.h | 2 +- lib/silcske/silcske.c | 2 +- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/apps/silcd/server.c b/apps/silcd/server.c index 1ba577a4..579f5033 100644 --- a/apps/silcd/server.c +++ b/apps/silcd/server.c @@ -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); } diff --git a/apps/silcd/server_internal.h b/apps/silcd/server_internal.h index bc215e07..1de43890 100644 --- a/apps/silcd/server_internal.h +++ b/apps/silcd/server_internal.h @@ -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 diff --git a/lib/silccrypt/silccipher.h b/lib/silccrypt/silccipher.h index d998d020..14fcbc9c 100644 --- a/lib/silccrypt/silccipher.h +++ b/lib/silccrypt/silccipher.h @@ -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); diff --git a/lib/silcske/silcske.c b/lib/silcske/silcske.c index 4e884f44..4d73f240 100644 --- a/lib/silcske/silcske.c +++ b/lib/silcske/silcske.c @@ -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)); -- 2.24.0