Lines Matching refs:kex
41 #include "kex.h"
57 struct kex *kex = ssh->kex;
61 switch (kex->kex_type) {
63 kex->dh = dh_new_group1();
67 kex->dh = dh_new_group14();
70 kex->dh = dh_new_group16();
73 kex->dh = dh_new_group18();
79 if (kex->dh == NULL) {
83 if ((r = dh_gen_key(kex->dh, kex->we_need * 8)) != 0)
97 struct kex *kex = ssh->kex;
106 if (kex->load_host_public_key == NULL ||
107 kex->load_host_private_key == NULL) {
111 server_host_public = kex->load_host_public_key(kex->hostkey_type,
112 kex->hostkey_nid, ssh);
113 server_host_private = kex->load_host_private_key(kex->hostkey_type,
114 kex->hostkey_nid, ssh);
137 DHparams_print_fp(stderr, kex->dh);
139 BN_print_fp(stderr, kex->dh->pub_key);
142 if (!dh_pub_is_valid(kex->dh, dh_client_pub)) {
148 klen = DH_size(kex->dh);
154 if ((kout = DH_compute_key(kbuf, dh_client_pub, kex->dh)) < 0 ||
168 kex->hash_alg,
169 kex->client_version_string,
170 kex->server_version_string,
171 sshbuf_ptr(kex->peer), sshbuf_len(kex->peer),
172 sshbuf_ptr(kex->my), sshbuf_len(kex->my),
175 kex->dh->pub_key,
181 if (kex->session_id == NULL) {
182 kex->session_id_len = hashlen;
183 kex->session_id = malloc(kex->session_id_len);
184 if (kex->session_id == NULL) {
188 memcpy(kex->session_id, hash, kex->session_id_len);
192 if ((r = kex->sign(server_host_private, server_host_public, &signature,
193 &slen, hash, hashlen, kex->hostkey_alg, ssh->compat)) < 0)
201 (r = sshpkt_put_bignum2(ssh, kex->dh->pub_key)) != 0 || /* f */
210 DH_free(kex->dh);
211 kex->dh = NULL;