file configure.in.pre.
* The silc_thread_create now calls the start function
- directly if threads support is not compiled in. Removes
+ directly if threads support is not compiled in. Removes
ugly #ifdef's from generic code. Affected files are
lib/silcutil/unix/silcunixthread, win32/silcwin32thread.c.
TODO/bugs In SILC Server
========================
+ o XXXXXXXXX cannot join +a channel from other servers
+
o Implement the <founder auth> and founder privileges gaining to
the JOIN command. This will bypass invite-only mode as well for
the client who got the founder mode during JOIN.
not in distribution), but it is not used yet, and it requires some
tweaking on the Makefiles (we want static lib not shared).
+ o Implement the defined SilcDH API. The definition is in
+ lib/silccrypt/silcdh.h.
+
o Add builtin SOCKS and HTTP Proxy support, well the SOCKS at least.
SILC currently supports SOCKS4 and SOCKS5 but it needs to be compiled
in separately.
to start writing one myself. Anyhow, the OpenSSL X.509 lib should
be checked.
- Other package that should be checked is the NSS's X509 library.
+ Other package that should be checked is the NSS's X509 library,
+ which I like more over OpenSSL package.
- o SSH2 public keys support. Maybe - not really needed but could be
- nice as SSH is widely used all over the place. SILC Protocol
- supports SSH2 public keys.
+ o SSH2 public keys support.
o OpenPGP certificate support.
SilcClientID *client_id;
SilcBuffer reply;
SilcIDListData idata;
- SilcIDCacheEntry id_cache = NULL;
char *username = NULL, *realname = NULL, *id_string;
uint32 id_len;
int ret;
if (sconn->retry_count > server->params->retry_count &&
server->params->retry_keep_trying == FALSE) {
SILC_LOG_ERROR(("Could not connect to router, giving up"));
+ silc_free(sconn->remote_host);
+ silc_free(sconn);
return;
}
silc_packet_context_free(ctx->packet);
if (ctx->ske)
silc_ske_free(ctx->ske);
+ silc_free(ctx->auth_data);
silc_free(ctx);
}
SilcConnectionAuthRequest callback,
void *context);
+/****d* silcclient/SilcClientAPI/SilcClientMonitorStatus
+ *
+ * NAME
+ *
+ * typedef enum { ... } SilcClientMonitorStatus;
+ *
+ * DESCRIPTION
+ *
+ * File transmission session status types. These will indicate
+ * the status of the file transmission session.
+ *
+ * SOURCE
+ */
typedef enum {
- SILC_CLIENT_FILE_MONITOR_KEY_AGREEMENT,
- SILC_CLIENT_FILE_MONITOR_SEND,
- SILC_CLIENT_FILE_MONITOR_RECEIVE,
+ SILC_CLIENT_FILE_MONITOR_KEY_AGREEMENT, /* In key agreemenet phase */
+ SILC_CLIENT_FILE_MONITOR_SEND, /* Sending file */
+ SILC_CLIENT_FILE_MONITOR_RECEIVE, /* Receiving file */
SILC_CLIENT_FILE_MONITOR_GET,
SILC_CLIENT_FILE_MONITOR_PUT,
- SILC_CLIENT_FILE_MONITOR_CLOSED,
- SILC_CLIENT_FILE_MONITOR_ERROR,
+ SILC_CLIENT_FILE_MONITOR_CLOSED, /* Session closed */
+ SILC_CLIENT_FILE_MONITOR_ERROR, /* Error during session */
} SilcClientMonitorStatus;
+/***/
+/****d* silcclient/SilcClientAPI/SilcClientFileError
+ *
+ * NAME
+ *
+ * typedef enum { ... } SilcClientFileError;
+ *
+ * DESCRIPTION
+ *
+ * File transmission error types. These types are returned by
+ * some of the file transmission functions, and by the monitor
+ * callback to indicate error.
+ *
+ * SOURCE
+ */
typedef enum {
SILC_CLIENT_FILE_OK,
SILC_CLIENT_FILE_ERROR,
SILC_CLIENT_FILE_NO_SUCH_FILE,
SILC_CLIENT_FILE_PERMISSION_DENIED,
} SilcClientFileError;
+/***/
-/****f* silcclient/SilcClientAPI/silc_client_file_receive
+/****f* silcclient/SilcClientAPI/SilcClientFileMonitor
*
* SYNOPSIS
*
*
* Monitor callback that is called during the file transmission to
* monitor the transmission process. The `status' indicates the current
- * monitoring process. The `offset' is the currently transmitted amount
- * of total `filesize'. The `client_entry' indicates the remote client,
- * and the transmission session ID is the `session_id'. The filename
- * being transmitted is indicated by the `filepath'.
+ * monitoring process. The `error' will indicate the error type
+ * if `status' is SILC_CLIENT_FILE_MONITOR_ERROR. The `offset' is the
+ * currently transmitted amount of total `filesize'. The `client_entry'
+ * indicates the remote client, and the transmission session ID is the
+ * `session_id'. The filename being transmitted is indicated by the
+ * `filepath'.
*
***/
typedef void (*SilcClientFileMonitor)(SilcClient client,
+/*
+
+ silcdh.h
+
+ Author: Pekka Riikonen <priikone@silcnet.org>
+
+ Copyright (C) 2001 Pekka Riikonen
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+*/
+
/****h* silccrypt/SilcDH/silcdh.h
- *
- * NAME
- *
- * silcdh.h
- *
- * COPYRIGHT
- *
- * Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
- *
- * Copyright (C) 2001 Pekka Riikonen
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
*
* DESCRIPTION
*
* PKCS #3 compliant Diffie Hellman key agreement protocol implementation.
* This is used as part of SKE (SILC Key Exchange) protocol.
+ *
***/
#ifndef SILCDH_H
#define SILCDH_H
#include "silcmp.h"
-#include "silcrng.h"
/****s* silccrypt/SilcDH/SilcDH
*
/* Diffie Hellman context. This includes the DH parameters including the
negotiated key material. */
struct SilcDHStruct {
- SilcMPInt *g; /* Global base (generator) */
- SilcMPInt *p; /* Global prime (modulus, prime) */
- SilcMPInt *lpf; /* Largest prime factor (prime) */
- SilcMPInt *my_x; /* x, My private value (random) */
- SilcMPInt *my_y; /* y, My public value (y = g ^ x mod p) */
- SilcMPInt *your_y; /* y', Your public value (y' = g ^ x' mod p) */
- SilcMPInt *z; /* The computed secret key (z = y' ^ x mod p) */
-
- SilcRng rng; /* RNG */
+ SilcMPInt *g; /* Global base (generator) */
+ SilcMPInt *p; /* Global prime (modulus, prime) */
+ SilcMPInt *lpf; /* Largest prime factor (prime) */
+ SilcMPInt *my_x; /* x, My private value (random) */
+ SilcMPInt *my_y; /* y, My public value (y = g ^ x mod p) */
+ SilcMPInt *your_y; /* y', Your public value (y' = g ^ x' mod p) */
+ SilcMPInt *z; /* The computed secret key (z = y' ^ x mod p) */
};
/****f* silccrypt/SilcDH/silc_dh_alloc
*
* SYNOPSIS
*
- * SilcDH silc_dh_alloc(SilcRng rng, SilcMPInt *g, SilcMPInt *p, SilcMPInt *lpf);
+ * SilcDH silc_dh_alloc(SilcMPInt *g, SilcMPInt *p, SilcMPInt *lpf);
*
* DESCRIPTION
*
- * Allocate SilcDH context. The `rng' must be initialized random number
- * generator context, the `g' is the public base generator used in the
- * negotiation, the `p' is the public prime used in the negotiation and
- * the `lpf' is largest prime factor of p defined publicly as well. The
- * `lpf' is optional and if it is not supplied then the private values
- * generated satifies 0 < x < p - 1 instead of 0 < x < lpf. Returns NULL
- * on error or allocated SilcDH context on success.
+ * Allocate SilcDH context. The `g' is the public base generator used
+ * in the negotiation, the `p' is the public prime used in the
+ * negotiation and the `lpf' is largest prime factor of p defined
+ * publicly as well. The `lpf' is optional and if it is not supplied
+ * then the private values generated satifies 0 < x < p - 1 instead
+ * of 0 < x < lpf. Returns NULL on error or allocated SilcDH context
+ * on success.
*
***/
-SilcDH silc_dh_alloc(SilcRng rng, SilcMPInt *g, SilcMPInt *p, SilcMPInt *lpf);
+SilcDH silc_dh_alloc(SilcMPInt *g, SilcMPInt *p, SilcMPInt *lpf);
/****f* silccrypt/SilcDH/silc_dh_free
*
*
* DESCRIPTION
*
- * Frees the SilcDH context. Does not free the RNG context given in the
- * allocation. Frees all the allocated data inside the SilcDH context.
+ * Free the SilcDH context. Frees all the allocated data inside the
+ * SilcDH context.
*
***/
void silc_dh_free(SilcDH dh);
*
* SYNOPSIS
*
- * int silc_dh_generate_private(SilcDH dh, SilcMPInt **x);
+ * bool silc_dh_generate_private(SilcDH dh, const SilcMPInt **x);
*
* DESCRIPTION
*
* Generates random private value `x' such that 0 < x < lpf at most of
* length of lpf. Returns FALSE if the random number could not be generated.
* Returns the generated value into `x' pointer sent as argument, unless
- * the `x' is NULL. The returned `x' must no be freed by the caller.
+ * the `x' is NULL. The returned `x' must not be freed by the caller.
*
***/
-int silc_dh_generate_private(SilcDH dh, SilcMPInt **x);
+bool silc_dh_generate_private(SilcDH dh, const SilcMPInt **x);
/****f* silccrypt/SilcDH/silc_dh_compute_public
*
* SYNOPSIS
*
- * int silc_dh_compute_public(SilcDH dh, SilcMPInt **y);
+ * bool silc_dh_compute_public(SilcDH dh, const SilcMPInt **y);
*
* DESCRIPTION
*
* freed by the caller.
*
***/
-int silc_dh_compute_public(SilcDH dh, SilcMPInt **y);
+bool silc_dh_compute_public(SilcDH dh, const SilcMPInt **y);
/****f* silccrypt/SilcDH/silc_dh_remote_public
*
* SYNOPSIS
*
- * int silc_dh_compute_public(SilcDH dh, SilcMPInt **y);
+ * bool silc_dh_compute_public(SilcDH dh, SilcMPInt *y);
*
* DESCRIPTION
*
* on error.
*
***/
-int silc_dh_set_remote_public(SilcDH dh, SilcMPInt *y);
+bool silc_dh_set_remote_public(SilcDH dh, SilcMPInt *y);
/****f* silccrypt/SilcDH/silc_dh_compute_key
*
* SYNOPSIS
*
- * int silc_dh_compute_key(SilcDH dh, SilcMPInt **z);
+ * bool silc_dh_compute_key(SilcDH dh, const SilcMPInt **z);
*
* DESCRIPTION
*
* freed by the caller.
*
***/
-int silc_dh_compute_key(SilcDH dh, SilcMPInt **z);
+bool silc_dh_compute_key(SilcDH dh, const SilcMPInt **z);
/****f* silccrypt/SilcDH/silc_dh_remote_public
*
* SYNOPSIS
*
- * int silc_dh_compute_key_data(SilcDH dh, unsigned char **z,
- * uint32 *z_len);
+ * bool silc_dh_compute_key_data(SilcDH dh, unsigned char **z,
+ * uint32 *z_len);
*
* DESCRIPTION
*
* Same as above but returns the computed secret key as octet binary
- * string.
+ * string. The caller must free the returned binary string.
*
***/
-int silc_dh_compute_key_data(SilcDH dh, unsigned char **z,
- uint32 *z_len);
+bool silc_dh_compute_key_data(SilcDH dh, unsigned char **z,
+ uint32 *z_len);
#endif
/*
- mp_gmp.c
+ mp_gmp.c
- Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
+ Author: Pekka Riikonen <priikone@silcnet.org>
Copyright (C) 2001 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
+ the Free Software Foundation; version 2 of the License.
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/*
- mp_mpi.c
+ mp_mpi.c
- Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
+ Author: Pekka Riikonen <priikone@silcnet.org>
Copyright (C) 2001 Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
+ the Free Software Foundation; version 2 of the License.
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
return mp_radix_size(mp, base) - 2; /* XXX This is actually wrong since
this might produce wrong balue.
But, it looks like MPI always returns
- correct value + plus, whereas
+ correct value plus one, whereas
GMP returns always the right value. */
}
return SILC_SKE_STATUS_OK;
err:
- if (payload->pk_data)
- silc_free(payload->pk_data);
- if (payload->sign_data)
- silc_free(payload->sign_data);
- if (x)
- silc_free(x);
+ silc_free(payload->pk_data);
+ silc_free(payload->sign_data);
+ silc_free(x);
silc_free(payload);
ske->status = status;
return status;
void silc_ske_payload_ke_free(SilcSKEKEPayload *payload)
{
if (payload) {
- if (payload->pk_data)
- silc_free(payload->pk_data);
+ silc_free(payload->pk_data);
silc_mp_uninit(&payload->x);
- if (payload->sign_data)
- silc_free(payload->sign_data);
+ silc_free(payload->sign_data);
silc_free(payload);
}
}
/* Free KE payload */
if (ske->ke1_payload)
silc_ske_payload_ke_free(ske->ke1_payload);
+ if (ske->ke2_payload)
+ silc_ske_payload_ke_free(ske->ke2_payload);
/* Free rest */
if (ske->prop) {