Commit 15b449ff authored by Niels Möller's avatar Niels Möller

Some cleanup. Removed old files packet_disconnect.[ch],

packet_dispatch.[ch] and void.[ch].

Rev: src/connection.h:1.17
Rev: src/crypto.h:1.7
Rev: src/keyexchange.h:1.15
Rev: src/packet_disconnect.c:1.3(DEAD)
Rev: src/packet_disconnect.h:1.4(DEAD)
Rev: src/packet_dispatch.c:1.7(DEAD)
Rev: src/packet_dispatch.h:1.6(DEAD)
Rev: src/publickey_crypto.c:1.13
Rev: src/publickey_crypto.h:1.9
Rev: src/unpad.h:1.9
Rev: src/void.c:1.8(DEAD)
Rev: src/void.h:1.6(DEAD)
Rev: src/write_buffer.h:1.7
parent ddef5f89
......@@ -33,11 +33,6 @@ struct ssh_connection
struct abstract_write super;
#if 0
struct read_packet *reader; /* Needed for changing the decryption
* algorithms. Is there a better way?
* Perhaps one can keep this pointer
* inside the newkeys-handler? */
int type; /* CONNECTION_SERVER or CONNECTION_CLIENT */
#endif
......
......@@ -28,9 +28,6 @@
#include "abstract_crypto.h"
#if 0
extern struct crypto_instance crypto_none_instance;
#endif
extern struct crypto_algorithm crypto_rc4_algorithm;
extern struct hash_algorithm sha_algorithm;
......
......@@ -175,8 +175,4 @@ struct packet_handler *
make_newkeys_handler(struct crypto_instance *crypto,
struct mac_instance *mac);
#if 0
struct kexinit *parse_kexinit(struct lsh_string *packet);
#endif
#endif /* LSH_KEYEXCHANGE_H_INCLUDED */
/* packet_disconnect.c
*
*
*
* $Id$ */
/* lsh, an implementation of the ssh protocol
*
* Copyright (C) 1998 Niels Möller
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "packet_disconnect.h"
#include "parse.h"
#include "ssh.h"
#include "xalloc.h"
static int do_disconnect(struct packet_handler *closure,
struct ssh_connection *connection,
struct lsh_string *packet)
{
struct simple_buffer buffer;
UINT8 msg;
UINT32 length;
UINT32 reason;
UINT8 *start;
simple_buffer_init(&buffer, packet->length, packet->data);
if (parse_uint8(&buffer, &msg)
&& (msg != SSH_MSG_DISCONNECT)
&& (parse_uint32(&buffer, &reason))
&& (parse_string(&buffer, &length, &start))
/* FIXME: Language tag is ignored */ )
{
/* FIXME: Display message */
}
lsh_string_free(packet);
/* FIXME: Mark the file as closed, somehow (probably a variable in
* the write buffer) */
return WRITE_CLOSED;
}
struct packet_handler *make_disconnect_handler()
{
struct packet_handler *res = xalloc(sizeof(struct packet_handler));
res->handler = do_disconnect;
return res;
}
/* packet_disconnect.h
*
*
*
* $Id$ */
/* lsh, an implementation of the ssh protocol
*
* Copyright (C) 1998 Niels Möller
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef LSH_PACKET_DISCONNECT_H_INCLUDED
#define LSH_PACKET_DISCONNECT_H_INCLUDED
#include "connection.h"
#warning packet_disconnect.h is obsolete
struct packet_handler *make_disconnect_handler();
#endif /* LSH_PACKET_DISCONNECT_H_INCLUDED */
/* packet_dispatch.c
*
*/
#include "packet_dispatch.h"
#include "xalloc.h"
#include "werror.h"
static int do_dispatch(struct abstract_write **w,
struct lsh_string *packet)
{
struct packet_dispatch *closure = (struct packet_dispatch *) *w;
unsigned start;
unsigned end;
unsigned msg;
if (!packet->length)
return 0;
msg = packet->data[0];
/* Do a binary serch. The number of valid message types should be
* rather small. */
start = 0;
end = closure->table_size;
while(1)
{
unsigned middle = (start + end) / 2;
unsigned middle_msg = closure->dispatch_table[middle].msg;
if (middle_msg == msg)
{
/* Found right method */
return A_WRITE(closure->dispatch_table[middle].f,
packet);
}
if (middle == start)
/* Not found */
break;
if (middle_msg < msg)
start = middle;
else
end = middle;
}
if (closure->other)
return A_WRITE(closure->other, packet);
else
return 0;
}
struct abstract_write *
make_dispatch_processor(unsigned size,
struct dispatch_assoc *table,
struct abstract_write *other)
{
struct packet_dispatch *closure
= xalloc(sizeof(struct packet_dispatch));
unsigned i;
/* Check that message numbers are increasing */
for(i = 0; i+1 < size; i++)
if (table[i].msg >= table[i+1].msg)
fatal("make_dispatch_processor: Table out of order");
closure->super.write = do_dispatch;
closure->other = other;
closure->table_size = size;
closure->dispatch_table = table;
return &closure->super;
}
/* packet_dispatch.h
*
* Pass packets on to one of several handlers.
*/
#ifndef LSH_PACKET_DISPATH_H_INCLUDED
#define LSH_PACKET_DISPATH_H_INCLUDED
#include "abstract_io.h"
#warning packet_dispatch.h is obsolete
struct dispatch_assoc
{
int msg;
struct abstract_write *f;
};
struct packet_dispatch
{
struct abstract_write super;
struct abstract_write *other;
unsigned table_size;
/* Should be sorted by message number */
struct dispatch_assoc *dispatch_table;
};
struct abstract_write *
make_packet_dispatch(unsigned size,
struct dispatch_assoc *table,
struct abstract_write *other);
#endif /* LSH_PACKET_DISPATH_H_INCLUDED */
......@@ -419,20 +419,6 @@ void init_diffie_hellman_instance(struct diffie_hellman_method *m,
c->literal_kexinits[CONNECTION_CLIENT] = NULL;
}
#if 0
struct diffie_hellman_instance *
make_diffie_hellman_instance(struct diffie_hellman_method *m,
struct ssh_connection *c)
{
struct diffie_hellman_instance *res
= xalloc(sizeof(struct diffie_hellman_instance));
init_diffie_hellman_instance(m, res, c);
return res;
}
#endif
struct diffie_hellman_method *make_dh1(struct randomness *r)
{
struct diffie_hellman_method *res
......
......@@ -66,21 +66,6 @@ struct dss_public
mpz_t y;
};
#if 0
struct signer *make_dss_signer(struct signature_algorithm *closure,
UINT32 public_length,
UINT8 *public,
UINT32 private_length,
UINT8 *private);
struct verifier *make_dss_verifier(struct signature_algorithm *closure,
UINT32 public_length,
UINT8 *public);
int parse_dss_public(struct simple_buffer *buffer, struct dss_public *public);
#endif
/* DH key exchange, with authentication */
struct diffie_hellman_method
{
......@@ -135,23 +120,10 @@ void dh_generate_secret(struct diffie_hellman_instance *self,
void dh_hash_digest(struct diffie_hellman_instance *self, UINT8 *digest);
#if 0
struct diffie_hellman_method *
make_diffie_hellman_method(struct group *group,
struct hash_algorithm *h,
struct randomness *r);
#endif
struct diffie_hellman_method *make_dh1(struct randomness *r);
void init_diffie_hellman_instance(struct diffie_hellman_method *m,
struct diffie_hellman_instance *self,
struct ssh_connection *c);
#if 0
struct diffie_hellman_instance *
make_diffie_hellman_instance(struct diffie_hellman_method *m,
struct ssh_connection *c);
#endif
#endif /* LSH_PUBLICKEY_CRYPTO_H_INCLUDED */
......@@ -28,14 +28,6 @@
#include "abstract_io.h"
#if 0
/* Input to the processor is a padded payload. */
struct packet_unpad
{
struct abstract_write_pipe super;
};
#endif
struct abstract_write *
make_packet_unpad(struct abstract_write *continuation);
......
/* void.c
*
*
*
* $Id$ */
/* lsh, an implementation of the ssh protocol
*
* Copyright (C) 1998 Niels Möller
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "void.h"
#include "xalloc.h"
#include "abstract_io.h"
static int do_ignore(struct abstract_write **w,
struct lsh_string *packet)
{
lsh_string_free(packet);
return 1;
}
struct abstract_write *make_packet_void()
{
struct abstract_write *closure = xalloc(sizeof(struct abstract_write));
closure->write = do_ignore;
return closure;
}
/* void.h
*
* A packet processor that destroys all packets.
*
* $Id$ */
/* lsh, an implementation of the ssh protocol
*
* Copyright (C) 1998 Niels Möller
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#warning void.h is obsolete
#ifndef LSH_VOID_H_INCLUDED
#define LSH_VOID_H_INCLUDED
#include "abstract_io.h"
struct abstract_write *make_packet_void();
#endif /* LSH_VOID_H_INCLUDED */
......@@ -61,14 +61,6 @@ struct write_buffer
UINT8 buffer[1]; /* Real size is twice the blocksize */
};
#if 0
struct write_callback
{
struct callback c;
struct write_buffer buffer;
};
#endif
struct write_buffer *write_buffer_alloc(UINT32 size);
int write_buffer_pre_write(struct write_buffer *buffer);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment