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

* src/client_keyexchange.c (do_client): Removed finished

attribute.
(do_handle_dh_reply): Pass connection to the
connection->established continuation (if non-NULL).

* src/server_keyexchange.c (dh_server): Removed finished
attribute.
(do_handle_dh_init): Pass connection to the
connection->established continuation (if non-NULL).

Rev: src/client_keyexchange.c:1.27
Rev: src/server_keyexchange.c:1.26
parent 6026064d
......@@ -24,6 +24,7 @@
#include "client_keyexchange.h"
#include "atoms.h"
#include "command.h"
#include "debug.h"
#include "format.h"
#include "ssh.h"
......@@ -54,7 +55,6 @@
(dh struct diffie_hellman_instance)
(verifier object lookup_verifier)
(install object install_keys)))
;;; (finished object ssh_service)))
*/
static int do_handle_dh_reply(struct packet_handler *c,
......@@ -65,8 +65,9 @@ static int do_handle_dh_reply(struct packet_handler *c,
struct verifier *v;
struct hash_instance *hash;
struct lsh_string *s;
struct command_continuation *continuation;
int res;
verbose("handle_dh_reply()\n");
if (!dh_process_server_msg(&closure->dh, packet))
......@@ -126,7 +127,10 @@ static int do_handle_dh_reply(struct packet_handler *c,
if (LSH_CLOSEDP(res) || !connection->established)
return res;
return res | COMMAND_RETURN(connection->established, connection);
continuation = connection->established;
connection->established = NULL;
return res | COMMAND_RETURN(continuation, connection);
}
static int do_init_client_dh(struct keyexchange_algorithm *c,
......
......@@ -24,6 +24,7 @@
#include "server_keyexchange.h"
#include "atoms.h"
#include "command.h"
#include "debug.h"
#include "format.h"
#include "ssh.h"
......@@ -52,8 +53,7 @@
(dh struct diffie_hellman_instance)
;; (server_key string)
(signer object signer)
(install object install_keys)
(finished object ssh_service)))
(install object install_keys)))
*/
static int do_handle_dh_init(struct packet_handler *c,
......@@ -63,6 +63,7 @@ static int do_handle_dh_init(struct packet_handler *c,
CAST(dh_server, closure, c);
struct hash_instance *hash;
struct lsh_string *s;
struct command_continuation *continuation;
int res;
verbose("handle_dh_init()\n");
......@@ -115,15 +116,17 @@ static int do_handle_dh_init(struct packet_handler *c,
connection->dispatch[SSH_MSG_KEXDH_INIT] = connection->fail;
res |= send_verbose(connection->write, "Key exchange successful!", 0);
if (LSH_CLOSEDP(res))
if (LSH_CLOSEDP(res) || !connection->established)
return res;
continuation = connection->established;
connection->established = NULL;
return res | SERVICE_INIT(closure->finished, connection);
return res | COMMAND_RETURN(continuation, connection);
}
static int do_init_server_dh(struct keyexchange_algorithm *c,
struct ssh_connection *connection,
struct ssh_service *finished,
int hostkey_algorithm_atom,
struct signature_algorithm *ignored,
struct object_list *algorithms)
......@@ -134,10 +137,8 @@ static int do_init_server_dh(struct keyexchange_algorithm *c,
NEW(dh_server, dh);
CHECK_TYPE(ssh_connection, connection);
CHECK_SUBTYPE(ssh_service, finished);
CHECK_SUBTYPE(signature_algorithm, ignored);
if (!keypair)
{
werror("Keypair for for selected signature-algorithm not found!\n");
......@@ -151,7 +152,6 @@ static int do_init_server_dh(struct keyexchange_algorithm *c,
dh->dh.server_key = lsh_string_dup(keypair->public);
dh->signer = keypair->private;
dh->install = make_install_new_keys(1, algorithms);
dh->finished = finished;
/* Generate server's secret exponent */
dh_make_server_secret(&dh->dh);
......
Supports Markdown
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