Commit 84b193a6 authored by Niels Möller's avatar Niels Möller

* src/keyexchange.c (class kexinit_info): Renamed from

simple_kexinit. Don't inherit make_kexinit.
(make_kexinit_info): Renamed from make_simple_kexinit.
(make_kexinit): New function, replacing the make method of
the make_kexinit class.

* src/keyexchange.h (class make_kexinit): Deleted abstract class.

Rev: src/keyexchange.c:1.102
Rev: src/keyexchange.h:1.63
parent a6e80531
......@@ -286,8 +286,7 @@ handle_kexinit(struct kexinit_state *self,
/* Uses the same algorithms for both directions */
/* GABA:
(class
(name simple_kexinit)
(super make_kexinit)
(name kexinit_info)
(vars
(kex_algorithms object int_list)
(hostkey_algorithms object int_list)
......@@ -297,28 +296,47 @@ handle_kexinit(struct kexinit_state *self,
(languages object int_list)))
*/
static struct kexinit *
do_make_simple_kexinit(struct make_kexinit *c)
struct kexinit_info *
make_kexinit_info(struct int_list *kex_algorithms,
struct int_list *hostkey_algorithms,
struct int_list *crypto_algorithms,
struct int_list *mac_algorithms,
struct int_list *compression_algorithms,
struct int_list *languages)
{
NEW(kexinit_info, self);
self->kex_algorithms = kex_algorithms;
self->hostkey_algorithms = hostkey_algorithms;
self->crypto_algorithms = crypto_algorithms;
self->mac_algorithms = mac_algorithms;
self->compression_algorithms = compression_algorithms;
self->languages = languages;
return self;
}
struct kexinit *
make_kexinit(struct kexinit_info *self)
{
CAST(simple_kexinit, closure, c);
NEW(kexinit, kex);
random_generate(sizeof(kex->cookie), kex->cookie);
kex->kex_algorithms = closure->kex_algorithms;
kex->server_hostkey_algorithms = closure->hostkey_algorithms;
kex->kex_algorithms = self->kex_algorithms;
kex->server_hostkey_algorithms = self->hostkey_algorithms;
kex->parameters[KEX_ENCRYPTION_CLIENT_TO_SERVER]
= closure->crypto_algorithms;
= self->crypto_algorithms;
kex->parameters[KEX_ENCRYPTION_SERVER_TO_CLIENT]
= closure->crypto_algorithms;
kex->parameters[KEX_MAC_CLIENT_TO_SERVER] = closure->mac_algorithms;
kex->parameters[KEX_MAC_SERVER_TO_CLIENT] = closure->mac_algorithms;
= self->crypto_algorithms;
kex->parameters[KEX_MAC_CLIENT_TO_SERVER] = self->mac_algorithms;
kex->parameters[KEX_MAC_SERVER_TO_CLIENT] = self->mac_algorithms;
kex->parameters[KEX_COMPRESSION_CLIENT_TO_SERVER]
= closure->compression_algorithms;
= self->compression_algorithms;
kex->parameters[KEX_COMPRESSION_SERVER_TO_CLIENT]
= closure->compression_algorithms;
kex->languages_client_to_server = closure->languages;
kex->languages_server_to_client = closure->languages;
= self->compression_algorithms;
kex->languages_client_to_server = self->languages;
kex->languages_server_to_client = self->languages;
kex->first_kex_packet_follows = 0;
kex->first_kex_packet = NULL;
......@@ -326,28 +344,6 @@ do_make_simple_kexinit(struct make_kexinit *c)
return kex;
}
struct make_kexinit *
make_simple_kexinit(struct int_list *kex_algorithms,
struct int_list *hostkey_algorithms,
struct int_list *crypto_algorithms,
struct int_list *mac_algorithms,
struct int_list *compression_algorithms,
struct int_list *languages)
{
NEW(simple_kexinit, self);
self->super.make = do_make_simple_kexinit;
self->kex_algorithms = kex_algorithms;
self->hostkey_algorithms = hostkey_algorithms;
self->crypto_algorithms = crypto_algorithms;
self->mac_algorithms = mac_algorithms;
self->compression_algorithms = compression_algorithms;
self->languages = languages;
return &self->super;
}
/* Taking keys into use */
/* Returns a hash instance for generating various session keys. Consumes K. */
static struct hash_instance *
......
......@@ -134,27 +134,21 @@ handle_kexinit(struct kexinit_state *self,
; May be NULL. Used only for sending.
(first_kex_packet string)))
*/
/* This function generates a new kexinit message.
*
* If a speculative packet follows, it is stored in the last field. */
/* FIXME: We don't need this abstract class, merge with simple_kexinit
and a plain function for generating kexinits. */
/* GABA:
(class
(name make_kexinit)
(vars
(make method (object kexinit))))
*/
struct kexinit_info;
struct kexinit_info *
make_kexinit_info(struct int_list *kex_algorithms,
struct int_list *hostkey_algorithms,
struct int_list *crypto_algorithms,
struct int_list *mac_algorithms,
struct int_list *compression_algorithms,
struct int_list *languages);
struct make_kexinit *
make_simple_kexinit(struct int_list *kex_algorithms,
struct int_list *hostkey_algorithms,
struct int_list *crypto_algorithms,
struct int_list *mac_algorithms,
struct int_list *compression_algorithms,
struct int_list *languages);
/* This function generates a new kexinit message. If a speculative
* packet follows, it is stored in the last field. */
struct kexinit *
make_kexinit(struct kexinit_info *self);
struct keyexchange_algorithm *
make_server_dh_exchange(const struct dh_params *params,
......
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