Commit ddef5f89 authored by Niels Möller's avatar Niels Möller

*** empty log message ***

Rev: src/bignum.c:1.8
Rev: src/bignum.h:1.8
Rev: src/blocking_write.c:1.4
Rev: src/client_keyexchange.c:1.8
Rev: src/connection.c:1.10
Rev: src/debug.c:1.9
Rev: src/disconnect.h:1.2
Rev: src/encrypt.c:1.11
Rev: src/lsh.c:1.10
Rev: src/lshd.c:1.10
Rev: src/packet_ignore.c:1.3
Rev: src/packet_ignore.h:1.3
Rev: src/parse.h:1.11
Rev: src/randomness.c:1.5
Rev: src/read_packet.c:1.14
Rev: src/read_packet.h:1.8
Rev: src/server.c:1.10
Rev: src/unpad.c:1.11
Rev: src/zlib.c:1.7
parent db36a82d
......@@ -80,7 +80,7 @@ void bignum_parse_s(mpz_t n, UINT32 length, UINT8 *data)
mpz_clear(digit);
}
int mpz_size_of_complement(mpz_t n)
static int mpz_size_of_complement(mpz_t n)
{
int bits;
......
......@@ -26,6 +26,9 @@
#ifndef LSH_BIGNUM_H_INCLUDED
#define LSH_BIGNUM_H_INCLUDED
/* Needed for the declaration of mpz_out_str */
#include <stdio.h>
#include <gmp.h>
#include "lsh_types.h"
......
......@@ -15,6 +15,7 @@ static int do_write(struct abstract_write **w,
UINT32 left = packet->length;
UINT8 *p = packet->data;
MDEBUG(closure);
while(left)
{
int written = write(closure->fd, p, left);
......
......@@ -41,6 +41,8 @@ static int do_handle_dh_reply(struct packet_handler *c,
struct lsh_string *s;
int res;
MDEBUG(closure);
verbose("handle_dh_reply()\n");
if (!dh_process_server_msg(&closure->dh, packet))
......@@ -60,7 +62,7 @@ static int do_handle_dh_reply(struct packet_handler *c,
if (!dh_verify_server_msg(&closure->dh, v))
/* FIXME: Same here */
return disconnect_kex_failed(connection, "Bad server host key\r\n");
return disconnect_kex_failed(connection, "Invalid server signature\r\n");
/* Key exchange successful! Send a newkeys message, and install a
* handler for recieving the newkeys message. */
......@@ -94,15 +96,19 @@ static int do_handle_dh_reply(struct packet_handler *c,
}
static int do_init_dh(struct keyexchange_algorithm *c,
struct ssh_connection *connection,
int hostkey_algorithm_atom,
struct signature_algorithm *ignored,
void **algorithms)
struct ssh_connection *connection,
int hostkey_algorithm_atom,
struct signature_algorithm *ignored,
void **algorithms)
{
struct dh_client_exchange *closure = (struct dh_client_exchange *) c;
struct dh_client *dh = xalloc(sizeof(struct dh_client));
int res;
MDEBUG(c);
MDEBUG(connection);
MDEBUG(ignored);
/* FIXME: Use this value to choose a verifier function */
if (hostkey_algorithm_atom != ATOM_SSH_DSS)
......@@ -142,6 +148,8 @@ make_dh_client(struct diffie_hellman_method *dh,
{
struct dh_client_exchange *self = xalloc(sizeof(struct dh_client_exchange));
MDEBUG(dh);
self->super.init = do_init_dh;
self->dh = dh;
self->verifier = verifier;
......@@ -164,7 +172,9 @@ static int do_install(struct install_keys *c,
/* FIXME: No IV:s */
struct client_install_keys *closure = (struct client_install_keys *) c;
MDEBUG(closure);
/* Keys for recieving */
connection->dispatch[SSH_MSG_NEWKEYS] = make_newkeys_handler
(kex_make_encrypt(secret, closure->algorithms,
......
......@@ -61,7 +61,8 @@ static int handle_connection(struct abstract_write **w,
}
break;
case KEX_STATE_NEWKEYS:
if (msg != SSH_MSG_NEWKEYS)
if ( (msg != SSH_MSG_NEWKEYS)
&& (msg != SSH_MSG_DISCONNECT) )
{
werror("Expected NEWKEYS message, but recieved message %d!\n",
msg);
......@@ -80,11 +81,13 @@ static int do_fail(struct packet_handler *closure,
struct ssh_connection *connection,
struct lsh_string *packet)
{
MDEBUG(closure);
lsh_string_free(packet);
return WRITE_CLOSED;
}
struct packet_handler *make_fail_handler()
struct packet_handler *make_fail_handler(void)
{
struct packet_handler *res = xalloc(sizeof(struct packet_handler));
......@@ -96,10 +99,14 @@ static int do_unimplemented(struct packet_handler *closure,
struct ssh_connection *connection,
struct lsh_string *packet)
{
int res = A_WRITE(connection->write,
ssh_format("%c%i",
SSH_MSG_UNIMPLEMENTED,
packet->sequence_number));
int res;
MDEBUG(closure);
res = A_WRITE(connection->write,
ssh_format("%c%i",
SSH_MSG_UNIMPLEMENTED,
packet->sequence_number));
verbose("Recieved packet of unimplemented type %d.\n",
packet->data[0]);
......@@ -107,7 +114,7 @@ static int do_unimplemented(struct packet_handler *closure,
return res;
}
struct packet_handler *make_unimplemented_handler()
struct packet_handler *make_unimplemented_handler(void)
{
struct packet_handler *res = xalloc(sizeof(struct packet_handler));
......
......@@ -33,6 +33,8 @@ static int do_debug(struct abstract_write **w,
= (struct packet_debug *) *w;
UINT32 i;
MDEBUG(closure);
fprintf(closure->output, "DEBUG: (packet size %d = 0x%x)\n",
packet->length, packet->length);
......
......@@ -27,6 +27,6 @@
#include "lsh_types.h"
struct lsh_string *format_disconnect(int code, char *msg);
struct packet_handler *make_disconnect_handler();
struct packet_handler *make_disconnect_handler(void);
#endif /* LSH_DISCONNECT_H_INCLUDED */
......@@ -36,6 +36,8 @@ static int do_encrypt(struct abstract_write **w,
struct lsh_string *new;
UINT8 *mac;
MDEBUG(closure);
new = ssh_format("%lr%lr", packet->length, NULL,
connection->send_mac ? connection->send_mac->mac_size : 0,
&mac);
......
......@@ -46,9 +46,9 @@
/* Global variable */
struct io_backend backend;
void usage() NORETURN;
void usage(void) NORETURN;
void usage()
void usage(void)
{
exit(1);
}
......@@ -61,9 +61,11 @@ struct fake_host_db
};
static struct verifier *do_host_lookup(struct lookup_verifier *c,
struct lsh_string *key)
struct lsh_string *key)
{
struct fake_host_db *closure = (struct fake_host_db *) c;
MDEBUG(closure);
return MAKE_VERIFIER(closure->algorithm, key->length, key->data);
}
......
......@@ -46,9 +46,9 @@
/* Global variable */
struct io_backend backend;
void usage() NORETURN;
void usage(void) NORETURN;
void usage()
void usage(void)
{
exit(1);
}
......@@ -103,6 +103,9 @@ static void init_host_key(struct randomness *r)
public_key->length, public_key->data,
s->length, s->data);
if (!secret_key)
fatal("Can't parse secret key\n");
lsh_free(s);
mpz_clear(p);
mpz_clear(q);
......
......@@ -35,9 +35,7 @@ static int do_ignore(struct packet_handler *closure,
return WRITE_OK;
}
struct packet_handler *make_ignore_handler(struct packet_handler *closure,
struct ssh_connection *connection,
struct lsh_string *packet)
struct packet_handler *make_ignore_handler(void)
{
struct packet_handler *res = xalloc(sizeof(struct packet_handler));
......
......@@ -28,7 +28,7 @@
#include "connection.h"
struct packet_handler *make_ignore_handler();
struct packet_handler *make_ignore_handler(void);
#endif /* LSH_PACKET_IGNORE_H_INCLUDED */
......@@ -29,7 +29,11 @@
#include "atoms.h"
#include "bignum.h"
/* Simple buffer */
/* Simple buffer
* NOTE: All instances are allocated on the stack.
* No object header is needed. */
struct simple_buffer
{
UINT32 capacity;
......
......@@ -43,6 +43,8 @@ static void do_poor_random(struct randomness **r, UINT32 length, UINT8 *dst)
{
struct poor_random *self = (struct poor_random *) *r;
MDEBUG(self);
while(length)
{
UINT32 available = self->hash->hash_size - self->pos;
......
......@@ -39,11 +39,13 @@
#define WAIT_CONTENTS 1
#define WAIT_MAC 2
int do_read_packet(struct read_handler **h,
struct abstract_read *read)
static int do_read_packet(struct read_handler **h,
struct abstract_read *read)
{
struct read_packet *closure = (struct read_packet *) *h;
MDEBUG(closure);
#if 0
while(1)
{
......
......@@ -39,6 +39,8 @@ struct read_packet
/* 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;
......
......@@ -85,6 +85,8 @@ static struct read_handler *do_line(struct line_handler **h,
{
struct server_line_handler *closure = (struct server_line_handler *) *h;
MDEBUG(closure);
if ( (length >= 4) && !memcmp(line, "SSH-", 4))
{
/* Parse and remember format string */
......
......@@ -36,6 +36,8 @@ static int do_unpad(struct abstract_write **w,
UINT32 payload_length;
struct lsh_string *new;
MDEBUG(closure);
if (packet->length < 1)
return 0;
......
......@@ -32,6 +32,8 @@ static int do_deflate(struct abstract_write **c,
struct lsh_string *new;
MDEBUG(closure);
/* call deflate, copy into new packet */
new = lsh_string_alloc(...);
......
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