From 4760d6aa6c3248d7e6757d2e7e7a19a834b2dc34 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Fri, 9 Mar 2001 10:44:01 +0000 Subject: [PATCH] updates. --- CHANGES | 9 +++++++++ doc/draft-riikonen-silc-ke-auth-01.nroff | 3 +++ lib/silcclient/client_keyagr.c | 5 +++-- lib/silcclient/silcapi.h | 3 ++- lib/silccore/silcchannel.c | 11 +++++++---- lib/silccrypt/silccipher.h | 3 +-- lib/silcutil/silcnet.c | 3 ++- 7 files changed, 27 insertions(+), 10 deletions(-) diff --git a/CHANGES b/CHANGES index 47f3c148..7d100fb5 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,12 @@ +Fri Mar 9 12:40:42 EET 2001 Pekka Riikonen + + * Minor fix t the channel payload; allocate the data area, as it + needs to be of specific length. + + * If the key agreement port is zero then the operating + system will define the bound port. Affected files are + lib/silcclient/silcapi.h and lib/silcclient/client_keyagr.c. + Thu Mar 8 21:39:03 EET 2001 Pekka Riikonen * Added assert()s to buffer formatting and unformatting routines diff --git a/doc/draft-riikonen-silc-ke-auth-01.nroff b/doc/draft-riikonen-silc-ke-auth-01.nroff index 87030a7c..27176028 100644 --- a/doc/draft-riikonen-silc-ke-auth-01.nroff +++ b/doc/draft-riikonen-silc-ke-auth-01.nroff @@ -166,6 +166,9 @@ servers. In client connections usually all the packets are protected with this key except channel messages; channels has their own keys and they are not exchanged with this protocol. +The Diffie-Hellman implementation used in the SILC should be compliant +to the PKCS #3. + .ti 0 2.1 Key Exchange Payloads diff --git a/lib/silcclient/client_keyagr.c b/lib/silcclient/client_keyagr.c index ca62805c..487b8b5b 100644 --- a/lib/silcclient/client_keyagr.c +++ b/lib/silcclient/client_keyagr.c @@ -222,7 +222,8 @@ SILC_TASK_CALLBACK(silc_client_key_agreement_timeout) that port for the key agreement protocol. It also sends the `hostname' and the `port' in the key agreement packet to the remote client. This would indicate that the remote client may initiate the key agreement - protocol to the `hostname' on the `port'. + protocol to the `hostname' on the `port'. If port is zero then the + bound port is undefined (the operating system defines it). If the `hostname' and `port' is not provided then empty key agreement packet is sent to the remote client. The remote client may reply with @@ -268,7 +269,7 @@ void silc_client_send_key_agreement(SilcClient client, return; /* Create the listener if hostname and port was provided */ - if (hostname && port) { + if (hostname) { ke = silc_calloc(1, sizeof(*ke)); ke->fd = silc_net_create_server(port, hostname); diff --git a/lib/silcclient/silcapi.h b/lib/silcclient/silcapi.h index a546b957..67372a55 100644 --- a/lib/silcclient/silcapi.h +++ b/lib/silcclient/silcapi.h @@ -560,7 +560,8 @@ void silc_client_free_channel_private_keys(SilcChannelPrivateKey *keys, that port for the key agreement protocol. It also sends the `hostname' and the `port' in the key agreement packet to the remote client. This would indicate that the remote client may initiate the key agreement - protocol to the `hostname' on the `port'. + protocol to the `hostname' on the `port'. If port is zero then the + bound port is undefined (the operating system defines it). If the `hostname' and `port' is not provided then empty key agreement packet is sent to the remote client. The remote client may reply with diff --git a/lib/silccore/silcchannel.c b/lib/silccore/silcchannel.c index 54409ec1..b3956cd2 100644 --- a/lib/silccore/silcchannel.c +++ b/lib/silccore/silcchannel.c @@ -85,8 +85,8 @@ SilcChannelPayload silc_channel_payload_parse(SilcBuffer buffer, /* Parse the Channel Payload. Ignore the padding. */ ret = silc_buffer_unformat(buffer, - SILC_STR_UI16_NSTRING(&new->data, - &new->data_len), + SILC_STR_UI16_NSTRING_ALLOC(&new->data, + &new->data_len), SILC_STR_UI16_NSTRING(NULL, NULL), SILC_STR_UI_XNSTRING(&new->mac, mac_len), SILC_STR_UI_XNSTRING(&new->iv, iv_len), @@ -102,7 +102,7 @@ SilcChannelPayload silc_channel_payload_parse(SilcBuffer buffer, return new; err: - silc_free(new); + silc_channel_payload_free(new); return NULL; } @@ -175,8 +175,11 @@ SilcBuffer silc_channel_payload_encode(unsigned short data_len, void silc_channel_payload_free(SilcChannelPayload payload) { - if (payload) + if (payload) { + if (payload->data) + silc_free(payload->data); silc_free(payload); + } } /* Return data */ diff --git a/lib/silccrypt/silccipher.h b/lib/silccrypt/silccipher.h index 65ef26ee..fe764bd0 100644 --- a/lib/silccrypt/silccipher.h +++ b/lib/silccrypt/silccipher.h @@ -66,8 +66,7 @@ typedef struct SilcCipherStruct { void (*set_iv)(struct SilcCipherStruct *, const unsigned char *); void (*get_iv)(struct SilcCipherStruct *, unsigned char *); - unsigned int (*get_key_len)(struct SilcCipherStruct *, - const unsigned char *); + unsigned int (*get_key_len)(struct SilcCipherStruct *); unsigned int (*get_block_len)(struct SilcCipherStruct *); } *SilcCipher; diff --git a/lib/silcutil/silcnet.c b/lib/silcutil/silcnet.c index 78d7ce6b..6914ccce 100644 --- a/lib/silcutil/silcnet.c +++ b/lib/silcutil/silcnet.c @@ -52,7 +52,8 @@ int silc_net_create_server(int port, char *ip_addr) /* Set the socket information for bind() */ memset(&server, 0, sizeof(server)); server.sin_family = PF_INET; - server.sin_port = htons(port); + if (port) + server.sin_port = htons(port); /* Convert IP address to network byte order */ if (ip_addr) -- 2.24.0