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

Bug fix: Pass server_key to the dh object.

Rev: src/server_keyexchange.c:1.3
Rev: src/server_keyexchange.h:1.2
parent a9aefe4f
...@@ -40,6 +40,8 @@ static int do_handle_dh_init(struct packet_handler *c, ...@@ -40,6 +40,8 @@ static int do_handle_dh_init(struct packet_handler *c,
struct lsh_string *s; struct lsh_string *s;
int res; int res;
verbose("handle_dh_init()\n");
if (!dh_process_client_msg(&closure->dh, packet)) if (!dh_process_client_msg(&closure->dh, packet))
{ {
disconnect_kex_failed(connection, "Bad dh-init\r\n"); disconnect_kex_failed(connection, "Bad dh-init\r\n");
...@@ -117,6 +119,7 @@ static int do_init_dh(struct keyexchange_algorithm *c, ...@@ -117,6 +119,7 @@ static int do_init_dh(struct keyexchange_algorithm *c,
dh->super.handler = do_handle_dh_init; dh->super.handler = do_handle_dh_init;
init_diffie_hellman_instance(closure->dh, &dh->dh, connection); init_diffie_hellman_instance(closure->dh, &dh->dh, connection);
dh->server_key = closure->server_key;
dh->signer = closure->signer; dh->signer = closure->signer;
dh->install = make_server_install_keys(algorithms); dh->install = make_server_install_keys(algorithms);
...@@ -143,12 +146,14 @@ static int do_init_dh(struct keyexchange_algorithm *c, ...@@ -143,12 +146,14 @@ static int do_init_dh(struct keyexchange_algorithm *c,
struct keyexchange_algorithm * struct keyexchange_algorithm *
make_dh_server(struct diffie_hellman_method *dh, make_dh_server(struct diffie_hellman_method *dh,
struct lsh_string *server_key,
struct signer *signer) struct signer *signer)
{ {
struct dh_server_exchange *self = xalloc(sizeof(struct dh_server_exchange)); struct dh_server_exchange *self = xalloc(sizeof(struct dh_server_exchange));
self->super.init = do_init_dh; self->super.init = do_init_dh;
self->dh = dh; self->dh = dh;
self->server_key = server_key;
self->signer = signer; self->signer = signer;
return &self->super; return &self->super;
......
...@@ -33,6 +33,7 @@ struct dh_server_exchange ...@@ -33,6 +33,7 @@ struct dh_server_exchange
{ {
struct keyexchange_algorithm super; struct keyexchange_algorithm super;
struct diffie_hellman_method *dh; struct diffie_hellman_method *dh;
struct lsh_string *server_key;
struct signer *signer; struct signer *signer;
}; };
...@@ -41,9 +42,15 @@ struct dh_server ...@@ -41,9 +42,15 @@ struct dh_server
{ {
struct packet_handler super; struct packet_handler super;
struct diffie_hellman_instance dh; struct diffie_hellman_instance dh;
struct lsh_string *server_key;
struct signer *signer; struct signer *signer;
struct install_keys *install; struct install_keys *install;
struct packet_handler *saved_kexinit_handler; struct packet_handler *saved_kexinit_handler;
}; };
struct keyexchange_algorithm *
make_dh_server(struct diffie_hellman_method *dh,
struct lsh_string *server_key,
struct signer *signer);
#endif /* LSH_SERVER_KEYEXCHANGE_H_INCLUDED */ #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