Lines Matching defs:kex

88 #include "kex.h"
238 (ssh->kex = kex_new()) == NULL ||
262 kex_free(ssh->kex);
287 (ssh->kex != NULL && ssh->kex->done == 0);
350 kex_free(ssh->kex);
351 ssh->kex = NULL;
646 kex_free(ssh->kex);
647 ssh->kex = NULL;
855 if (ssh->kex && ssh->kex->newkeys[mode]) {
856 kex_free_newkeys(ssh->kex->newkeys[mode]);
857 ssh->kex->newkeys[mode] = NULL;
900 /* move newkeys from kex to state */
901 if ((state->newkeys[mode] = ssh->kex->newkeys[mode]) == NULL)
903 ssh->kex->newkeys[mode] = NULL;
1212 if ((ssh->kex->flags & KEX_INITIAL) != 0) {
1225 if (type == SSH2_MSG_NEWKEYS && ssh->kex->kex_strict) {
1437 if (ssh->kex)
1623 if ((ssh->kex->flags & KEX_INITIAL) != 0) {
1694 if (*typep == SSH2_MSG_NEWKEYS && ssh->kex->kex_strict) {
1749 if (ssh->kex != NULL &&
1750 (ssh->kex->flags & KEX_INITIAL) && ssh->kex->kex_strict)
1925 if (ssh->kex && ssh->kex->failed_choice) {
1931 ssh->kex->failed_choice);
2210 ssh->kex->server = 1; /* XXX unify? */
2248 /* turn kex into a blob for packet state serialization */
2250 kex_to_blob(struct sshbuf *m, struct kex *kex)
2254 if ((r = sshbuf_put_u32(m, kex->we_need)) != 0 ||
2255 (r = sshbuf_put_cstring(m, kex->hostkey_alg)) != 0 ||
2256 (r = sshbuf_put_u32(m, kex->hostkey_type)) != 0 ||
2257 (r = sshbuf_put_u32(m, kex->hostkey_nid)) != 0 ||
2258 (r = sshbuf_put_u32(m, kex->kex_type)) != 0 ||
2259 (r = sshbuf_put_u32(m, kex->kex_strict)) != 0 ||
2260 (r = sshbuf_put_stringb(m, kex->my)) != 0 ||
2261 (r = sshbuf_put_stringb(m, kex->peer)) != 0 ||
2262 (r = sshbuf_put_stringb(m, kex->client_version)) != 0 ||
2263 (r = sshbuf_put_stringb(m, kex->server_version)) != 0 ||
2264 (r = sshbuf_put_stringb(m, kex->session_id)) != 0 ||
2265 (r = sshbuf_put_u32(m, kex->flags)) != 0)
2321 if ((r = kex_to_blob(m, ssh->kex)) != 0 ||
2399 ssh->kex->newkeys[mode] = newkey;
2408 /* restore kex from blob for packet state de-serialization */
2410 kex_from_blob(struct sshbuf *m, struct kex **kexp)
2412 struct kex *kex;
2415 if ((kex = kex_new()) == NULL)
2417 if ((r = sshbuf_get_u32(m, &kex->we_need)) != 0 ||
2418 (r = sshbuf_get_cstring(m, &kex->hostkey_alg, NULL)) != 0 ||
2419 (r = sshbuf_get_u32(m, (u_int *)&kex->hostkey_type)) != 0 ||
2420 (r = sshbuf_get_u32(m, (u_int *)&kex->hostkey_nid)) != 0 ||
2421 (r = sshbuf_get_u32(m, &kex->kex_type)) != 0 ||
2422 (r = sshbuf_get_u32(m, &kex->kex_strict)) != 0 ||
2423 (r = sshbuf_get_stringb(m, kex->my)) != 0 ||
2424 (r = sshbuf_get_stringb(m, kex->peer)) != 0 ||
2425 (r = sshbuf_get_stringb(m, kex->client_version)) != 0 ||
2426 (r = sshbuf_get_stringb(m, kex->server_version)) != 0 ||
2427 (r = sshbuf_get_stringb(m, kex->session_id)) != 0 ||
2428 (r = sshbuf_get_u32(m, &kex->flags)) != 0)
2430 kex->server = 1;
2431 kex->done = 1;
2435 kex_free(kex);
2440 *kexp = kex;
2457 if ((r = kex_from_blob(m, &ssh->kex)) != 0 ||
2677 if (ssh->kex)