updates.
authorPekka Riikonen <priikone@silcnet.org>
Mon, 26 Feb 2001 17:32:08 +0000 (17:32 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Mon, 26 Feb 2001 17:32:08 +0000 (17:32 +0000)
apps/silcd/command.c
apps/silcd/server.c
apps/silcd/testi2.conf
lib/silcclient/client.c
lib/silccrypt/silccipher.c

index 418b5b12f72f199aa143eed8ee90de6b86603b0d..2361f87fe565b1c6d9532c38c73c568f3a3a51b1 100644 (file)
@@ -2988,7 +2988,7 @@ SILC_SERVER_CMD_FUNC(connect)
   unsigned int tmp_len;
   unsigned int port = SILC_PORT;
 
-  SILC_SERVER_COMMAND_CHECK_ARGC(SILC_COMMAND_CONNECT, cmd, 1, 2);
+  SILC_SERVER_COMMAND_CHECK_ARGC(SILC_COMMAND_CONNECT, cmd, 0, 0);
 
   if (!client || cmd->sock->type != SILC_SOCKET_TYPE_CLIENT)
     goto out;
@@ -3048,7 +3048,7 @@ SILC_SERVER_CMD_FUNC(close)
   unsigned char *name;
   unsigned int port = SILC_PORT;
 
-  SILC_SERVER_COMMAND_CHECK_ARGC(SILC_COMMAND_CLOSE, cmd, 1, 2);
+  SILC_SERVER_COMMAND_CHECK_ARGC(SILC_COMMAND_CLOSE, cmd, 0, 0);
 
   if (!client || cmd->sock->type != SILC_SOCKET_TYPE_CLIENT)
     goto out;
index 89043217a744ddfe7036f0caf3d003477eeb239a..5db18ef609a3c1a655e04ea88b0714b93e681728 100644 (file)
@@ -2334,8 +2334,7 @@ void silc_server_create_channel_key(SilcServer server,
   unsigned int len;
 
   if (!channel->channel_key)
-    if (!silc_cipher_alloc("aes-256-cbc", &channel->channel_key))
-      return;
+    silc_cipher_alloc("aes-256-cbc", &channel->channel_key);
 
   if (key_len)
     len = key_len;
index 50064d06d312213d69701d4b9a19f14103d3e2f4..674f0cfae991570b8f70204e5a5231be697aa98c 100644 (file)
@@ -3,7 +3,7 @@ aes-256-cbc:../lib/silcsim/modules/aes.sim.so:32:16
 aes-192-cbc:../lib/silcsim/modules/aes.sim.so:24:16
 aes-128-cbc:../lib/silcsim/modules/aes.sim.so:16:16
 twofish-256-cbc:../lib/silcsim/modules/twofish.sim.so:32:16
-twofish-192-cbc:../lib/silcsim/modules/twofish.sim.so:24:16
+twofish-192-cbc:../lib/silcsim/modules/twofish.sim.so:24:16  
 twofish-128-cbc:../lib/silcsim/modules/twofish.sim.so:16:16
 mars-256-cbc:../lib/silcsim/modules/mars.sim.so:32:16
 mars-192-cbc:../lib/silcsim/modules/mars.sim.so:24:16
@@ -25,10 +25,10 @@ nobody:nobody
 Mun huone:Mun servo:Pekka Riikonen:priikone@poseidon.pspt.fi
 
 [ServerInfo]
-lassi.kuo.fi.ssh.com:212.146.42.253:Kuopio, Finland:1334
+lassi.kuo.fi.ssh.com:10.2.1.7:Kuopio, Finland:1334
 
 [ListenPort]
-212.146.42.253:212.146.42.253:1334
+10.2.1.7:10.2.1.7:1334
 
 [Logging]
 infologfile:silcd2.log:10000
@@ -49,10 +49,10 @@ errorlogfile:silcd2.log:10000
 [AdminConnection]
 
 [ServerConnection]
-212.146.42.253:passwd:priikone:1333:1:1
+10.2.1.7:passwd:priikone:1333:1:1
 
 [RouterConnection]
-212.146.42.253:passwd:priikone:1335:1:1:0
+10.2.1.7:passwd:priikone:1335:1:1:0
 
 [DenyConnection]
 [RedirectClient]
index b4f46104e8e13cac0048d511aac65aa3c5cb469b..08b643ea33c3d1c2d72053e811c59590fa0d57a3 100644 (file)
@@ -970,7 +970,6 @@ void silc_client_packet_send_to_channel(SilcClient client,
   SilcCipher cipher;
   SilcHmac hmac;
   unsigned char *id_string;
-  unsigned int block_len;
 
   SILC_LOG_DEBUG(("Sending packet to channel"));
 
@@ -981,15 +980,14 @@ void silc_client_packet_send_to_channel(SilcClient client,
   }
 
   /* Generate IV */
-  block_len = silc_cipher_get_block_len(channel->channel_key);
   if (channel->iv[0] == '\0')
-    for (i = 0; i < block_len; i++) channel->iv[i] = silc_rng_get_byte(client->rng);
+    for (i = 0; i < 16; i++) channel->iv[i] = silc_rng_get_byte(client->rng);
   else
-    silc_hash_make(client->md5hash, channel->iv, block_len, channel->iv);
+    silc_hash_make(client->md5hash, channel->iv, 16, channel->iv);
 
   /* Encode the channel payload */
-  payload = silc_channel_payload_encode(data_len, data, block_len
-                                       channel->iv, client->rng);
+  payload = silc_channel_payload_encode(data_len, data, 16, channel->iv
+                                       client->rng);
   if (!payload) {
     client->ops->say(client, conn, 
                     "Error: Could not create packet to be sent to channel");
@@ -1030,10 +1028,13 @@ void silc_client_packet_send_to_channel(SilcClient client,
 
   packetdata.buffer = sock->outbuf;
 
+  SILC_LOG_HEXDUMP(("IV"), channel->iv, 16);
+  SILC_LOG_HEXDUMP(("channel key"), channel->key, channel->key_len/8);
+
   /* Encrypt payload of the packet. This is encrypted with the channel key. */
   channel->channel_key->cipher->encrypt(channel->channel_key->context,
                                        payload->data, payload->data,
-                                       payload->len - block_len, /* -IV_LEN */
+                                       payload->len - 16, /* -IV_LEN */
                                        channel->iv);
 
   /* Put the actual encrypted payload data into the buffer. */
@@ -2068,7 +2069,6 @@ void silc_client_channel_message(SilcClient client,
   SilcIDCacheEntry id_cache = NULL;
   SilcClientID *client_id = NULL;
   int found = FALSE;
-  unsigned int block_len;
 
   /* Sanity checks */
   if (packet->dst_id_type != SILC_ID_CHANNEL)
@@ -2089,14 +2089,20 @@ void silc_client_channel_message(SilcClient client,
 
   channel = (SilcChannelEntry)id_cache->context;
 
+  SILC_LOG_HEXDUMP(("channel key"), channel->key, channel->key_len);
+
   /* Decrypt the channel message payload. Push the IV out of the way,
      since it is not encrypted (after pushing buffer->tail has the IV). */
-  block_len = silc_cipher_get_block_len(channel->channel_key);
-  silc_buffer_push_tail(buffer, block_len);
+  SILC_LOG_HEXDUMP(("Packet"), buffer->data, buffer->len);
+  silc_buffer_push_tail(buffer, channel->channel_key->cipher->block_len);
+  SILC_LOG_HEXDUMP(("Packet"), buffer->data, buffer->len);
+  SILC_LOG_HEXDUMP(("IV"), buffer->tail, 16);
   channel->channel_key->cipher->decrypt(channel->channel_key->context,
                                        buffer->data, buffer->data,
                                        buffer->len, buffer->tail);
-  silc_buffer_pull_tail(buffer, block_len);
+  SILC_LOG_HEXDUMP(("Packet"), buffer->data, buffer->len);
+  silc_buffer_pull_tail(buffer, channel->channel_key->cipher->block_len);
+  SILC_LOG_HEXDUMP(("Packet"), buffer->data, buffer->len);
 
   /* Parse the channel message payload */
   payload = silc_channel_payload_parse(buffer);
index 0c8b6c77b18a5197aba5daaf228747917ae6720f..8162abd9f046be88a90bf7bac1182a8b57434fc9 100644 (file)
@@ -200,7 +200,7 @@ int silc_cipher_alloc(const unsigned char *name, SilcCipher *new_cipher)
       c = c->next;
     }
 
-    if (!c || !c->cipher->context_len)
+    if (!c)
       goto check_builtin;
 
     /* Set the pointers */
@@ -222,7 +222,6 @@ int silc_cipher_alloc(const unsigned char *name, SilcCipher *new_cipher)
 
   if (silc_cipher_builtin_list[i].name == NULL) {
     silc_free(*new_cipher);
-    *new_cipher = NULL;
     return FALSE;
   }