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

*** empty log message ***

Rev: src/Makefile.in:1.11
Rev: src/connection.h:1.13
Rev: src/keyexchange.h:1.11
Rev: src/publickey_crypto.h:1.7
parent d792a976
......@@ -34,15 +34,16 @@ binprefix =
LOADLIBES = $(LIBS) lib/algorithms.a
COMMON_SRCS = atoms.c bignum.c connection.c crypto.c \
debug.c encrypt.c format.c getopt.c io.c keyexchange.c \
packet_disconnect.c packet_ignore.c pad.c parse.c publickey_crypto.c \
debug.c disconnect.c encrypt.c format.c getopt.c io.c keyexchange.c \
packet_ignore.c pad.c parse.c publickey_crypto.c \
randomness.c \
read_data.c read_line.c read_packet.c \
server_keyexchange.c unpad.c \
unpad.c \
werror.c write_buffer.c xalloc.c
CLIENT_SRCS = lsh.c client.c
SERVER_SRCS = lshd.c server.c
CLIENT_SRCS = lsh.c client.c client_keyexchange.c
SERVER_SRCS = lshd.c server.c server_keyexchange.c
SRCS = $(COMMON_SRCS) $(CLIENT_SRCS) $(SERVER_SRCS)
COMMON_OBJS = $(COMMON_SRCS:.c=.o)
......
......@@ -5,8 +5,8 @@
#ifndef LSH_CONNECTION_H_INCLUDED
#define LSH_CONNECTION_H_INCLUDED
#include "lsh_types.h"
#include "abstract_io.h"
#include "randomness.h"
/* Forward declaration */
struct ssh_connection;
......@@ -29,9 +29,9 @@ struct packet_handler
struct ssh_connection
{
#if 0
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
......@@ -57,6 +57,9 @@ struct ssh_connection
struct abstract_write *write; /* Where to send packets through the
* pipeline */
struct mac_instance *send_mac;
struct crypto_instance *send_crypto;
/* Table of all known message types */
struct packet_handler *dispatch[0x100];
......@@ -81,6 +84,9 @@ struct ssh_connection
};
struct ssh_connection *make_ssh_connection(struct packet_handler *kex_handler);
void connection_init_io(struct ssh_connection *connection,
struct abstract_write *raw,
struct randomness *r);
#if 0
struct abstract_write *make_unimplemented(struct connection *c);
......
......@@ -26,9 +26,10 @@
#ifndef LSH_KEYEXCHANGE_H_INCLUDED
#define LSH_KEYEXCHANGE_H_INCLUDED
#include "lsh_types.h"
#include "abstract_crypto.h"
#include "abstract_io.h"
#include "alist.h"
#include "connection.h"
#define KEX_ENCRYPTION_CLIENT_TO_SERVER 0
#define KEX_ENCRYPTION_SERVER_TO_CLIENT 1
......@@ -39,23 +40,25 @@
#define KEX_PARAMETERS 6
/* algorithms is an array indexed by the KEX_* values above */
struct keyexchange_algorithm
{
int (*init)(struct keyexchange_algorithm *closure,
struct ssh_connection *connection,
int hostkey_algorithm_atom,
struct signature_algorithm *hostkey_algorithm,
void **algorithms);
};
#define KEYEXCHANGE_INIT(kex, connection, ) \
((kex)->init((kex), (connection)))
#define KEYEXCHANGE_INIT(kex, connection, ha, h, a) \
((kex)->init((kex), (connection), (ha), (h), (a)))
struct kexinit
{
UINT8 cookie[16];
/* Zero terminated list of atoms */
int *kex_algorithms;
int *server_host_key_algorithms;
int *server_hostkey_algorithms;
int *parameters[KEX_PARAMETERS];
int *languages_client_to_server;
int *languages_server_to_client;
......@@ -68,17 +71,17 @@ struct kexinit
* the message, record it in the connection structure, and possibly
* send a first guessed message. */
struct generate_kexinit
struct make_kexinit
{
struct kexinit * (*generate)(struct generate_kexinit *closure);
struct kexinit * (*make)(struct make_kexinit *closure);
};
#define GENERATE_KEXINIT(g) ((g)->generate((g)))
#define MAKE_KEXINIT(m) ((m)->make((m)))
struct handle_keyexinit
struct handle_kexinit
{
struct packet_handler super;
struct choose_kexinit *init;
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
......@@ -89,6 +92,16 @@ struct handle_keyexinit
struct alist *algorithms;
};
/* Installs keys for use. */
struct install_keys
{
int (*install)(struct install_keys *closure,
struct ssh_connection *connection,
struct hash_instance *secret);
};
#define INSTALL_KEYS(i, c, s) ((i)->install((i), (c), (s)))
struct newkeys_info
{
struct crypto_algorithm *encryption_client_to_server;
......@@ -106,5 +119,22 @@ struct packet_handler *make_kexinit_handler();
struct packet_handler *make_newkeys_handler();
struct lsh_string *format_kex(struct kexinit *kex);
int disconnect_kex_failed(struct ssh_connection *connection, char *msg);
struct crypto_instance *kex_make_encrypt(struct hash_instance *secret,
void **algorithms,
int type,
struct ssh_connection *connection);
struct crypto_instance *kex_make_decrypt(struct hash_instance *secret,
void **algorithms,
int type,
struct ssh_connection *connection);
struct mac_instance *kex_make_mac(struct hash_instance *secret,
void **algorithms,
int type,
struct ssh_connection *connection);
#endif /* LSH_KEYEXCHANGE_H_INCLUDED */
......@@ -27,6 +27,7 @@
#define LSH_PUBLICKEY_CRYPTO_H_INCLUDED
#include "abstract_crypto.h"
#include "bignum.h"
#include "connection.h"
struct signature_algorithm *make_dss_algorithm(struct randomness *random);
......@@ -69,7 +70,7 @@ struct diffie_hellman_instance
struct lsh_string *server_key;
struct lsh_string *signature;
mpz_t secret; /* This side's secret exponent */
mpz_t lsh_string *K;
mpz_t K;
struct hash_instance *hash;
struct lsh_string *exchange_hash;
};
......@@ -106,6 +107,10 @@ make_diffie_hellman_method(struct group *group,
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);
struct diffie_hellman_instance *
make_diffie_hellman_instance(struct diffie_hellman_method *m,
struct ssh_connection *c);
......
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