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

(dh_hash_update): Deleted free argument. Updated all callers.

Rev: src/client_keyexchange.c:1.71
Rev: src/crypto.h:1.39
Rev: src/dh_exchange.c:1.23
Rev: src/server_keyexchange.c:1.61
Rev: src/srp_exchange.c:1.23
parent ab3b07b3
......@@ -111,7 +111,7 @@ client_dh_handler(struct transport_handler *s,
debug("Session key: %xS\n", self->dh.K);
dh_hash_update(&self->dh, ssh_format("%s", key_length, key), 1);
dh_hash_update(&self->dh, ssh_format("%s", key_length, key));
dh_hash_digest(&self->dh);
debug("Exchange hash: %xS\n", self->dh.exchange_hash);
......
......@@ -315,12 +315,8 @@ init_dh_state(struct dh_state *self,
const struct dh_params *params,
struct kexinit_state *kex);
/* NOTE: For all calls to this function, free = 1, which means that we
do some unnecessary allocation and freeing. But since key exchange
is pretty expensive anyway, it shouldn't matter much. */
void
dh_hash_update(struct dh_state *self,
struct lsh_string *s, int free);
dh_hash_update(struct dh_state *self, struct lsh_string *s);
void
dh_generate_secret(const struct dh_params *self,
......
......@@ -88,15 +88,15 @@ make_dh_group14(const struct hash_algorithm *H)
2, H);
}
/* Consumes the input string. FIXME: Allocating, hashing, and freeing
the string is somewhat unnecessary. It might make sense with a hash
update function that takes the same kind of format string as
ssh_format. */
void
dh_hash_update(struct dh_state *self,
struct lsh_string *s, int free)
dh_hash_update(struct dh_state *self, struct lsh_string *s)
{
debug("dh_hash_update: %xS\n", s);
hash_update(self->hash, STRING_LD(s));
if (free)
lsh_string_free(s);
lsh_string_free(s);
}
/* Hashes e, f, and the shared secret key */
......@@ -105,10 +105,8 @@ dh_hash_digest(struct dh_state *self)
{
dh_hash_update(self, ssh_format("%n%n%S",
self->e, self->f,
self->K), 1);
self->K));
self->exchange_hash = hash_digest_string(self->hash);
debug("dh_hash_digest: %xS\n", self->exchange_hash);
}
void
......@@ -126,19 +124,12 @@ init_dh_state(struct dh_state *self,
self->hash = make_hash(params->H);
self->exchange_hash = NULL;
debug("init_dh_state\n"
" V_C: %pS\n", kex->version[0]);
debug(" V_S: %pS\n", kex->version[1]);
debug(" I_C: %xS\n", kex->literal_kexinit[0]);
debug(" I_S: %xS\n", kex->literal_kexinit[1]);
dh_hash_update(self,
ssh_format("%S%S%S%S",
kex->version[0],
kex->version[1],
kex->literal_kexinit[0],
kex->literal_kexinit[1]),
1);
kex->literal_kexinit[1]));
}
/* R is set to a random, secret, exponent, and V set to is g^r */
......
......@@ -93,7 +93,7 @@ server_dh_handler(struct transport_handler *s,
debug("Session key: %xS\n", self->dh.K);
dh_hash_update(&self->dh, ssh_format("%S", self->key->public), 1);
dh_hash_update(&self->dh, ssh_format("%S", self->key->public));
dh_hash_digest(&self->dh);
debug("Exchange hash: %xS\n", self->dh.exchange_hash);
......
......@@ -170,7 +170,7 @@ struct lsh_string *
srp_make_init_msg(struct dh_instance *dh, struct lsh_string *name)
{
dh_generate_secret(dh->method, dh->secret, dh->e);
dh_hash_update(dh, ssh_format("%S", name), 1);
dh_hash_update(dh, ssh_format("%S", name));
debug("srp_make_init_msg: e = %xn\n", dh->e);
return ssh_format("%c%S%n", SSH_MSG_KEXSRP_INIT, name, dh->e);
......@@ -266,7 +266,7 @@ srp_make_reply_msg(struct dh_instance *dh, struct srp_entry *entry)
/* Update the exchange hash */
dh_hash_update(dh, ssh_format("%S%S", entry->name, entry->salt), 1);
dh_hash_update(dh, ssh_format("%S%S", entry->name, entry->salt));
dh_hash_digest(dh);
return ssh_format("%c%S%n", SSH_MSG_KEXSRP_REPLY, entry->salt, dh->f);
......@@ -301,7 +301,7 @@ srp_process_reply_msg(struct dh_instance *dh, struct lsh_string *packet)
lsh_string_free(salt);
return NULL;
}
dh_hash_update(dh, ssh_format("%S", salt), 1);
dh_hash_update(dh, ssh_format("%S", salt));
return salt;
}
else
......
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