Commit 7233fda2 authored by Niels Möller's avatar Niels Möller
Browse files

Moved instance structures into the corresponding implementation files.

Rev: src/client_keyexchange.c:1.9
Rev: src/client_keyexchange.h:1.7
Rev: src/debug.c:1.10
Rev: src/debug.h:1.7
Rev: src/encrypt.c:1.12
Rev: src/encrypt.h:1.9
Rev: src/keyexchange.c:1.14
Rev: src/keyexchange.h:1.16
Rev: src/pad.c:1.15
Rev: src/pad.h:1.10
Rev: src/read_line.c:1.8
Rev: src/read_line.h:1.8
Rev: src/read_packet.c:1.15
Rev: src/read_packet.h:1.9
Rev: src/server.c:1.11
Rev: src/server.h:1.6
Rev: src/server_keyexchange.c:1.6
Rev: src/server_keyexchange.h:1.5
parent 15b449ff
......@@ -29,7 +29,21 @@
#include "werror.h"
#include "xalloc.h"
struct install_keys *make_client_install_keys(void **algorithms);
struct dh_client_exchange
{
struct keyexchange_algorithm super;
struct diffie_hellman_method *dh;
struct lookup_verifier *verifier;
};
/* Handler for the kex_dh_reply message */
struct dh_client
{
struct packet_handler super;
struct diffie_hellman_instance dh;
struct lookup_verifier *verifier;
struct install_keys *install;
};
static int do_handle_dh_reply(struct packet_handler *c,
struct ssh_connection *connection,
......
......@@ -43,24 +43,10 @@ struct lookup_verifier
#define LOOKUP_VERIFIER(l, key) ((l)->lookup((l), (key)))
struct dh_client_exchange
{
struct keyexchange_algorithm super;
struct diffie_hellman_method *dh;
struct lookup_verifier *verifier;
};
/* Handler for the kex_dh_reply message */
struct dh_client
{
struct packet_handler super;
struct diffie_hellman_instance dh;
struct lookup_verifier *verifier;
struct install_keys *install;
};
struct keyexchange_algorithm *
make_dh_client(struct diffie_hellman_method *dh,
struct lookup_verifier *verifier);
struct install_keys *make_client_install_keys(void **algorithms);
#endif /* LSH_CLIENT_KEYEXCHANGE_H_INCLUDED */
......@@ -26,6 +26,12 @@
#include "debug.h"
#include "xalloc.h"
struct packet_debug
{
struct abstract_write_pipe super;
FILE *output;
};
static int do_debug(struct abstract_write **w,
struct lsh_string *packet)
{
......
......@@ -29,12 +29,6 @@
#include <stdio.h>
#include "abstract_io.h"
struct packet_debug
{
struct abstract_write_pipe super;
FILE *output;
};
struct abstract_write *
make_packet_debug(struct abstract_write *continuation, FILE *output);
......
......@@ -28,6 +28,14 @@
#include "format.h"
#include "xalloc.h"
struct packet_encrypt
{
struct abstract_write_pipe super;
UINT32 sequence_number;
struct ssh_connection *connection;
};
static int do_encrypt(struct abstract_write **w,
struct lsh_string *packet)
{
......
......@@ -30,14 +30,6 @@
#include "abstract_crypto.h"
#include "connection.h"
struct packet_encrypt
{
struct abstract_write_pipe super;
UINT32 sequence_number;
struct ssh_connection *connection;
};
struct abstract_write *
make_packet_encrypt(struct abstract_write *continuation,
struct ssh_connection *connection);
......
......@@ -36,6 +36,22 @@
#include "werror.h"
#include "xalloc.h"
struct handle_kexinit
{
struct packet_handler super;
int type;
struct make_kexinit *init;
/* Maps names to algorithms. It's dangerous to lookup random atoms
* in this table, as not all objects have the same type. This
* mapping is used only on atoms that have appeared in *both* the
* client's and the server's list of algorithms (of a certain type),
* and therefore the remote side can't screw things up. */
struct alist *algorithms;
};
#define NLISTS 10
static struct kexinit *parse_kexinit(struct lsh_string *packet)
......
......@@ -96,22 +96,6 @@ struct make_kexinit
#define MAKE_KEXINIT(m) ((m)->make((m)))
struct handle_kexinit
{
struct packet_handler super;
int type;
struct make_kexinit *init;
/* Maps names to algorithms. It's dangerous to lookup random atoms
* in this table, as not all objects have the same type. This
* mapping is used only on atoms that have appeared in *both* the
* client's and the server's list of algorithms (of a certain type),
* and therefore the remote side can't screw things up. */
struct alist *algorithms;
};
/* Installs keys for use. */
struct install_keys
{
......
......@@ -27,11 +27,18 @@
#include "pad.h"
#include "connection.h"
#include "format.h"
#include "randomness.h"
#include "xalloc.h"
struct packet_pad
{
struct abstract_write_pipe super;
struct ssh_connection *connection;
struct randomness *random;
};
static int do_pad(struct abstract_write **w,
struct lsh_string *packet)
{
......
......@@ -26,20 +26,14 @@
#ifndef LSH_PAD_H_INCLUDED
#define LSH_PAD_H_INCLUDED
#include "abstract_io.h"
#include "abstract_crypto.h"
#include "abstract_io.h"
#include "connection.h"
#include "randomness.h"
/* Input to the processor is a packet with the payload. Output is a
* packet containing a formatted ssh packet (with correct byte order,
* etc). */
struct packet_pad
{
struct abstract_write_pipe super;
struct ssh_connection *connection;
struct randomness *random;
};
struct abstract_write *make_packet_pad(struct abstract_write *continuation,
struct ssh_connection *connection,
......
......@@ -29,6 +29,15 @@
#include "werror.h"
#include "xalloc.h"
struct read_line
{
struct read_handler super; /* Super type */
struct line_handler *handler;
UINT32 pos; /* Line buffer */
UINT8 buffer[MAX_LINE];
};
struct string_read
{
struct abstract_read super;
......
......@@ -44,15 +44,6 @@ struct line_handler
#define PROCESS_LINE(h, length, line) \
((h)->handler(&(h), (length), (line)))
struct read_line
{
struct read_handler super; /* Super type */
struct line_handler *handler;
UINT32 pos; /* Line buffer */
UINT8 buffer[MAX_LINE];
};
struct read_handler *make_read_line(struct line_handler *handler);
#endif /* LSH_READ_HANDLER_H_INCLUDED */
......@@ -28,7 +28,6 @@
#include "read_packet.h"
#include "connection.h"
#include "crypto.h"
#include "format.h"
#include "io.h"
......@@ -39,6 +38,28 @@
#define WAIT_CONTENTS 1
#define WAIT_MAC 2
struct read_packet
{
struct read_handler super; /* Super type */
int state;
UINT32 sequence_number; /* Attached to read packets */
/* Buffer partial headers and packets. */
UINT32 pos;
/* FIXME: This buffer should hold one block, and must be reallocated
* when the crypto algorithms is changed. */
struct lsh_string *buffer;
UINT32 crypt_pos;
UINT8 *computed_mac; /* Must point to an area large enough to hold a mac */
struct abstract_write *handler;
struct ssh_connection *connection;
};
static int do_read_packet(struct read_handler **h,
struct abstract_read *read)
{
......
......@@ -28,27 +28,7 @@
#include "abstract_io.h"
#include "abstract_crypto.h"
struct read_packet
{
struct read_handler super; /* Super type */
int state;
UINT32 sequence_number; /* Attached to read packets */
/* Buffer partial headers and packets. */
UINT32 pos;
/* FIXME: This buffer should hold one block, and must be reallocated
* when the crypto algorithms is changed. */
struct lsh_string *buffer;
UINT32 crypt_pos;
UINT8 *computed_mac; /* Must point to an area large enough to hold a mac */
struct abstract_write *handler;
struct ssh_connection *connection;
};
#include "connection.h"
struct read_handler *make_read_packet(struct abstract_write *handler,
struct ssh_connection *connection);
......
......@@ -37,6 +37,21 @@
#include "werror.h"
#include "xalloc.h"
struct server_callback
{
struct fd_callback super;
struct io_backend *backend;
struct signer *secret; /* secret key */
struct lsh_string *host_key; /* public key */
UINT32 block_size;
char *id_comment;
struct randomness *random;
struct make_kexinit *init;
struct packet_handler *kexinit_handler;
};
static int server_initiate(struct fd_callback **c,
int fd)
{
......
......@@ -31,21 +31,6 @@
#include "io.h"
#include "keyexchange.h"
struct server_callback
{
struct fd_callback super;
struct io_backend *backend;
struct signer *secret; /* secret key */
struct lsh_string *host_key; /* public key */
UINT32 block_size;
char *id_comment;
struct randomness *random;
struct make_kexinit *init;
struct packet_handler *kexinit_handler;
};
struct fd_callback *
make_server_callback(struct io_backend *b,
char *comment,
......
......@@ -29,7 +29,23 @@
#include "werror.h"
#include "xalloc.h"
struct install_keys *make_server_install_keys(void **algorithms);
struct dh_server_exchange
{
struct keyexchange_algorithm super;
struct diffie_hellman_method *dh;
struct lsh_string *server_key;
struct signer *signer;
};
/* Handler for the kex_dh_reply message */
struct dh_server
{
struct packet_handler super;
struct diffie_hellman_instance dh;
/* struct lsh_string *server_key; */
struct signer *signer;
struct install_keys *install;
};
static int do_handle_dh_init(struct packet_handler *c,
struct ssh_connection *connection,
......
......@@ -29,27 +29,11 @@
#include "keyexchange.h"
#include "publickey_crypto.h"
struct dh_server_exchange
{
struct keyexchange_algorithm super;
struct diffie_hellman_method *dh;
struct lsh_string *server_key;
struct signer *signer;
};
/* Handler for the kex_dh_reply message */
struct dh_server
{
struct packet_handler super;
struct diffie_hellman_instance dh;
/* struct lsh_string *server_key; */
struct signer *signer;
struct install_keys *install;
};
struct keyexchange_algorithm *
make_dh_server(struct diffie_hellman_method *dh,
struct lsh_string *server_key,
struct signer *signer);
struct install_keys *make_server_install_keys(void **algorithms);
#endif /* LSH_SERVER_KEYEXCHANGE_H_INCLUDED */
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